From e1d6bf6045445c215011f5de30372ff99f7ce28a Mon Sep 17 00:00:00 2001 From: pengjie <17373303529@163.com> Date: Fri, 15 Dec 2023 08:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BaseMenuServiceImpl.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/BaseMenuServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/BaseMenuServiceImpl.java index 0f976c0..83ad50b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/BaseMenuServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/BaseMenuServiceImpl.java @@ -17,6 +17,7 @@ import com.zhgd.xmgl.security.SecurityUser; import com.zhgd.xmgl.security.SecurityUtil; import com.zhgd.xmgl.util.ListUtils; import com.zhgd.xmgl.util.MessageUtil; +import com.zhgd.xmgl.util.ParamEnum; import com.zhgd.xmgl.util.TreeUtil; import org.apache.commons.collections.MapUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -222,12 +223,10 @@ public class BaseMenuServiceImpl extends ServiceImpl i List enterpriseMainList = new ArrayList<>(); if (systemRole.getSysDefault() == 1) { EnterpriseMain enterpriseMain = new EnterpriseMain(); - if (systemRole.getRoleCode().equals("BUILD")) { - enterpriseMain.setMainType(1); - } else if (systemRole.getRoleCode().equals("SUPERVISOR")) { - enterpriseMain.setMainType(2); - } else if (systemRole.getRoleCode().equals("OP")) { - enterpriseMain.setMainType(3); + for (ParamEnum.EngineeringMain type : ParamEnum.EngineeringMain.values()) { + if (systemRole.getRoleCode().equals(type)) { + enterpriseMain.setMainType(type.getValue()); + } } enterpriseMainList.add(enterpriseMain); } else if (accountType == 3) { @@ -255,12 +254,10 @@ public class BaseMenuServiceImpl extends ServiceImpl i } else { for (EnterpriseMain main : enterpriseMainList) { String code = ""; - if (main.getMainType() == 1) { - code = "BUILD"; - } else if (main.getMainType() == 2) { - code = "SUPERVISOR"; - } else if (main.getMainType() == 3) { - code = "OP"; + for (ParamEnum.EngineeringMain type : ParamEnum.EngineeringMain.values()) { + if (main.getMainType() == type.getValue()) { + code = type.toString(); + } } String iRoleId = systemRoleService.getOne(Wrappers.lambdaQuery() .eq(SystemRole::getRoleCode, code)).getRoleId();