Browse Source

优化 通过点检内容id查询获取点检内容详细信息

LLL 1 year ago
parent
commit
0c3436382c

+ 5 - 4
module_cmms/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/controller/CmmsSpotcheckContentController.java

@@ -17,6 +17,7 @@ import org.jeecg.modules.cmmsSpotcheckContent.service.ICmmsSpotcheckContentServi
 import org.jeecg.modules.cmmsSpotcheckContent.vo.CmmsSpotcheckContentQueryVO;
 import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
 import org.jeecg.modules.cmmsSpotcheckContentItem.service.ICmmsSpotcheckContentItemService;
+import org.jeecg.modules.cmmsSpotcheckContentItem.vo.CmmsSpotcheckContentItemVO;
 import org.jeecg.modules.util.AutoCodeUtil;
 import org.jeecg.modules.util.UserConstants;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -59,10 +60,10 @@ public class CmmsSpotcheckContentController extends JeecgController<CmmsSpotchec
 		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);
+		CmmsSpotcheckContentItem contentItem = new CmmsSpotcheckContentItem();
+		contentItem.setSpotcheckcontid(id);
+		List<CmmsSpotcheckContentItemVO> contentItemVOList = spotcheckContentItemService.selectCmmsSpotcheckContentItemList(contentItem);
+		CmmsSpotcheckContentQueryVO vo = CmmsSpotcheckContentConvert.INSTANCE.convertVo(cmmsSpotcheckContent,contentItemVOList);
 		return Result.OK(vo);
 	}
 

+ 2 - 1
module_cmms/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/convert/CmmsSpotcheckContentConvert.java

@@ -7,6 +7,7 @@ import org.jeecg.modules.cmmsSpotcheckContent.dto.CmmsSpotcheckContentAddDTO;
 import org.jeecg.modules.cmmsSpotcheckContent.entity.CmmsSpotcheckContent;
 import org.jeecg.modules.cmmsSpotcheckContent.vo.CmmsSpotcheckContentQueryVO;
 import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
+import org.jeecg.modules.cmmsSpotcheckContentItem.vo.CmmsSpotcheckContentItemVO;
 import org.jeecg.modules.cmmsSpotcheckTitem.entity.CmmsSpotcheckTitem;
 import org.jeecg.modules.sysUploadFile.entity.SysUploadFile;
 import org.mapstruct.Mapper;
@@ -26,7 +27,7 @@ public interface CmmsSpotcheckContentConvert {
 
     CmmsSpotcheckContent convert(CmmsSpotcheckContentAddDTO dto);
 
-    CmmsSpotcheckContentQueryVO convertVo(CmmsSpotcheckContent cmmsSpotcheckContent, List<CmmsSpotcheckContentItem> spotcheckContentItemList);
+    CmmsSpotcheckContentQueryVO convertVo(CmmsSpotcheckContent cmmsSpotcheckContent, List<CmmsSpotcheckContentItemVO> contentItemVOList);
 
     @Mapping(target = "cmmsSpotcheckTitemList",source = "titemList")
     @Mapping(target = "files",source = "files")

+ 2 - 2
module_cmms/src/main/java/org/jeecg/modules/cmmsSpotcheckContent/vo/CmmsSpotcheckContentQueryVO.java

@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.jeecg.common.aspect.annotation.Dict;
-import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
+import org.jeecg.modules.cmmsSpotcheckContentItem.vo.CmmsSpotcheckContentItemVO;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -64,5 +64,5 @@ public class CmmsSpotcheckContentQueryVO  implements Serializable {
     private java.lang.String remark;
 
     /**点检内容-点检项集合*/
-    private List<CmmsSpotcheckContentItem> spotcheckContentItemList ;
+    private List<CmmsSpotcheckContentItemVO> spotcheckContentItemList ;
 }

+ 10 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsSpotcheckContentItem/mapper/CmmsSpotcheckContentItemMapper.java

@@ -5,6 +5,7 @@ import java.util.List;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.cmmsSpotcheckContentItem.vo.CmmsSpotcheckContentItemVO;
 
 /**
  * @Description: 点检内容-点检项
@@ -14,4 +15,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface CmmsSpotcheckContentItemMapper extends BaseMapper<CmmsSpotcheckContentItem> {
 
+    /**
+     * 查询点检内容-点检项列表
+     *
+     * @param cmmsSpotcheckContentItem 点检内容-点检项
+     * @return 点检内容-点检项集合
+     */
+    public List<CmmsSpotcheckContentItemVO> selectCmmsSpotcheckContentItemList(CmmsSpotcheckContentItem cmmsSpotcheckContentItem);
+
+
 }

+ 26 - 1
module_cmms/src/main/java/org/jeecg/modules/cmmsSpotcheckContentItem/mapper/xml/CmmsSpotcheckContentItemMapper.xml

@@ -2,4 +2,29 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.cmmsSpotcheckContentItem.mapper.CmmsSpotcheckContentItemMapper">
 
