Bladeren bron

点检内容——根据设备id查询该设备现在点检内容已启用数量

LLL 1 jaar geleden
bovenliggende
commit
06673d6327

+ 21 - 6
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/controller/CmmsSpotcheckContentController.java

@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 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;
@@ -49,7 +50,21 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotcheckContent, ICmmsSpotcheckContentService> {
 	@Autowired
 	private ICmmsSpotcheckContentService cmmsSpotcheckContentService;
-	
+
+	 /**
+	  * 如果要修改该点检内容状态为“启用”,那该设备的其他点检项都停掉
+	  * */
+
+
+	 /**
+	  * 根据设备id查询该设备现在点检内容已启用数量
+	  * */
+	 @ApiOperation("根据设备id查询该设备现在点检内容已启用数量")
+	 @GetMapping(value = "/numByEquipmentid/{equipmentid}")
+	 public Result<Integer> numByEquipmentid(@PathVariable("equipmentid") String equipmentid){
+		 return Result.OK(cmmsSpotcheckContentService.numByEquipmentid(equipmentid));
+	 }
+
 	/**
 	 * 分页列表查询
 	 *
@@ -71,7 +86,7 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
 		IPage<CmmsSpotcheckContent> pageList = cmmsSpotcheckContentService.page(page, queryWrapper);
 		return Result.OK(pageList);
 	}
-	
+
 	/**
 	 *   添加
 	 *
@@ -86,7 +101,7 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
 		cmmsSpotcheckContentService.save(cmmsSpotcheckContent);
 		return Result.OK("添加成功!");
 	}
-	
+
 	/**
 	 *  编辑
 	 *
@@ -101,7 +116,7 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
 		cmmsSpotcheckContentService.updateById(cmmsSpotcheckContent);
 		return Result.OK("编辑成功!");
 	}
-	
+
 	/**
 	 *   通过id删除
 	 *
@@ -116,7 +131,7 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
 		cmmsSpotcheckContentService.removeById(id);
 		return Result.OK("删除成功!");
 	}
-	
+
 	/**
 	 *  批量删除
 	 *
@@ -131,7 +146,7 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
 		this.cmmsSpotcheckContentService.removeByIds(Arrays.asList(ids.split(",")));
 		return Result.OK("批量删除成功!");
 	}
-	
+
 	/**
 	 * 通过id查询
 	 *

+ 22 - 0
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/convert/CmmsSpotcheckContentConvert.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.cmmsSpotcheckContent.convert;
+
+
+import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
+import org.jeecg.modules.cmmsSpotcheckItem.entity.CmmsSpotcheckItem;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+import org.springframework.util.CollectionUtils;
+
+import java.util.stream.Collectors;
+
+@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE,imports ={ CollectionUtils.class, Collectors.class})
+public interface CmmsSpotcheckContentConvert {
+
+    CmmsSpotcheckContentConvert INSTANCE = Mappers.getMapper(CmmsSpotcheckContentConvert.class);
+
+    @Mapping(target ="equipmenttreeid",source ="equipmenttreeid")
+    CmmsSpotcheckContent convert(CmmsSpotcheckContent cmmsSpotcheckContent, String itemcode, String equipmenttreeid);
+
+}

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.cmmsSpotcheckContent.mapper;
 import java.util.List;
 
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -14,4 +15,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface CmmsSpotcheckContentMapper extends BaseMapper<CmmsSpotcheckContent> {
 
+    /**
+     * 根据设备id查询该设备现在点检内容已启用数量
+     * */
+    @Select("select count(1) from ems_cmms_spotcheck_content " +
+            "where equipmentid=#{equipmentid} and status='0'")
+    public int numByEquipmentid(String equipmentid);
+
 }

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

