| | |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.maintenance.service.IXpVehicleDescriptionService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Api(tags = "车辆整备、充电、检测说明") |
| | | @RestController |
| | | @RequestMapping("/xp-vehicle-description") |
| | | public class XpVehicleDescriptionController { |
| | | |
| | | private final IXpVehicleDescriptionService xpVehicleDescriptionService; |
| | |
| | | this.xpVehicleDescriptionService = xpVehicleDescriptionService; |
| | | } |
| | | |
| | | @ApiOperation(value = "获取车辆整备、充电、检测说明",notes = "车辆说明1胎压说明 2灯光说明 3车身标识及清洁说明 4舱内清洁及消毒 5遗失物品上报 6车辆充电说明 7车辆检测说明 8=车辆运维规则",tags = {"运维APP-车辆管理"}) |
| | | @ApiOperation(value = "获取车辆整备、充电、检测、保险、年检、保养、运营资质说明",notes = "车辆说明1胎压说明 2灯光说明 3车身标识及清洁说明 4舱内清洁及消毒 5遗失物品上报 6车辆充电说明 7车辆检测说明 8=车辆保险标准说明 9=车辆年检标准说明 10=车辆保养标准说明 11=车辆运营资质标准说明",tags = {"运维APP-车辆管理"}) |
| | | @GetMapping("/api/v1/vehicle/vehicleDescription") |
| | | public R<XpVehicleDescription> getVehicleDescription(@RequestParam Integer descriptionType) { |
| | | XpVehicleDescription xpVehicleDescription = xpVehicleDescriptionService.getOne(Wrappers.lambdaQuery(XpVehicleDescription.class) |
| | |
| | | return R.ok(xpVehicleDescription); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取车辆整备、充电、检测、保险、年检、保养、运营资质说明",notes = "车辆说明1胎压说明 2灯光说明 3车身标识及清洁说明 4舱内清洁及消毒 5遗失物品上报 6车辆充电说明 7车辆检测说明 8=车辆保险标准说明 9=车辆年检标准说明 10=车辆保养标准说明 11=车辆运营资质标准说明",tags = {"管理后台-车辆管理"}) |
| | | @GetMapping("/api/v1/vehicle-description/vehicleDescription") |
| | | @ApiImplicitParam(name = "descriptionType", value = "车辆说明1胎压说明 2灯光说明 3车身标识及清洁说明 4舱内清洁及消毒 5遗失物品上报 6车辆充电说明 7车辆检测说明 8=车辆保险标准说明 9=车辆年检标准说明 10=车辆保养标准说明 11=车辆运营资质标准说明", required = true, paramType = "query", dataTypeClass = Integer.class) |
| | | public R<XpVehicleDescription> getVehicleDescriptionByType(@RequestParam Integer descriptionType) { |
| | | XpVehicleDescription xpVehicleDescription = xpVehicleDescriptionService.getOne(Wrappers.lambdaQuery(XpVehicleDescription.class) |
| | | .eq(XpVehicleDescription::getDescriptionType, descriptionType) |
| | | .last("LIMIT 1")); |
| | | return R.ok(xpVehicleDescription); |
| | | } |
| | | |
| | | @ApiOperation(value = "保存车辆整备、充电、检测、保险、年检、保养、运营资质说明") |
| | | @PostMapping("/api/v1/vehicle-description/save") |
| | | public R<?> saveVehicleDescription(@RequestBody XpVehicleDescription xpVehicleDescription) { |
| | | if (xpVehicleDescription.getDescriptionType() == null) { |
| | | return R.fail("descriptionType不能为空"); |
| | | } |
| | | // 先查询是否存在 |
| | | XpVehicleDescription existing = xpVehicleDescriptionService.getOne(Wrappers.lambdaQuery(XpVehicleDescription.class) |
| | | .eq(XpVehicleDescription::getDescriptionType, xpVehicleDescription.getDescriptionType()) |
| | | .last("LIMIT 1")); |
| | | if (existing != null) { |
| | | // 存在则更新 |
| | | existing.setDescriptionContent(xpVehicleDescription.getDescriptionContent()); |
| | | xpVehicleDescriptionService.updateById(existing); |
| | | } else { |
| | | // 不存在则插入 |
| | | xpVehicleDescriptionService.save(xpVehicleDescription); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |