|
@@ -14,6 +14,7 @@ import org.jeecg.modules.cmmsSpotcheckContent.convert.CmmsSpotcheckContentConver
|
|
import org.jeecg.modules.cmmsSpotcheckContent.dto.CmmsSpotcheckContentAddDTO;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.dto.CmmsSpotcheckContentAddDTO;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.service.ICmmsSpotcheckContentService;
|
|
import org.jeecg.modules.cmmsSpotcheckContent.service.ICmmsSpotcheckContentService;
|
|
|
|
+import org.jeecg.modules.cmmsSpotcheckContent.vo.CmmsSpotcheckContentQueryVO;
|
|
import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
|
|
import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
|
|
import org.jeecg.modules.cmmsSpotcheckContentItem.service.ICmmsSpotcheckContentItemService;
|
|
import org.jeecg.modules.cmmsSpotcheckContentItem.service.ICmmsSpotcheckContentItemService;
|
|
import org.jeecg.modules.util.AutoCodeUtil;
|
|
import org.jeecg.modules.util.AutoCodeUtil;
|
|
@@ -48,6 +49,23 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
|
|
@Autowired
|
|
@Autowired
|
|
private ICmmsSpotcheckContentItemService spotcheckContentItemService;
|
|
private ICmmsSpotcheckContentItemService spotcheckContentItemService;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 通过id查询
|
|
|
|
+ */
|
|
|
|
+ @ApiOperation("获取点检内容详细信息——包括该点检内容对应的点检项")
|
|
|
|
+ @GetMapping(value = "/queryContentAndItemById")
|
|
|
|
+ public Result<CmmsSpotcheckContentQueryVO> queryContentAndItemById(@RequestParam(name="id",required=true) String id) {
|
|
|
|
+ CmmsSpotcheckContent cmmsSpotcheckContent = cmmsSpotcheckContentService.getById(id);
|
|
|
|
+ if(cmmsSpotcheckContent==null) {
|
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> columnMap = new HashMap<>();
|
|
|
|
+ columnMap.put("spotcheckcontid",cmmsSpotcheckContent.getId());
|
|
|
|
+ List<CmmsSpotcheckContentItem> spotcheckContentItemList = spotcheckContentItemService.listByMap(columnMap);
|
|
|
|
+ CmmsSpotcheckContentQueryVO vo = CmmsSpotcheckContentConvert.INSTANCE.convertVo(cmmsSpotcheckContent,spotcheckContentItemList);
|
|
|
|
+ return Result.OK(vo);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 如果要修改该点检内容状态为“启用”,那该设备的其他点检项都停掉
|
|
* 如果要修改该点检内容状态为“启用”,那该设备的其他点检项都停掉
|
|
* 启用:0
|
|
* 启用:0
|
|
@@ -126,14 +144,26 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
|
|
/**
|
|
/**
|
|
* 编辑
|
|
* 编辑
|
|
*
|
|
*
|
|
- * @param cmmsSpotcheckContent
|
|
|
|
|
|
+ * @param dto
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@AutoLog(value = "点检内容-编辑")
|
|
@AutoLog(value = "点检内容-编辑")
|
|
@ApiOperation(value="点检内容-编辑", notes="点检内容-编辑")
|
|
@ApiOperation(value="点检内容-编辑", notes="点检内容-编辑")
|
|
//@RequiresPermissions("org.jeecg.modules:ems_cmms_spotcheck_content:edit")
|
|
//@RequiresPermissions("org.jeecg.modules:ems_cmms_spotcheck_content:edit")
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
- public Result<String> edit(@RequestBody CmmsSpotcheckContent cmmsSpotcheckContent) {
|
|
|
|
|
|
+ public Result<String> edit(@RequestBody CmmsSpotcheckContentAddDTO dto) {
|
|
|
|
+ CmmsSpotcheckContent cmmsSpotcheckContent = CmmsSpotcheckContentConvert.INSTANCE.convert(dto);
|
|
|
|
+
|
|
|
|
+ Map<String, Object> columnMap = new HashMap<>();
|
|
|
|
+ columnMap.put("spotcheckcontid",dto.getId());
|
|
|
|
+ spotcheckContentItemService.removeByMap(columnMap);
|
|
|
|
+
|
|
|
|
+ List<CmmsSpotcheckContentItem> contentItemList = dto.getSpotcheckContentItemList();
|
|
|
|
+ if (contentItemList != null && contentItemList.size() > 0) {
|
|
|
|
+ contentItemList.stream().map(i->i.setSpotcheckcontid(cmmsSpotcheckContent.getId())).collect(Collectors.toList());
|
|
|
|
+ spotcheckContentItemService.saveBatch(contentItemList);
|
|
|
|
+ }
|
|
|
|
+
|
|
cmmsSpotcheckContentService.updateById(cmmsSpotcheckContent);
|
|
cmmsSpotcheckContentService.updateById(cmmsSpotcheckContent);
|
|
return Result.OK("编辑成功!");
|
|
return Result.OK("编辑成功!");
|
|
}
|
|
}
|