瀏覽代碼

巡检工单分页列表查询加上巡检计划名称

丁治程 1 年之前
父節點
當前提交
948c32ce5d

+ 7 - 5
module_cmms/src/main/java/org/jeecg/modules/cmmsInspect/controller/CmmsInspectController.java

@@ -68,14 +68,16 @@ public class CmmsInspectController extends JeecgController<CmmsInspect, ICmmsIns
 	//@AutoLog(value = "巡检工单-分页列表查询")
 	@ApiOperation(value="巡检工单-分页列表查询", notes="巡检工单-分页列表查询")
 	@GetMapping(value = "/list")
-	public Result<IPage<CmmsInspect>> queryPageList(CmmsInspect cmmsInspect,
+	public Result<IPage<CmmsInspectVo>> queryPageList(CmmsInspectVo cmmsInspect,
 								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 								   HttpServletRequest req) {
-		QueryWrapper<CmmsInspect> queryWrapper = QueryGenerator.initQueryWrapper(cmmsInspect, req.getParameterMap());
-		Page<CmmsInspect> page = new Page<CmmsInspect>(pageNo, pageSize);
-		IPage<CmmsInspect> pageList = cmmsInspectService.page(page, queryWrapper);
-		return Result.OK(pageList);
+		//QueryWrapper<CmmsInspect> queryWrapper = QueryGenerator.initQueryWrapper(cmmsInspect, req.getParameterMap());
+		Page<CmmsInspectVo> page = new Page<CmmsInspectVo>(pageNo, pageSize);
+		//IPage<CmmsInspect> pageList = cmmsInspectService.page(page, queryWrapper);
+		List<CmmsInspectVo> list = cmmsInspectService.getCmmsInspectList(page,cmmsInspect);
+		page.setRecords(list);
+		return Result.OK(page);
 	}
 	
 	/**

+ 3 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsInspect/entity/CmmsInspectVo.java

@@ -17,6 +17,9 @@ import java.util.List;
 @Data
 public class CmmsInspectVo extends CmmsInspect {
 
+    /** 巡检计划名称 */
+    private String planname;
+
     /** 巡检工单-路线列表 */
     private List<CmmsInspectLineVo> lineList;
 

+ 12 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsInspect/mapper/CmmsInspectMapper.java

@@ -2,9 +2,11 @@ package org.jeecg.modules.cmmsInspect.mapper;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.cmmsInspect.entity.CmmsInspect;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.cmmsInspect.entity.CmmsInspectVo;
 import org.jeecg.modules.cmmsInspectPlan.entity.CmmsInspectPlan;
 import org.jeecg.modules.cmmsInspectPlanTask.entity.CmmsInspectPlanTaskVo;
 
@@ -16,6 +18,15 @@ import org.jeecg.modules.cmmsInspectPlanTask.entity.CmmsInspectPlanTaskVo;
  */
 public interface CmmsInspectMapper extends BaseMapper<CmmsInspect> {
 
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 分页列表查询 (查询出工单的信息加上对应的巡检计划名称)
+    *   date: 2024/1/31
+    */
+    List<CmmsInspectVo> getCmmsInspectList(@Param("page") Page<CmmsInspectVo> page,@Param("cmmsInspect") CmmsInspectVo cmmsInspect);
+
     /**
     *   author: dzc
     *   version: 1.0
@@ -31,4 +42,5 @@ public interface CmmsInspectMapper extends BaseMapper<CmmsInspect> {
     *   date: 2024/1/25
     */
     List<CmmsInspectPlanTaskVo> getTaskByPlanId(@Param("id") String id);
+
 }

+ 33 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsInspect/mapper/xml/CmmsInspectMapper.xml

@@ -3,6 +3,39 @@
 <mapper namespace="org.jeecg.modules.cmmsInspect.mapper.CmmsInspectMapper">
 
 
+    <resultMap id="cmmInspectResult" type="org.jeecg.modules.cmmsInspect.entity.CmmsInspectVo">
+        <result property="id" column="id"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+        <result property="inspectcode" column="inspectcode"/>
+        <result property="inspectname" column="inspectname"/>
+        <result property="tasktype" column="tasktype"/>
+        <result property="status" column="status"/>
+        <result property="inspectdetail" column="inspectdetail"/>
+        <result property="inspectplanid" column="inspectplanid"/>
+        <result property="chargeruser" column="chargeruser"/>
+        <result property="sysOrgCode" column="sys_org_code"/>
+        <result property="planname" column="planname"/>
+    </resultMap>
+
+
+
+    <select id="getCmmsInspectList" parameterType="org.jeecg.modules.cmmsInspect.entity.CmmsInspectVo" resultMap="cmmInspectResult">
+        SELECT t.id,t.create_by,t.create_time,t.update_by,t.update_time,t.remark,t.inspectcode,t.inspectname,
+               t.tasktype,t.`status`,t.inspectdetail,t.inspectplanid,t.chargeruser,t.sys_org_code,p.planname
+        FROM cmms_inspect t
+        LEFT JOIN cmms_inspect_plan p
+        ON t.inspectplanid = p.id
+        <where>
+            <if test="cmmsInspect.inspectname != null and cmmsInspect.inspectname != ''">and t.inspectname like concat('%',#{cmmsInspect.inspectname},'%')</if>
+            <if test="cmmsInspect.planname != null and cmmsInspect.planname != ''">and p.planname like concat('%',#{cmmsInspect.planname},'%')</if>
+        </where>
+    </select>
+
+
 
     <select id="getCmmsInspectPlanById" resultType="org.jeecg.modules.cmmsInspectPlan.entity.CmmsInspectPlan">
         select * from cmms_inspect_plan where id = #{id}

+ 13 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsInspect/service/ICmmsInspectService.java

@@ -1,10 +1,13 @@
 package org.jeecg.modules.cmmsInspect.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.modules.cmmsInspect.entity.CmmsInspect;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.cmmsInspect.entity.CmmsInspectVo;
 import org.jeecg.modules.cmmsInspectPlan.entity.CmmsInspectPlanVo;
 
+import java.util.List;
+
 /**
  * @Description: 巡检工单
  * @Author: jeecg-boot
@@ -13,6 +16,16 @@ import org.jeecg.modules.cmmsInspectPlan.entity.CmmsInspectPlanVo;
  */
 public interface ICmmsInspectService extends IService<CmmsInspect> {
 
+
+    /**
+    *   author: dzc
+    *   version: 1.0
+    *   des: 分页列表查询 (查询出工单的信息加上对应的巡检计划名称)
+    *   date: 2024/1/31
+    */
+    List<CmmsInspectVo> getCmmsInspectList(Page<CmmsInspectVo> page, CmmsInspectVo cmmsInspect);
+
+
     CmmsInspectVo getCmmsInspectById(String id);
     /**
     *   author: dzc

+ 7 - 0
module_cmms/src/main/java/org/jeecg/modules/cmmsInspect/service/impl/CmmsInspectServiceImpl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.cmmsInspect.service.impl;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.modules.cmmsInspect.convert.CmmsInspectConvert;
 import org.jeecg.modules.cmmsInspect.entity.CmmsInspect;
 import org.jeecg.modules.cmmsInspect.entity.CmmsInspectVo;
@@ -40,6 +41,12 @@ public class CmmsInspectServiceImpl extends ServiceImpl<CmmsInspectMapper, CmmsI
     @SuppressWarnings("all")
     private ICmmsInspectLineService inspectLineService;
 
+
+    @Override
+    public List<CmmsInspectVo> getCmmsInspectList(Page<CmmsInspectVo> page, CmmsInspectVo cmmsInspect) {
+        return cmmsInspectMapper.getCmmsInspectList(page, cmmsInspect);
+    }
+
     @Override
     public CmmsInspectVo getCmmsInspectById(String id) {
         // 根据巡检工单id查询出对应的巡检工单

+ 1 - 1
module_cmms/src/main/java/org/jeecg/modules/cmmsInspectLine/mapper/xml/CmmsInspectLineMapper.xml

@@ -8,7 +8,7 @@
 
 
     <select id="getCmmsInspectLineListDetails" parameterType="org.jeecg.modules.cmmsInspectLine.entity.CmmsInspectLine" resultType="org.jeecg.modules.cmmsInspectLine.entity.CmmsInspectLineVo">
-        select * from cmms_inspect_line
+        select id,create_by,create_time,update_by,update_time,remark,linecode,linename,sys_org_code from cmms_inspect_line
         <where>
             <if test="cmmsInspectLine.linecode != null and cmmsInspectLine.linecode != ''">and (linecode like CONCAT('%',#{cmmsInspectLine.linecode},'%') or linename like CONCAT('%',#{cmmsInspectLine.linecode},'%')) </if>
         </where>