From f2f8241dd52ef12ec109f6f4f0f13042055338ac Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期五, 14 二月 2025 14:55:56 +0800 Subject: [PATCH] 修改指派设备 修改设备结构树权限 优化查询 优化排序 --- lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java | 72 ++++++++++++++++++++++++++++++++---- 1 files changed, 64 insertions(+), 8 deletions(-) diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java index 120968b..e39af4e 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java @@ -2,21 +2,18 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.FillRuleConstant; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.FillRuleUtil; import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.system.entity.MdcProduction; -import org.jeecg.modules.system.entity.MdcProductionEquipment; -import org.jeecg.modules.system.entity.MdcUserProduction; -import org.jeecg.modules.system.entity.SysUser; -import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper; -import org.jeecg.modules.system.mapper.MdcProductionMapper; -import org.jeecg.modules.system.mapper.MdcUserProductionMapper; -import org.jeecg.modules.system.mapper.SysUserMapper; +import org.jeecg.modules.system.entity.*; +import org.jeecg.modules.system.mapper.*; import org.jeecg.modules.system.model.MdcProductionTreeModel; import org.jeecg.modules.system.model.ProductionIdModel; import org.jeecg.modules.system.service.IMdcProductionService; @@ -47,6 +44,8 @@ @Resource private MdcProductionEquipmentMapper productionEquipmentMapper; + @Resource + private DncDeviceGroupPermissionMapper dncDeviceGroupPermissionMapper; /** * queryTreeList 瀵瑰簲 queryTreeList 鏌ヨ鎵�鏈夌殑浜х嚎鏁版嵁,浠ユ爲缁撴瀯褰㈠紡鍝嶅簲缁欏墠绔� */ @@ -139,6 +138,13 @@ mdcProduction.setOrgType(String.valueOf(orgType)); mdcProduction.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); this.save(mdcProduction); + //鏂板DNC杞﹂棿鏉冮檺 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + DncDeviceGroupPermission dncDeviceGroupPermission=new DncDeviceGroupPermission(); + dncDeviceGroupPermission.setGroupPermId(mdcProduction.getId()); + dncDeviceGroupPermission.setUserId(userId); + dncDeviceGroupPermissionMapper.insert(dncDeviceGroupPermission); } } @@ -312,4 +318,54 @@ } } } + + /** + * 鏌ヨ鎵�鏈夌埗鑺傜偣鍜屾湰鑺傜偣鍚嶇О + * @param id + * @return + */ + @Override + public List<String> findListParentTreeAll(String id){ + MdcProductionEquipment mdcProductionEquipment=productionEquipmentMapper.selectOne(new QueryWrapper<MdcProductionEquipment>().eq("equipment_id",id)); + if (mdcProductionEquipment==null) { + return null; + } + List<String> strings = new ArrayList<>(); + MdcProduction en=super.getById(mdcProductionEquipment.getProductionId()); + if (en == null) { + return null; + } + strings.add(en.getProductionName()); + if (StringUtils.isEmpty(en.getParentId())) { + return strings; + } else { + return findListParentTree(en.getParentId(),strings); + } + } + + // 鏌ヨ鎵�浠ョ埗鑺傜偣 + @Override + public List<String> findListParentTree(String parentId,List<String> stringList){ + if (StringUtils.isEmpty(parentId)) { + return null; + } + if (stringList == null || stringList.isEmpty()) { + stringList = new ArrayList<>(); + } + boolean p = true; + if (p) { + MdcProduction en = super.getById(parentId); + if (en != null) { + stringList.add(0,en.getProductionName()); + } + if (StringUtils.isNotBlank(en.getParentId())) { + parentId = en.getParentId(); + findListParentTree(parentId,stringList); + } else { + p = false; + return stringList; + } + } + return stringList; + } } -- Gitblit v1.9.3