-</mapper>
+
+    <resultMap type="org.jeecg.modules.cmmsSpotcheckContentItem.vo.CmmsSpotcheckContentItemVO" id="CmmsSpotcheckContentItemVOResult">
+        <result property="id"    column="id"    />
+        <result property="spotcheckcontid"    column="spotcheckcontid"    />
+        <result property="spotcheckitemid"    column="spotcheckitemid"    />
+        <result property="itemcode"    column="itemcode"    />
+        <result property="itemname"    column="itemname"    />
+        <result property="equipmenttreeid"    column="equipmenttreeid"    />
+        <result property="conditions"    column="conditions"    />
+        <result property="itemtype"    column="itemtype"    />
+        <result property="tag"    column="tag"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <select id="selectCmmsSpotcheckContentItemList" parameterType="org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem" resultMap="CmmsSpotcheckContentItemVOResult">
+        select b.id, b.spotcheckcontid, b.spotcheckitemid, i.itemcode, i.itemname,
+        i.equipmenttreeid, i.conditions, i.itemtype, i.tag, i.remark
+        from cmms_spotcheck_content_item as b
+        left join cmms_spotcheck_item as i on b.spotcheckitemid = i.id
+        <where>
+            <if test="spotcheckcontid != null "> and b.spotcheckcontid = #{spotcheckcontid}</if>
+        </where>
+    </select>
+
+
+</mapper>

+ 12 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsSpotcheckContentItem/service/ICmmsSpotcheckContentItemService.java

@@ -2,6 +2,9 @@ package org.jeecg.modules.cmmsSpotcheckContentItem.service;
 
 import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.cmmsSpotcheckContentItem.vo.CmmsSpotcheckContentItemVO;
+
+import java.util.List;
 
 /**
  * @Description: 点检内容-点检项
@@ -11,4 +14,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ICmmsSpotcheckContentItemService extends IService<CmmsSpotcheckContentItem> {
 
+    /**
+     * 查询点检内容-点检项列表
+     *
+     * @param cmmsSpotcheckContentItem 点检内容-点检项
+     * @return 点检内容-点检项
+     */
+    public List<CmmsSpotcheckContentItemVO> selectCmmsSpotcheckContentItemList(CmmsSpotcheckContentItem cmmsSpotcheckContentItem);
+
+
 }

+ 19 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsSpotcheckContentItem/service/impl/CmmsSpotcheckContentItemServiceImpl.java

@@ -3,10 +3,14 @@ package org.jeecg.modules.cmmsSpotcheckContentItem.service.impl;
 import org.jeecg.modules.cmmsSpotcheckContentItem.entity.CmmsSpotcheckContentItem;
 import org.jeecg.modules.cmmsSpotcheckContentItem.mapper.CmmsSpotcheckContentItemMapper;
 import org.jeecg.modules.cmmsSpotcheckContentItem.service.ICmmsSpotcheckContentItemService;
+import org.jeecg.modules.cmmsSpotcheckContentItem.vo.CmmsSpotcheckContentItemVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.List;
+
 /**
  * @Description: 点检内容-点检项
  * @Author: jeecg-boot
@@ -16,4 +20,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 public class CmmsSpotcheckContentItemServiceImpl extends ServiceImpl<CmmsSpotcheckContentItemMapper, CmmsSpotcheckContentItem> implements ICmmsSpotcheckContentItemService {
 
+    @Autowired
+    private CmmsSpotcheckContentItemMapper cmmsSpotcheckContentItemMapper;
+
+    /**
+     * 查询点检内容-点检项列表
+     *
+     * @param cmmsSpotcheckContentItem 点检内容-点检项
+     * @return 点检内容-点检项
+     */
+    @Override
+    public List<CmmsSpotcheckContentItemVO> selectCmmsSpotcheckContentItemList(CmmsSpotcheckContentItem cmmsSpotcheckContentItem)
+    {
+        return cmmsSpotcheckContentItemMapper.selectCmmsSpotcheckContentItemList(cmmsSpotcheckContentItem);
+    }
+
 }

+ 63 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsSpotcheckContentItem/vo/CmmsSpotcheckContentItemVO.java

@@ -0,0 +1,63 @@
+package org.jeecg.modules.cmmsSpotcheckContentItem.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.io.Serializable;
+
+@Data
+public class CmmsSpotcheckContentItemVO  implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**主键*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键")
+    private java.lang.String id;
+    /**点检内容id*/
+    @Excel(name = "点检内容id", width = 15)
+    @ApiModelProperty(value = "点检内容id")
+    private java.lang.String spotcheckcontid;
+    /**点检项id*/
+    @Excel(name = "点检项id", width = 15)
+    @ApiModelProperty(value = "点检项id")
+    private java.lang.String spotcheckitemid;
+
+
+    /**
+     * 点检项的内容
+     */
+    /**名称*/
+    @Excel(name = "名称", width = 15)
+    @ApiModelProperty(value = "名称")
+    private java.lang.String itemname;
+    /**设备类型ID*/
+    @Excel(name = "设备类型ID", width = 15, dictTable = "tpm_equipment_tree", dicText = "name", dicCode = "id")
+    @Dict(dictTable = "tpm_equipment_tree", dicText = "name", dicCode = "id")
+    @ApiModelProperty(value = "设备类型ID")
+    private java.lang.String equipmenttreeid;
+    /**点检项编号*/
+    @Excel(name = "点检项编号", width = 15)
+    @ApiModelProperty(value = "点检项编号")
+    private java.lang.String itemcode;
+    /**标准*/
+    @Excel(name = "标准", width = 15)
+    @ApiModelProperty(value = "标准")
+    private java.lang.String conditions;
+    /**点检项分类*/
+    @Excel(name = "点检项分类", width = 15, dicCode = "spotcheck_item_type")
+    @Dict(dicCode = "spotcheck_item_type")
+    @ApiModelProperty(value = "点检项分类")
+    private java.lang.String itemtype;
+    /**标签*/
+    @Excel(name = "标签", width = 15)
+    @ApiModelProperty(value = "标签")
+    private java.lang.String tag;
+    /**备注*/
+    @ApiModelProperty(value = "备注")
+    private java.lang.String remark;
+
+}