Parcourir la source

点检内容状态修改

LLL il y a 1 an
Parent
commit
acb0cc6bef

+ 27 - 29
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/controller/CmmsSpotcheckContentController.java

@@ -1,43 +1,26 @@
 package org.jeecg.modules.cmmsSpotcheckContent.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
-import org.jeecg.modules.cmmsSpotcheckContent.service.ICmmsSpotcheckContentService;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
-import org.jeecg.modules.cmmsSpotcheckItem.entity.CmmsSpotcheckItem;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
+import org.jeecg.modules.cmmsSpotcheckContent.service.ICmmsSpotcheckContentService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.jeecg.common.aspect.annotation.AutoLog;
 
- /**
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+/**
  * @Description: 点检内容
  * @Author: jeecg-boot
  * @Date:   2024-01-15
@@ -53,7 +36,22 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
 
 	 /**
 	  * 如果要修改该点检内容状态为“启用”,那该设备的其他点检项都停掉
+	  * 启用:0
+	  * 禁用:1
 	  * */
+	 @AutoLog(value = "点检内容-修改该点检内容状态为“启用”,该设备的其他点检项都停用")
+	 @ApiOperation(value="点检内容-修改该点检内容状态为“启用”,该设备的其他点检项都停用", notes="点检内容-修改该点检内容状态为“启用”,该设备的其他点检项都停用")
+	 @RequestMapping(value = "/editStatus", method = {RequestMethod.PUT,RequestMethod.POST})
+	 public Result<String> editStatus(@RequestBody CmmsSpotcheckContent cmmsSpotcheckContent) {
+	 	 if(cmmsSpotcheckContent.getStatus()!=null && !"".equals(cmmsSpotcheckContent.getStatus())){
+	 	 	if(cmmsSpotcheckContent.getStatus().equals("0")){
+				cmmsSpotcheckContentService.updateStatusByEquipmentid(cmmsSpotcheckContent.getEquipmentid(),"1");
+			}
+		 }
+		 cmmsSpotcheckContentService.updateById(cmmsSpotcheckContent);
+		 return Result.OK("编辑成功!");
+	 }
+
 
 
 	 /**

+ 2 - 2
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/entity/CmmsSpotcheckContent.java

@@ -45,8 +45,8 @@ public class CmmsSpotcheckContent implements Serializable {
     @ApiModelProperty(value = "点检内容名称")
     private java.lang.String contentname;
 	/**设备id*/
-	@Excel(name = "设备id", width = 15, dictTable = "ems_tpm_equipment_tree", dicText = "name", dicCode = "id")
-	@Dict(dictTable = "ems_tpm_equipment_tree", dicText = "name", dicCode = "id")
+	@Excel(name = "设备id", width = 15, dictTable = "ems_tpm_equipment", dicText = "equipmentname", dicCode = "id")
+	@Dict(dictTable = "ems_tpm_equipment", dicText = "equipmentname", dicCode = "id")
     @ApiModelProperty(value = "设备id")
     private java.lang.String equipmentid;
 	/**状态:启用:0、禁用:1*/

+ 8 - 0
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/mapper/CmmsSpotcheckContentMapper.java

@@ -16,6 +16,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface CmmsSpotcheckContentMapper extends BaseMapper<CmmsSpotcheckContent> {
 
     /**
+     * 根据设备id修改该设备所有点检内容状态
+     * 启用:0、禁用:1
+     * */
+    @Select(" update ems_cmms_spotcheck_content set status = #{status} " +
+            "where equipmentid = #{equipmentid}")
+    public void updateStatusByEquipmentid(String equipmentid, String status);
+
+    /**
      * 根据设备id查询该设备现在点检内容已启用数量
      * */
     @Select("select count(1) from ems_cmms_spotcheck_content " +

+ 6 - 0
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/service/ICmmsSpotcheckContentService.java

@@ -12,6 +12,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface ICmmsSpotcheckContentService extends IService<CmmsSpotcheckContent> {
 
     /**
+     * 根据设备id修改该设备所有点检内容状态
+     * 启用:0、禁用:1
+     * */
+    public void updateStatusByEquipmentid(String equipmentid, String status);
+
+    /**
      * 根据设备id查询该设备现在点检内容已启用数量
      * */
     public int numByEquipmentid(String equipmentid);

+ 8 - 0
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/service/impl/CmmsSpotcheckContentServiceImpl.java

@@ -21,6 +21,14 @@ public class CmmsSpotcheckContentServiceImpl extends ServiceImpl<CmmsSpotcheckCo
     private CmmsSpotcheckContentMapper spotcheckContentMapper;
 
     /**
+     * 根据设备id修改该设备所有点检内容状态
+     * 启用:0、禁用:1
+     * */
+    public void updateStatusByEquipmentid(String equipmentid, String status){
+        spotcheckContentMapper.updateStatusByEquipmentid(equipmentid,status);
+    }
+
+    /**
      * 根据设备id查询该设备现在点检内容已启用数量
      * */
     public int numByEquipmentid(String equipmentid){