| | |
| | | } |
| | | |
| | | @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集合 |
| | |
| | | //组装部门设备树 |
| | | List<MdcEquipmentTree> treeList = FindsEquipmentDepartUtil.wrapEquipmentDepartTreeList(list); |
| | | //填充设备数据 |
| | | FillEquipmentByDepart(treeList); |
| | | FillEquipmentByDepart(treeList, key); |
| | | return treeList; |
| | | } |
| | | |
| | |
| | | * |
| | | * @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); |
| | |
| | | mdcEquipmentTree.setLeaf(false); |
| | | } |
| | | if (!mdcEquipmentTree.getChildren().isEmpty()) { |
| | | FillEquipmentByDepart(mdcEquipmentTree.getChildren()); |
| | | FillEquipmentByDepart(mdcEquipmentTree.getChildren(), key); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | @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获取拥有的产线信息集合 |
| | |
| | | //组装产线设备树 |
| | | List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); |
| | | //填充设备数据 |
| | | FillEquipmentByProduction(treeList); |
| | | FillEquipmentByProduction(treeList, key); |
| | | return treeList; |
| | | } |
| | | |
| | |
| | | /** |
| | | * 产线设备树填充设备数据 |
| | | */ |
| | | 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); |
| | |
| | | mdcEquipmentTree.setLeaf(false); |
| | | } |
| | | if (!mdcEquipmentTree.getChildren().isEmpty()) { |
| | | FillEquipmentByProduction(mdcEquipmentTree.getChildren()); |
| | | FillEquipmentByProduction(mdcEquipmentTree.getChildren(), key); |
| | | } |
| | | } |
| | | } |
| | |
| | | //组装产线设备树 |
| | | List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); |
| | | //填充设备数据 |
| | | FillEquipmentByProduction(treeList); |
| | | FillEquipmentByProduction(treeList, null); |
| | | return treeList; |
| | | } |
| | | |
| | | /** |
| | | * 查询单表数据 |
| | | * |
| | | * @param tableName |
| | | * @return |
| | | */ |