xiongchao 3 жил өмнө
parent
commit
175bb1c911

+ 7 - 0
platform-dao/src/main/java/com/platform/dao/mapper/sb/SbInfoMapper.java

@@ -25,6 +25,13 @@ public interface SbInfoMapper extends MyMapper<SbInfo> {
      * @return
      */
     List<SbInfoVO> selectVOList(SbInfoDTO dto);
+    /**
+     * 分页查询
+     *
+     * @param dto
+     * @return
+     */
+    List<SbInfoVO> selectVOListStandard(SbInfoDTO dto);
 
     /**
      * 批量更新,用于定时任务生成后更新设备的保养、润换时间

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/vo/sb/SbInfoVO.java

@@ -27,6 +27,10 @@ public class SbInfoVO extends BaseVO implements Serializable {
      * 验收单id
      */
     private String checkId;
+    /**
+     * 保养数目
+     */
+    private Integer standardNum;
     /**
      * 是否子设备:0 父设备,1 子设备
      */

+ 88 - 0
platform-dao/src/main/resources/mapper/sb/SbInfoMapper.xml

@@ -286,6 +286,94 @@ sb.scrap_user_name
         </if>
     </select>
 
+    <select id="selectVOListStandard" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
+            resultType="com.platform.dao.vo.sb.SbInfoVO">
+        SELECT
+        sb.id,
+        sb.no,
+        sbType.name as typeName,
+        sb.NAME,
+        sb.zbh,
+        sb.status,
+        sb.use_type,
+        sb.type_id,
+        count( standard.id ) as standardNum
+        FROM
+        t_sb_info sb
+        LEFT JOIN t_check_standard standard ON sb.id = standard.sb_id
+        left join t_sb_type sbType on sb.type_id = sbType.id
+        where
+        1 = 1
+        <if test="keyword != null and keyword != ''">
+            and  (
+            sb.name like concat('%',#{keyword},'%')
+            or
+            sb.no like concat('%',#{keyword},'%')
+            )
+        </if>
+        <if test="zbh != null and zbh!=''">
+            and sb.zbh like concat('%',#{zbh},'%')
+        </if>
+        <if test="useType != null">
+            and sb.use_type = #{useType}
+        </if>
+        <if test="id != null">
+            and sb.id = #{id}
+        </if>
+        <if test="checkId != null">
+            and sb.check_id = #{checkId}
+        </if>
+        <if test="isChild != null">
+            and sb.is_child = #{isChild}
+        </if>
+        <if test="isShow != null">
+            and sb.is_show = #{isShow}
+        </if>
+        <if test="useArea != null">
+            and sb.use_area = #{useArea}
+        </if>
+        <if test="useCompany != null">
+            and sb.use_company = #{useCompany}
+        </if>
+        <if test="useProject != null">
+            and sb.use_project = #{useProject}
+        </if>
+        <if test="typeId != null">
+            and sb.type_id = #{typeId}
+        </if>
+        <if test="parentId != null">
+            and sb.parent_id = #{parentId}
+        </if>
+        <if test="model != null">
+            and sb.model like concat('%',#{model},'%')
+        </if>
+        <if test="useDept != null">
+            and sb.use_dept = #{useDept}
+        </if>
+        <if test="useGroup != null">
+            and sb.use_group = #{useGroup}
+        </if>
+        <if test="saveDept != null">
+            and sb.save_dept = #{saveDept}
+        </if>
+        <if test="saveUser != null">
+            and sb.save_user = #{saveUser}
+        </if>
+        <if test="nextCheckDateStart != null">
+            and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
+        </if>
+        <if test="nextCheckDateEnd != null">
+            and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
+        </if>
+        <if test="status != null">
+            and sb.status = #{status}
+        </if>
+        <if test="modelId != null">
+            and sb.model_id = #{modelId}
+        </if>
+        group by sb.id
+    </select>
+
     <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
             resultType="com.platform.dao.vo.sb.SbInfoVO">
         select

+ 13 - 0
platform-rest/src/main/java/com/platform/rest/controller/sb/SbInfoController.java

@@ -185,6 +185,19 @@ public class SbInfoController {
         return new R<>(sbInfoService.selectVOPage(sbInfoDTO, pageNum, pageSize));
     }
 
+    /**
+     * 获取分页:显示保养项目条数,可以直接跳转到保养内容里面,进行新增和查看页面
+     *
+     * @param pageNum   当前页码
+     * @param pageSize  每页条数
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @GetMapping("/page/standard")
+    public R<AbstractPageResultBean<SbInfoVO>> queryStandard(SbInfoDTO sbInfoDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R<>(sbInfoService.selectVOPageStandard(sbInfoDTO, pageNum, pageSize));
+    }
+
     /**
      * 获取检定预警分页
      *

+ 10 - 0
platform-service/src/main/java/com/platform/service/sb/SbInfoService.java

@@ -75,6 +75,16 @@ public interface SbInfoService extends IBaseService<SbInfo, SbInfoDTO> {
      */
     MyVOPage<SbInfoVO> selectVOPage(SbInfoDTO dto, int pageNum, int pageSize);
 
+    /**
+     * 分页查询
+     *
+     * @param dto      :
+     * @param pageNum  :
+     * @param pageSize :
+     * @return :
+     */
+    MyVOPage<SbInfoVO> selectVOPageStandard(SbInfoDTO dto, int pageNum, int pageSize);
+
     /**
      * 分页查询
      *

+ 71 - 0
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -671,6 +671,77 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         return new MyVOPage<>(sbList);
     }
 
+    /**
+     * 系统管理员查询全部:查看保养条目的
+     *
+     * @param model
+     * @param pageNum  :
+     * @param pageSize :
+     * @return
+     */
+    @Override
+    public MyVOPage<SbInfoVO> selectVOPageStandard(SbInfoDTO model, int pageNum, int pageSize) {
+
+        // 选择该用户的设备
+        if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {
+            UserInfo userInfo = SecurityUtils.getUserInfo();
+            model.setSaveUser(userInfo.getUserId());
+        }
+        if (model.getFilter() != null && DataFilterTypeEnum.BANZU.getValue() == model.getFilter().intValue()) {
+            UserInfo userInfo = SecurityUtils.getUserInfo();
+            List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
+            if (CollectionUtil.isEmpty(sysUserDepts)) {
+                throw new BusinessException("找不到该用户所属班组,请先设置,用户id:" + userInfo.getUserId());
+            }
+            model.setUseGroup(sysUserDepts.get(0).getDeptId());
+        }
+        if (model.getFilter() != null && DataFilterTypeEnum.PROJECT.getValue() == model.getFilter().intValue()) {
+            UserInfo userInfo = SecurityUtils.getUserInfo();
+            List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
+            if (CollectionUtil.isEmpty(sysUserDepts)) {
+                throw new BusinessException("找不到该用户所属班组,请先设置部门,用户id:" + userInfo.getUserId());
+            }
+            SysDeptDTO sysDeptDTO = new SysDeptDTO();
+            sysDeptDTO.setDescendant(sysUserDepts.get(0).getDeptId());
+            sysDeptDTO.setNature(DeptNatureEnum.XIANG_MU_BU.getValue());
+            List<SysDeptVO> list = sysDeptService.allParentList(sysDeptDTO);
+            if (CollectionUtil.isEmpty(list)) {
+                throw new BusinessException("找不到该用户所属的项目部,请先设置项目组,用户id:" + userInfo.getUserId());
+            }
+            model.setUseProject(list.get(0).getDeptId());
+        }
+        if (model.getFilter() != null && DataFilterTypeEnum.COMPANY.getValue() == model.getFilter().intValue()) {
+            UserInfo userInfo = SecurityUtils.getUserInfo();
+            List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
+            if (CollectionUtil.isEmpty(sysUserDepts)) {
+                throw new BusinessException("找不到该用户所属班组,请先设置部门,用户id:" + userInfo.getUserId());
+            }
+            SysDeptDTO sysDeptDTO = new SysDeptDTO();
+            sysDeptDTO.setDescendant(sysUserDepts.get(0).getDeptId());
+            sysDeptDTO.setNature(DeptNatureEnum.FEN_GONG_SI.getValue());
+            List<SysDeptVO> list = sysDeptService.allParentList(sysDeptDTO);
+            if (CollectionUtil.isEmpty(list)) {
+                throw new BusinessException("找不到该用户所属的分公司,请先设置项目组,用户id:" + userInfo.getUserId());
+            }
+            model.setUseCompany(list.get(0).getDeptId());
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<SbInfoVO> sbList = mapper.selectVOListStandard(model);
+        if(SbInfoChildEnum.IS_PARENT.getValue().equals(model.getIsChild()) && !CollectionUtils.isEmpty(sbList)){
+            for(SbInfoVO vo: sbList){
+                if(SbInfoChildEnum.IS_PARENT.getValue().equals(vo.getIsChild())){
+                    SbInfoDTO infoDTO = new SbInfoDTO();
+                    infoDTO.setParentId(vo.getId());
+                    List<SbInfoVO> childVOList = mapper.selectVOList(infoDTO);
+                    if(!CollectionUtils.isEmpty(childVOList)){
+                        vo.setChildren(childVOList);
+                    }
+                }
+            }
+        }
+        return new MyVOPage<>(sbList);
+    }
+
     @Override
     public MyVOPage<SbInfoVO> selectVOPageByFilter(SbInfoDTO model, int pageNum, int pageSize) {
         UserInfo userInfo = SecurityUtils.getUserInfo();