Lius
2024-09-13 15a20a91316b726f45ccc9e06bbd632f10eedb43
update
已修改5个文件
53 ■■■■■ 文件已修改
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -385,12 +385,12 @@
    @AutoLog(value = "设备表-加载部门设备树")
    @ApiOperation(value = "设备表-加载部门设备树", notes = "设备表-加载部门设备树")
    @GetMapping(value = "/queryTreeListByDepart")
    public Result<List<MdcEquipmentTree>> queryTreeListByDepart() {
    public Result<List<MdcEquipmentTree>> queryTreeListByDepart(@RequestParam(name = "key", required = false) String key) {
        Result<List<MdcEquipmentTree>> result = new Result<>();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        try {
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByDepart(userId);
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByDepart(userId, key);
            result.setSuccess(true);
            result.setResult(mdcEquipmentTreeList);
        } catch (Exception e) {
@@ -405,12 +405,12 @@
    @AutoLog(value = "设备表-加载产线设备树")
    @ApiOperation(value = "设备表-加载产线设备树", notes = "设备表-加载产线设备树")
    @GetMapping(value = "/queryTreeListByProduction")
    public Result<List<MdcEquipmentTree>> queryTreeListByProduction() {
    public Result<List<MdcEquipmentTree>> queryTreeListByProduction(@RequestParam(name = "key", required = false) String key) {
        Result<List<MdcEquipmentTree>> result = new Result<>();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        try {
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId);
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId, key);
            result.setSuccess(true);
            result.setResult(mdcEquipmentTreeList);
        } catch (Exception e) {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -50,12 +50,12 @@
    /**
     * 根据部门id查询设备
     */
    List<MdcEquipment> queryByDepartId(@Param("departId") String departId);
    List<MdcEquipment> queryByDepartId(@Param("departId") String departId, @Param("key") String key);
    /**
     * 根据产线id查询设备
     */
    List<MdcEquipment> queryByProductionId(@Param("productionId") String productionId);
    List<MdcEquipment> queryByProductionId(@Param("productionId") String productionId, @Param("key") String key);
    /**
     * 查找设备监控信息
@@ -104,6 +104,7 @@
    /**
     * 导出list
     *
     * @param mdcEquipment
     * @return
     */
@@ -111,6 +112,7 @@
    /**
     * 查询单表数据
     *
     * @param tableName
     * @return
     */
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -58,6 +58,9 @@
        WHERE
            med.equipment_id = me.id
            AND med.dep_id = #{ departId }
            <if test="key != null and key != '' ">
                AND me.device_abnormal_status = 1
            </if>
        ORDER BY me.equipment_id
    </select>
@@ -71,6 +74,9 @@
        WHERE
            mpe.equipment_id = me.id
            AND mpe.production_id = #{ productionId }
          <if test="key != null and key != '' ">
              AND me.device_abnormal_status = 1
          </if>
        ORDER BY me.equipment_id
    </select>
@@ -83,9 +89,9 @@
            LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id
        WHERE
            mpe.production_id IN
        <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
            <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
    </select>
    <!--查询设备监控信息-->
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -101,12 +101,12 @@
    /**
     * 加载部门设备树
     */
    List<MdcEquipmentTree> loadTreeListByDepart(String userId);
    List<MdcEquipmentTree> loadTreeListByDepart(String userId, String key);
    /**
     * 加载产线设备树
     */
    List<MdcEquipmentTree> loadTreeListByProduction(String userId);
    List<MdcEquipmentTree> loadTreeListByProduction(String userId, String key);
    /**
     * 设备监控列表
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -227,7 +227,7 @@
    }
    @Override
    public List<MdcEquipmentTree> loadTreeListByDepart(String userId) {
    public List<MdcEquipmentTree> loadTreeListByDepart(String userId, String key) {
        //获取所有部门数据
        List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(SysDepart::getDepartOrder));
        //根据用户ID获取拥有的部门id集合
@@ -244,7 +244,7 @@
        //组装部门设备树
        List<MdcEquipmentTree> treeList = FindsEquipmentDepartUtil.wrapEquipmentDepartTreeList(list);
        //填充设备数据
        FillEquipmentByDepart(treeList);
        FillEquipmentByDepart(treeList, key);
        return treeList;
    }
@@ -253,9 +253,9 @@
     *
     * @param treeList
     */
    private void FillEquipmentByDepart(List<MdcEquipmentTree> treeList) {
    private void FillEquipmentByDepart(List<MdcEquipmentTree> treeList, String key) {
        for (MdcEquipmentTree mdcEquipmentTree : treeList) {
            List<MdcEquipment> equipmentList = this.baseMapper.queryByDepartId(mdcEquipmentTree.getKey());
            List<MdcEquipment> equipmentList = this.baseMapper.queryByDepartId(mdcEquipmentTree.getKey(), key);
            if (equipmentList != null && !equipmentList.isEmpty()) {
                for (MdcEquipment mdcEquipment : equipmentList) {
                    MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment);
@@ -265,7 +265,7 @@
                mdcEquipmentTree.setLeaf(false);
            }
            if (!mdcEquipmentTree.getChildren().isEmpty()) {
                FillEquipmentByDepart(mdcEquipmentTree.getChildren());
                FillEquipmentByDepart(mdcEquipmentTree.getChildren(), key);
            }
        }
    }
@@ -292,7 +292,7 @@
    @Override
    public List<MdcEquipmentTree> loadTreeListByProduction(String userId) {
    public List<MdcEquipmentTree> loadTreeListByProduction(String userId, String key) {
        //获取所有产线数据
        List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
        //根据用户id获取拥有的产线信息集合
@@ -309,7 +309,7 @@
        //组装产线设备树
        List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
        //填充设备数据
        FillEquipmentByProduction(treeList);
        FillEquipmentByProduction(treeList, key);
        return treeList;
    }
@@ -632,9 +632,9 @@
    /**
     * 产线设备树填充设备数据
     */
    private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList) {
    private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList, String key) {
        for (MdcEquipmentTree mdcEquipmentTree : treeList) {
            List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey());
            List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey(), key);
            if (equipmentList != null && !equipmentList.isEmpty()) {
                for (MdcEquipment mdcEquipment : equipmentList) {
                    MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment);
@@ -644,7 +644,7 @@
                mdcEquipmentTree.setLeaf(false);
            }
            if (!mdcEquipmentTree.getChildren().isEmpty()) {
                FillEquipmentByProduction(mdcEquipmentTree.getChildren());
                FillEquipmentByProduction(mdcEquipmentTree.getChildren(), key);
            }
        }
    }
@@ -855,12 +855,13 @@
        //组装产线设备树
        List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
        //填充设备数据
        FillEquipmentByProduction(treeList);
        FillEquipmentByProduction(treeList, null);
        return treeList;
    }
    /**
     * 查询单表数据
     *
     * @param tableName
     * @return
     */