|
@@ -1,6 +1,7 @@
|
|
|
package org.jeecg.modules.itdmDevice.controller;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -39,7 +40,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
/**
|
|
|
* @Description: 设备表
|
|
|
* @Author: jeecg-boot
|
|
|
- * @Date: 2023-05-19
|
|
|
+ * @Date: 2023-05-20
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
@Api(tags="设备表")
|
|
@@ -49,7 +50,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
public class ItdmDeviceController extends JeecgController<ItdmDevice, IItdmDeviceService> {
|
|
|
@Autowired
|
|
|
private IItdmDeviceService itdmDeviceService;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -71,7 +72,7 @@ public class ItdmDeviceController extends JeecgController<ItdmDevice, IItdmDevic
|
|
|
IPage<ItdmDevice> pageList = itdmDeviceService.page(page, queryWrapper);
|
|
|
return Result.OK(pageList);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|
|
@@ -86,22 +87,45 @@ public class ItdmDeviceController extends JeecgController<ItdmDevice, IItdmDevic
|
|
|
itdmDeviceService.save(itdmDevice);
|
|
|
return Result.OK("添加成功!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 编辑
|
|
|
*
|
|
|
* @param itdmDevice
|
|
|
* @return
|
|
|
*/
|
|
|
- @AutoLog(value = "设备表-编辑")
|
|
|
- @ApiOperation(value="设备表-编辑", notes="设备表-编辑")
|
|
|
- //@RequiresPermissions("org.jeecg.modules:itdm_device:edit")
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<String> edit(@RequestBody ItdmDevice itdmDevice) {
|
|
|
- itdmDeviceService.updateById(itdmDevice);
|
|
|
- return Result.OK("编辑成功!");
|
|
|
- }
|
|
|
-
|
|
|
+ @AutoLog(value = "设备表-编辑")
|
|
|
+ @ApiOperation(value="设备表-编辑", notes="设备表-编辑")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:itdm_device:edit")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody ItdmDevice itdmDevice) {
|
|
|
+ ItdmDevice itdmDeviceYuan = itdmDeviceService.getById(itdmDevice.getId());
|
|
|
+ Date date_now = itdmDevice.getRepairTime();
|
|
|
+ Date date_yuan = itdmDeviceYuan.getRepairTime();
|
|
|
+ if(date_now == null){
|
|
|
+ itdmDevice.setIsRepair(0); //传来的维护时间为空,需将维护状态改为未维护
|
|
|
+ }else if( !date_now.equals(date_yuan)){ //两个维护时间不同,说明重新输入了维护时间,需将维护状态改为未维护
|
|
|
+ itdmDevice.setIsRepair(0);
|
|
|
+ }
|
|
|
+ itdmDeviceService.updateById(itdmDevice);
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑2——仅修改设备状态故障、非故障
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备表-编辑2仅修改设备状态故障、非故障")
|
|
|
+ @ApiOperation(value="设备表-编辑2仅修改设备状态故障、非故障", notes="设备表-编辑2仅修改设备状态故障、非故障")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:itdm_device:edit1")
|
|
|
+ @RequestMapping(value = "/edit1", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
+ public Result<String> edit1(@RequestBody ItdmDevice itdmDevice) {
|
|
|
+ ItdmDevice itdmDeviceNew = new ItdmDevice();
|
|
|
+ itdmDeviceNew.setId(itdmDevice.getId());
|
|
|
+ itdmDeviceNew.setDeviceStatus(itdmDevice.getDeviceStatus());
|
|
|
+ itdmDeviceService.updateById(itdmDevice);
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 通过id删除
|
|
|
*
|
|
@@ -116,7 +140,7 @@ public class ItdmDeviceController extends JeecgController<ItdmDevice, IItdmDevic
|
|
|
itdmDeviceService.removeById(id);
|
|
|
return Result.OK("删除成功!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 批量删除
|
|
|
*
|
|
@@ -131,7 +155,7 @@ public class ItdmDeviceController extends JeecgController<ItdmDevice, IItdmDevic
|
|
|
this.itdmDeviceService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
return Result.OK("批量删除成功!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 通过id查询
|
|
|
*
|