Commit f3a378d4 sunke

1053菜单

1 个父辈 19cc4b5e
...@@ -54,6 +54,14 @@ public class MenuInit { ...@@ -54,6 +54,14 @@ public class MenuInit {
} }
/** /**
* 展示菜单
* @param menuPathOrClientLabel 菜单路径或菜单标识
*/
public void hideMenu(String... menuPathOrClientLabel){
updateMenu(new String[]{},menuPathOrClientLabel);
}
/**
* 给菜单打标识 * 给菜单打标识
* @param label * @param label
* @param menus * @param menus
...@@ -227,7 +235,7 @@ public class MenuInit { ...@@ -227,7 +235,7 @@ public class MenuInit {
menuList.add(menuToShow); menuList.add(menuToShow);
} }
Set<String> showIdSet = showMenu(menuList); Set<String> showIdSet = showMenu(menuList);
Set<String> hideIdSet = hideMenu(menuListToHide); Set<String> hideIdSet = hideMenuList(menuListToHide);
if(!showIdSet.isEmpty() || !hideIdSet.isEmpty()){ if(!showIdSet.isEmpty() || !hideIdSet.isEmpty()){
List<Role> roles = roleManager.findByQuery(new Query(Criteria.where("name").is("admin"))); List<Role> roles = roleManager.findByQuery(new Query(Criteria.where("name").is("admin")));
Role roleAdmin = roles.get(0); Role roleAdmin = roles.get(0);
...@@ -276,7 +284,7 @@ public class MenuInit { ...@@ -276,7 +284,7 @@ public class MenuInit {
/** /**
* 隐藏菜单 * 隐藏菜单
*/ */
private Set<String> hideMenu(String[] menuListToHide){ private Set<String> hideMenuList(String[] menuListToHide){
Set<String> hideIdSet = new HashSet<>(); Set<String> hideIdSet = new HashSet<>();
for (String hidePath : menuListToHide) { for (String hidePath : menuListToHide) {
Menu hideMenu = menuManager.findByPath(hidePath); Menu hideMenu = menuManager.findByPath(hidePath);
......
package com.neotel.smfcore.custom.micron1053;
import com.neotel.smfcore.common.init.MenuInit;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.security.service.po.Menu;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* @author sunke
* @date 2022/12/14 4:01 PM
*/
@Component
public class Micron1053Menu {
@Autowired
MenuInit menuInit;
@Autowired
SmfApi smfApi;
@PostConstruct
public void init(){
String menuLabel = "1053";
//Report菜单
Menu report = Menu.CreatePMenu("Report", 12, "report1053", "report1053",null);
MenuInit.addMenu(menuLabel,report, 121, "Material Movement", "movementReport", "system/movementReport/index","movementReport");
MenuInit.addMenu(menuLabel,report, 122, "Inventory", "inventoryReport", "system/inventoryReport/index","inventoryReport");
MenuInit.addMenu(menuLabel,report, 123, "Abnormality", "performanceReport", "system/abnormReport/index","performanceReport");
MenuInit.addMenu(menuLabel,report, 124, "Performance", "performanceReport", "system/performanceReport/index","performanceReport");
MenuInit.addMenu(menuLabel,report, 125, "Order", "orderReport", "system/order/index","orderReport");
//ML5
Menu mL5 = Menu.CreatePMenu("ML5", 13, "mlFive", "miFive",null);
MenuInit.addMenu(menuLabel,mL5, 131, "ML5 DISPATCH SELECTION", "ML5DispatchSelect", "mlFive/dispatchSelect/index","dispatchSelection");
MenuInit.addMenu(menuLabel,mL5,132, "ML5 LOADING SELECTION","ML5Loading", "mlFive/LoadingSelect/index","loadingSelection");
MenuInit.addMenu(menuLabel,mL5,133, "DISPATCH STATUS", "dispatchStatus", "mlFive/dispatchStatus/index","dispatchStatus");
MenuInit.addMenu(menuLabel,mL5,134,"LOADING STATUS","loadingStatus", "mlFive/loadingStatus/index","loadingStatus");
MenuInit.addMenu(menuLabel,mL5,135, "ML5","miFive", "mlFive/miFive/index","miFive");
//status菜单
Menu status = Menu.CreatePMenu("Status", 14, "status1053", "state",null);
MenuInit.addMenu(menuLabel,status,141, "Temperature Log","temput", "mlFive/miFive/index","temput");
MenuInit.addMenu(menuLabel,status,142, "ML5","miFive", "mlFive/miFive/index","miFive");
MenuInit.addMenu(menuLabel,null,128, "SBSH1","SBSH1", "SBSH/sbshOne/index","sbsh");
MenuInit.addMenu(menuLabel,null,128, "SBSH2","SBSH2", "SBSH/sbshOne/index","sbsh");
MenuInit.addMenu(menuLabel,null,128, "SBDH1","SBDH1", "SBSH/sbshOne/index","sbdh");
MenuInit.addMenu(menuLabel,null,128, "SBDH2","SBDH2", "SBSH/sbshOne/index","sbdh");
MenuInit.addMenu(menuLabel,null,128, "SBDH3","SBDH3", "SBSH/sbshOne/index","sbdh");
//CI
MenuInit.addMenu(menuLabel,null,128, "CI","cl", "cl/cl/index","cl");
//MT
MenuInit.addMenu(menuLabel,null,128, "MT","mt", "mt/mt/index","mt");
//MI1
MenuInit.addMenu(menuLabel,null,128, "MI1","ml", "miOne/miOne/index","miOne");
//MI2
MenuInit.addMenu(menuLabel,null,128, "MI2","ml2", "miTwo/miTwo/index","miOne");
//Status
// MenuInit.addMenu(menuLabel,null,128, "Status","status", "state/state/index","state");
// //Report
// MenuInit.addMenu(menuLabel,null,128, "Report","reports", "report/reports/index","report");
//设置管理
Menu poutSet = Menu.CreatePMenu("设置", 10, "system", "system",null);
MenuInit.addMenu(menuLabel,null,128, "Diagnosis","diagnosis", "system/diagnosis/index","diagnosis");
//Help
MenuInit.addMenu(menuLabel,null,128, "Help","helps", "help/helps/index","help");
String apiName = smfApi.getApiName();
if(Strings.isNotBlank(apiName) && apiName.equals(menuLabel)){
menuInit.showMenu(apiName);
}
}
}
...@@ -81,6 +81,15 @@ public class MenuController { ...@@ -81,6 +81,15 @@ public class MenuController {
return new ResponseEntity<>("OK", HttpStatus.OK); return new ResponseEntity<>("OK", HttpStatus.OK);
} }
@RequestMapping(value = "/hide")
@AnonymousAccess
public ResponseEntity<Object> hide(@RequestParam String menuPath) {
if(Strings.isNotBlank(menuPath)){
menuInit.hideMenu(menuPath);
}
return new ResponseEntity<>("OK", HttpStatus.OK);
}
@GetMapping(value = "/build") @GetMapping(value = "/build")
@ApiOperation("获取前端所需菜单") @ApiOperation("获取前端所需菜单")
@AnonymousAccess @AnonymousAccess
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!