@@ -11,4 +11,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ICmmsSpotcheckContentService extends IService<CmmsSpotcheckContent> {
 
+    /**
+     * 根据设备id查询该设备现在点检内容已启用数量
+     * */
+    public int numByEquipmentid(String equipmentid);
+
+
 }

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.cmmsSpotcheckContent.service.impl;
 import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
 import org.jeecg.modules.cmmsSpotcheckContent.mapper.CmmsSpotcheckContentMapper;
 import org.jeecg.modules.cmmsSpotcheckContent.service.ICmmsSpotcheckContentService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -16,4 +17,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 public class CmmsSpotcheckContentServiceImpl extends ServiceImpl<CmmsSpotcheckContentMapper, CmmsSpotcheckContent> implements ICmmsSpotcheckContentService {
 
+    @Autowired
+    private CmmsSpotcheckContentMapper spotcheckContentMapper;
+
+    /**
+     * 根据设备id查询该设备现在点检内容已启用数量
+     * */
+    public int numByEquipmentid(String equipmentid){
+        return spotcheckContentMapper.numByEquipmentid(equipmentid);
+    }
+
 }

+ 0 - 9
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckItem/controller/CmmsSpotcheckItemController.java

@@ -42,15 +42,6 @@ public class CmmsSpotcheckItemController extends JeecgController<CmmsSpotcheckIt
 	@Autowired
 	private AutoCodeUtil autoCodeUtil;
 
-	/**
-	 * 根据设备id查询该设备现在点检内容已启用数量
-	 * */
-	@ApiOperation("根据设备id查询该设备现在点检内容已启用数量")
-	@GetMapping(value = "/numByEquipmentid/{equipmentid}")
-	public Result<Integer> numByEquipmentid(@PathVariable("equipmentid") String equipmentid){
-		return Result.OK(cmmsSpotcheckItemService.numByEquipmentid(equipmentid));
-	}
-
 
 	 /**
 	  * 依据设备ID获取点检项信息

+ 1 - 0
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckItem/convert/CmmsSpotcheckItemConvert.java

@@ -16,5 +16,6 @@ public interface CmmsSpotcheckItemConvert {
 
 
     @Mapping(target ="equipmenttreeid",source ="equipmenttreeid")
+    @Mapping(target ="itemcode",source ="itemcode")
     CmmsSpotcheckItem convert( CmmsSpotcheckItem cmmsSpotcheckItem,String itemcode,String equipmenttreeid);
 }

+ 0 - 7
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckItem/mapper/CmmsSpotcheckItemMapper.java

@@ -17,13 +17,6 @@ public interface CmmsSpotcheckItemMapper extends BaseMapper<CmmsSpotcheckItem> {
 
 
     /**
-     * 根据设备id查询该设备现在点检内容已启用数量
-     * */
-    @Select("select count(1) from ems_cmms_spotcheck_content " +
-            "where equipmentid=#{equipmentid} and status='0'")
-    public int numByEquipmentid(String equipmentid);
-
-    /**
      * 查询点检项列表
      *
      * @param cmmsSpotcheckItem 点检项

+ 0 - 4
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckItem/service/ICmmsSpotcheckItemService.java

@@ -14,10 +14,6 @@ import java.util.List;
  */
 public interface ICmmsSpotcheckItemService extends IService<CmmsSpotcheckItem> {
 
-    /**
-     * 根据设备id查询该设备现在点检内容已启用数量
-     * */
-    public int numByEquipmentid(String equipmentid);
 
     /**
      * 查询点检项列表

+ 0 - 7
jeecg_module_ems/src/main/java/org/jeecg/modules/cmmsSpotcheckItem/service/impl/CmmsSpotcheckItemServiceImpl.java

@@ -29,13 +29,6 @@ public class CmmsSpotcheckItemServiceImpl extends ServiceImpl<CmmsSpotcheckItemM
     private CmmsSpotcheckItemMapper spotcheckItemMapper;
 
     /**
-     * 根据设备id查询该设备现在点检内容已启用数量
-     * */
-    public int numByEquipmentid(String equipmentid){
-        return spotcheckItemMapper.numByEquipmentid(equipmentid);
-    }
-
-    /**
      * 查询点检项列表
      *
      * @param equipmentid 设备ID