第一: 代码
@RequestMapping(value = "/addUserDoMenuPrivilege", method = RequestMethod.POST)
@ResponseBody
public String addUserDoMenuPrivilege(int userID,String userCode,String menu_codeList,String pricodeList){
//menu_codeList 字符串转集合: “省委”,“市委”,“党委”
String[] strs = menu_codeList.split(",");
List<String> mcodelist = Arrays.asList(strs); //【“省委”,“市委”,“党委”】//pricodeList 字符串转集合:
String[] strss = pricodeList.split(",");
List<String> prodelist = Arrays.asList(strss);
//多个模块:
for (String menu_code : mcodelist) {
Map map = new HashMap();
map.put("menu_code", menu_code);
//多个权限:
for (String pricode : prodelist) {
map.put("pricode", pricode);
map.put("userCode", userCode);
map.put("userID", userID);
userPrivilegeServiceImpl.addUserPrivilegeService(map);
menuPrivilegeServiceImpl.addMenuPrivilege(map);
userMenuPrivilegeServiceImpl.addUserMenuPrivilegeService(map);
}
}
return "true";
}