|
@@ -2,19 +2,20 @@ package com.ozs.web.controller.accountmanagment;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.ozs.common.annotation.Log;
|
|
|
+import com.ozs.common.core.controller.BaseController;
|
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
|
import com.ozs.common.enums.BusinessType;
|
|
|
+import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.entity.BaseVehicle;
|
|
|
+import com.ozs.entity.vo.BaseVehicleVo;
|
|
|
import com.ozs.service.BaseVehicleService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -27,7 +28,7 @@ import java.util.Date;
|
|
|
@RestController
|
|
|
@RequestMapping("/baseVehicle")
|
|
|
@Slf4j
|
|
|
-public class BaseVehicleController {
|
|
|
+public class BaseVehicleController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private BaseVehicleService baseVehicleService;
|
|
@@ -44,12 +45,66 @@ public class BaseVehicleController {
|
|
|
*/
|
|
|
@ApiOperation(value = "机车信息表 分页查询")
|
|
|
@PostMapping("/vehicleList")
|
|
|
- @Log(title = "相机台账管理", businessType = BusinessType.SELECT)
|
|
|
- public AjaxResult vehicleList(@RequestBody BaseVehicle baseVehicle) {
|
|
|
+ @Log(title = "机车信息表 分页查询", businessType = BusinessType.SELECT)
|
|
|
+ public AjaxResult vehicleList(@RequestBody BaseVehicleVo baseVehicle) {
|
|
|
IPage<BaseVehicle> baseVehicleList = baseVehicleService.vehicleList(baseVehicle);
|
|
|
return AjaxResult.success(baseVehicleList);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 机车信息表 新增
|
|
|
+ *
|
|
|
+ * @param baseVehicle
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "机车信息表 新增")
|
|
|
+ @PostMapping("/vehicleAdd")
|
|
|
+ @Log(title = "机车信息表 新增", businessType = BusinessType.SELECT)
|
|
|
+ public AjaxResult vehicleAdd(@RequestBody BaseVehicle baseVehicle) {
|
|
|
+ if (StringUtils.isEmptySunhh(baseVehicle) || StringUtils.isEmptySunhh(baseVehicle.getVehicleName())
|
|
|
+ || StringUtils.isEmptySunhh(baseVehicle.getVehicleCode())) {
|
|
|
+ return AjaxResult.error("机车名称、机车编码不能为空!");
|
|
|
+ }
|
|
|
+ return baseVehicleService.vehicleAdd(baseVehicle, getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机车信息表 修改
|
|
|
+ *
|
|
|
+ * @param baseVehicle
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "机车信息表 修改")
|
|
|
+ @PostMapping("/vehicleUpdate")
|
|
|
+ @Log(title = "机车信息表 修改", businessType = BusinessType.SELECT)
|
|
|
+ public AjaxResult vehicleUpdate(@RequestBody BaseVehicle baseVehicle) {
|
|
|
+ if (StringUtils.isEmptySunhh(baseVehicle) || StringUtils.isEmptySunhh(baseVehicle.getId())) {
|
|
|
+ return AjaxResult.error("修改ID不能为空!");
|
|
|
+ }
|
|
|
+ return baseVehicleService.vehicleUpdate(baseVehicle,getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 机车信息表 删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "机车信息表 删除")
|
|
|
+ @PostMapping("/vehicleDelete")
|
|
|
+ @Log(title = "机车信息表 删除", businessType = BusinessType.SELECT)
|
|
|
+ public AjaxResult vehicleDelete(@PathVariable List<Long> ids) {
|
|
|
+ if (StringUtils.isEmptySunhh(ids)) {
|
|
|
+ return AjaxResult.error("删除ID不能为空!");
|
|
|
+ }
|
|
|
+ boolean delete = baseVehicleService.removeByIds(ids);
|
|
|
+ if (delete) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|