forked from integrated_whb/integrated_whb
Merge remote-tracking branch 'origin/dev' into dev
commit
fc1f682428
|
@ -4,6 +4,7 @@ import com.zcloud.controller.base.BaseController;
|
|||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.system.Menu;
|
||||
import com.zcloud.entity.system.Role;
|
||||
import com.zcloud.entity.system.Route;
|
||||
import com.zcloud.entity.system.User;
|
||||
import com.zcloud.logs.LogAnno;
|
||||
import com.zcloud.service.system.*;
|
||||
|
@ -35,6 +36,8 @@ public class MainController extends BaseController {
|
|||
@Autowired
|
||||
private MenuService menuService;
|
||||
@Autowired
|
||||
private RouteService routeService;
|
||||
@Autowired
|
||||
private ButtonrightsService buttonrightsService;
|
||||
@Autowired
|
||||
private FhButtonService fhButtonService;
|
||||
|
@ -68,15 +71,29 @@ public class MainController extends BaseController {
|
|||
session.setAttribute(USERNAME + Const.SESSION_ROLE_RIGHTS, roleRights); //将角色权限存入session
|
||||
session.setAttribute(Const.SESSION_USERNAME, USERNAME); //放入用户名到session
|
||||
session.setAttribute(Const.SESSION_U_NAME, user.getNAME()); //放入用户姓名到session
|
||||
List<Menu> menuList = new ArrayList<Menu>();
|
||||
Collection<String> shiroSet= new HashSet<String>(); //存放菜单权限标识
|
||||
menuList = this.getAttributeMenu(session, USERNAME, roleRights, getArrayRoleRights(ROLE_IDS),
|
||||
this.getUQX(user,role,shiroSet), this.getUQX2(user), shiroSet); //菜单缓存以及赋值权限
|
||||
if(null == session.getAttribute(USERNAME + Const.SHIROSET)){
|
||||
session.setAttribute(USERNAME + Const.SHIROSET, shiroSet); //存放菜单权限标识
|
||||
//菜单替换成路由
|
||||
//菜单 已屏蔽
|
||||
// List<Menu> menuList = new ArrayList<Menu>();
|
||||
// Collection<String> shiroSet= new HashSet<String>(); //存放菜单权限标识
|
||||
// menuList = this.getAttributeMenu(session, USERNAME, roleRights, getArrayRoleRights(ROLE_IDS),
|
||||
// this.getUQX(user,role,shiroSet), this.getUQX2(user), shiroSet); //菜单缓存以及赋值权限
|
||||
// if(null == session.getAttribute(USERNAME + Const.SHIROSET)){
|
||||
// session.setAttribute(USERNAME + Const.SHIROSET, shiroSet); //存放菜单权限标识
|
||||
// }
|
||||
// this.setRemortIP(USERNAME); //更新登录IP
|
||||
// map.put("menuList", menuList);
|
||||
List<Route> routeList = new ArrayList<Route>();
|
||||
Collection<String> shiroSet = new HashSet<String>(); //存放菜单权限标识
|
||||
routeList = this.getAttributeRoute(session, USERNAME, roleRights, getArrayRoleRights(ROLE_IDS),
|
||||
this.getUQX(user, role, shiroSet),
|
||||
this.getUQX2(user), shiroSet); //菜单缓存以及赋值权限
|
||||
if (null == session.getAttribute(USERNAME + Const.SHIROSET)) {
|
||||
session.setAttribute(USERNAME + Const.SHIROSET, shiroSet); //存放菜单权限标识
|
||||
}
|
||||
this.setRemortIP(USERNAME); //更新登录IP
|
||||
map.put("menuList", menuList);
|
||||
this.setRemortIP(USERNAME); //更新登录IP
|
||||
map.put("routeList", routeList);
|
||||
|
||||
|
||||
if(null == session.getAttribute(Const.SKIN)){//用户皮肤
|
||||
map.put("SKIN", user.getSKIN());
|
||||
session.setAttribute(Const.SKIN, user.getSKIN());
|
||||
|
@ -116,6 +133,124 @@ public class MainController extends BaseController {
|
|||
return allmenuList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单缓存以及赋值权限
|
||||
*
|
||||
* @param session
|
||||
* @param USERNAME 用户名
|
||||
* @param roleRights 主职角色加密的权限字符串
|
||||
* @param arrayRoleRights 副职角色加密的权限字符串列表
|
||||
* @param uqxmap 主职角色的增删改查权限
|
||||
* @param uqxmap2 副职角色的增删改查权限
|
||||
* @param shiroSet 放入shiro权限标识的的SET
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Route> getAttributeRoute(Session session, String USERNAME, String roleRights, List<String> arrayRoleRights, Map<String, String> uqxmap, Map<String, List<String>> uqxmap2, Collection<String> shiroSet) throws Exception {
|
||||
List<Route> allRouteList = new ArrayList<Route>();
|
||||
if (null == session.getAttribute(USERNAME + Const.SESSION_ALLMENU)) {
|
||||
allRouteList = routeService.listAllMenuJur("0");
|
||||
if (Tools.notEmpty(roleRights)) {
|
||||
allRouteList = this.readRoute(USERNAME, allRouteList, roleRights, arrayRoleRights, shiroSet, uqxmap, uqxmap2); //根据角色权限获取本权限的菜单列表
|
||||
}
|
||||
session.setAttribute(USERNAME + Const.SESSION_ALLMENU, allRouteList); //菜单权限放入session中
|
||||
} else {
|
||||
allRouteList = (List<Route>) session.getAttribute(USERNAME + Const.SESSION_ALLMENU);
|
||||
}
|
||||
return allRouteList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色权限获取本权限的菜单列表(递归处理)
|
||||
*
|
||||
* @param USERNAME 用户名
|
||||
* @param menuList 传入的总菜单
|
||||
* @param roleRights 主职角色加密的权限字符串
|
||||
* @param arrayRoleRights 副职角色加密的权限字符串列表
|
||||
* @param shiroSet 放入shiro权限标识的的Set
|
||||
* @param uqxmap 主职角色的增删改查权限
|
||||
* @param uqxmap2 副职角色的增删改查权限
|
||||
* @return
|
||||
*/
|
||||
public List<Route> readRoute(String USERNAME, List<Route> menuList, String roleRights, List<String> arrayRoleRights, Collection<String> shiroSet, Map<String, String> uqxmap, Map<String, List<String>> uqxmap2) {
|
||||
for (int i = 0; i < menuList.size(); i++) {
|
||||
Boolean b1 = RightsHelper.testRights(roleRights, menuList.get(i).getROUTE_ID());
|
||||
menuList.get(i).setHasMenu(b1); //赋予主职角色菜单权限
|
||||
if (!b1 && null != arrayRoleRights) {
|
||||
for (int n = 0; n < arrayRoleRights.size(); n++) {
|
||||
if (RightsHelper.testRights(arrayRoleRights.get(n), menuList.get(i).getROUTE_ID())) {
|
||||
menuList.get(i).setHasMenu(true);
|
||||
if (Tools.notEmpty(menuList.get(i).getSHIRO_KEY()) && !"(无)".equals(menuList.get(i).getSHIRO_KEY())) {
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (b1) { //有此菜单权限才进行按钮权限判断
|
||||
if (Tools.notEmpty(menuList.get(i).getSHIRO_KEY()) && !"(无)".equals(menuList.get(i).getSHIRO_KEY())) {
|
||||
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY()); //把菜单权限标识放入shiro Set
|
||||
|
||||
/*以下判断增删改查的按钮权限*/
|
||||
Boolean b_add = RightsHelper.testRights(uqxmap.get("adds").toString(), menuList.get(i).getROUTE_ID());
|
||||
if (b_add || "admin".equals(USERNAME)) { //判断主职角色此菜单下有无新增权限,有则把此菜单下的新增权限标识放入 shiro Set
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY().split(":")[0] + ":add");
|
||||
} else if (null != uqxmap2 && null != uqxmap2.get("addsList")) { //无则继续判断副职角色权限
|
||||
for (int n = 0; n < uqxmap2.get("addsList").size(); n++) {
|
||||
Boolean b_add_s = RightsHelper.testRights(uqxmap2.get("addsList").get(n), menuList.get(i).getROUTE_ID()); //判断第一个副职角色的此菜单的新增权限
|
||||
if (b_add_s) { //有则把此菜单下的新增权限标识放入 shiro Set, 并且跳出循环,无则继续循环判断其它副职的角色
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY().split(":")[0] + ":add");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Boolean b_del = RightsHelper.testRights(uqxmap.get("dels").toString(), menuList.get(i).getROUTE_ID());
|
||||
if (b_del || "admin".equals(USERNAME)) { //判断主职角色此菜单下有无删除权限,有则把此菜单下的删除权限标识放入 shiro Set
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY().split(":")[0] + ":del");
|
||||
} else if (null != uqxmap2 && null != uqxmap2.get("delsList")) { //无则继续判断副职角色权限
|
||||
for (int n = 0; n < uqxmap2.get("delsList").size(); n++) {
|
||||
Boolean b_del_s = RightsHelper.testRights(uqxmap2.get("delsList").get(n), menuList.get(i).getROUTE_ID()); //判断第一个副职角色的此菜单的删除权限
|
||||
if (b_del_s) { //有则把此菜单下的删除权限标识放入 shiro Set, 并且跳出循环,无则继续循环判断其它副职的角色
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY().split(":")[0] + ":del");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Boolean b_edit = RightsHelper.testRights(uqxmap.get("edits").toString(), menuList.get(i).getROUTE_ID());
|
||||
if (b_edit || "admin".equals(USERNAME)) { //判断主职角色此菜单下有无修改权限,有则把此菜单下的修改权限标识放入 shiro Set
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY().split(":")[0] + ":edit");
|
||||
} else if (null != uqxmap2 && null != uqxmap2.get("editsList")) { //无则继续判断副职角色权限
|
||||
for (int n = 0; n < uqxmap2.get("editsList").size(); n++) {
|
||||
Boolean b_edit_s = RightsHelper.testRights(uqxmap2.get("editsList").get(n), menuList.get(i).getROUTE_ID()); //判断第一个副职角色的此菜单的修改权限
|
||||
if (b_edit_s) { //有则把此菜单下的修改权限标识放入 shiro Set, 并且跳出循环,无则继续循环判断其它副职的角色
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY().split(":")[0] + ":edit");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Boolean b_cha = RightsHelper.testRights(uqxmap.get("chas").toString(), menuList.get(i).getROUTE_ID());
|
||||
if (b_cha || "admin".equals(USERNAME)) { //判断主职角色此菜单下有无查看权限,有则把此菜单下的查看权限标识放入 shiro Set
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY().split(":")[0] + ":cha");
|
||||
} else if (null != uqxmap2 && null != uqxmap2.get("chasList")) { //无则继续判断副职角色权限
|
||||
for (int n = 0; n < uqxmap2.get("chasList").size(); n++) {
|
||||
Boolean b_cha_s = RightsHelper.testRights(uqxmap2.get("chasList").get(n), menuList.get(i).getROUTE_ID()); //判断第一个副职角色的此菜单的查看权限
|
||||
if (b_cha_s) { //有则把此菜单下的查看权限标识放入 shiro Set, 并且跳出循环,无则继续循环判断其它副职的角色
|
||||
shiroSet.add(menuList.get(i).getSHIRO_KEY().split(":")[0] + ":cha");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (menuList.get(i).isHasMenu()) { //判断是否有此菜单权限
|
||||
this.readRoute(USERNAME, menuList.get(i).getSubMenu(), roleRights, arrayRoleRights, shiroSet, uqxmap, uqxmap2);//是:继续排查其子菜单
|
||||
}
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
|
||||
/**获取副职角色权限List
|
||||
* @param ROLE_IDS 副职角色ID列表
|
||||
* @return
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
package com.zcloud.controller.system;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zcloud.controller.base.BaseController;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.Result;
|
||||
import com.zcloud.service.system.FHlogService;
|
||||
import com.zcloud.service.system.RouteService;
|
||||
import com.zcloud.util.Jurisdiction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:菜单管理处理类
|
||||
* 作者:luoxiaobao
|
||||
* 官网:www.qdkjchina.com
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/route")
|
||||
public class RouteController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RouteService routeService;
|
||||
@Autowired
|
||||
private FHlogService FHLOG;
|
||||
|
||||
/**
|
||||
* @Description: 菜单列表
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/6/9/009 9:28
|
||||
* @Param: [java.lang.String] [ROUTE_ID]
|
||||
* @Return: java.lang.Object
|
||||
*/
|
||||
@RequestMapping(value = "/treeAll")
|
||||
@ResponseBody
|
||||
public Result routeTreeAll() throws Exception {
|
||||
Result result = new Result();
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
pd.put("ROUTE_ID", "0");
|
||||
List<PageData> menuList = routeService.treeAll(pd);
|
||||
result.put("menuList", menuList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 菜单新增
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/6/9/009 10:19
|
||||
* @Param: [java.util.Map<java.lang.String, java.lang.String>] [data]
|
||||
* @Return: com.zcloud.entity.R
|
||||
*/
|
||||
@RequestMapping(value = "/add")
|
||||
// @RequiresPermissions("route:add")
|
||||
@ResponseBody
|
||||
public Result routeAdd() throws Exception {
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
pd.put("ROUTE_ID", String.valueOf(Integer.parseInt(routeService.findMaxId(pd).get("MID").toString()) + 1));
|
||||
pd.put("ROUTE_ICON", ""); //默认无路由图标
|
||||
routeService.add(pd); //新增路由
|
||||
FHLOG.save(Jurisdiction.getUsername(), "新增路由:" + ((JSONObject) JSONObject.parse(pd.getString("META"))).getString("title")); //记录日志
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 菜单修改
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/6/9/009 10:19
|
||||
* @Param: [java.util.Map<java.lang.String, java.lang.String>] [data]
|
||||
* @Return: com.zcloud.entity.R
|
||||
*/
|
||||
@RequestMapping(value = "/edit")
|
||||
// @RequiresPermissions("route:edit")
|
||||
@ResponseBody
|
||||
public Result routeEdit() throws Exception {
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
routeService.edit(pd);
|
||||
FHLOG.save(Jurisdiction.getUsername(), "修改路由:" + ((JSONObject) JSONObject.parse(pd.getString("META"))).getString("title")); //记录日志
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/delete")
|
||||
// @RequiresPermissions("route:del")
|
||||
@ResponseBody
|
||||
public Result routeDelete() throws Exception {
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
String ROUTE_ID = pd.getString("ROUTE_ID");
|
||||
if (routeService.listSubRouteByParentId(ROUTE_ID).size() > 0) {//判断是否有子路由,是:不允许删除
|
||||
return Result.error("请先删除子路由");
|
||||
} else {
|
||||
routeService.delete(ROUTE_ID);
|
||||
FHLOG.save(Jurisdiction.getUsername(), "删除的路由ID为:" + ROUTE_ID); //记录日志
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/icon")
|
||||
// @RequiresPermissions("route:edit")
|
||||
@ResponseBody
|
||||
public Object icon() throws Exception {
|
||||
Result result = new Result();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
PageData route = routeService.findById(pd);
|
||||
JSONObject metaJson = JSONObject.parseObject(route.getString("META"));
|
||||
metaJson.put("icon", pd.getString("ICON"));
|
||||
route.put("META", metaJson.toJSONString());
|
||||
routeService.edit(route);
|
||||
result.put("result", errInfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
package com.zcloud.entity;
|
||||
|
||||
/**
|
||||
* 说明:TODO
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
|
||||
import com.zcloud.util.CodeMessageEnum;
|
||||
import org.apache.http.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description: R类
|
||||
**/
|
||||
public class Result extends HashMap<String, Object> {
|
||||
/**
|
||||
* 序列ID
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* R的无参构造, 初始化信息
|
||||
*/
|
||||
public Result() {
|
||||
put("code", 0);
|
||||
put("msg", "success");
|
||||
put("result", "success");
|
||||
}
|
||||
|
||||
/**
|
||||
* error1: 返回默认error
|
||||
*
|
||||
* @return 返回默认error
|
||||
*/
|
||||
public static Result error() {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常, 请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* error2
|
||||
*
|
||||
* @param msg 错误信息
|
||||
* @return 返回自定义信息的error
|
||||
*/
|
||||
public static Result error(String msg) {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg);
|
||||
}
|
||||
|
||||
public static Result error(CodeMessageEnum codeMessageEnum, String uri) {
|
||||
return error(codeMessageEnum.getCode(), codeMessageEnum.getMessage(), uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* 原先R的code和msg被覆盖
|
||||
*
|
||||
* @param code 错误码
|
||||
* @param msg 错误信息
|
||||
* @return 自定义的错误码和错误信息
|
||||
*/
|
||||
public static Result error(int code, String msg) {
|
||||
Result r = new Result();
|
||||
r.put("code", code);
|
||||
r.put("result", "error");
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static Result error(String code, String msg) {
|
||||
Result r = new Result();
|
||||
r.put("code", code);
|
||||
r.put("result", "error");
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static Result error(String code, String msg, String uri) {
|
||||
Result r = new Result();
|
||||
r.put("code", code);
|
||||
r.put("result", "error");
|
||||
r.put("msg", msg);
|
||||
r.put("uri", uri);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* ok1
|
||||
* 加入了msg
|
||||
*
|
||||
* @param msg
|
||||
* @return
|
||||
*/
|
||||
public static Result ok(String msg) {
|
||||
Result r = new Result();
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* ok2: 加入了map
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public static Result ok(Map<String, Object> map) {
|
||||
Result r = new Result();
|
||||
r.putAll(map);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* ok3: 直接返回"0", "success"
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Result ok() {
|
||||
return new Result();
|
||||
}
|
||||
|
||||
/**
|
||||
* 放入自定义的key和value, 然后返回
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到这个对象的code
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Integer getCode() {
|
||||
return (Integer) this.get("code");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
package com.zcloud.entity.system;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:路由(菜单)实体类
|
||||
* 作者:luoxiaobao
|
||||
* 官网:www.qdkjchina.com
|
||||
*/
|
||||
public class Route implements Serializable {
|
||||
private String ROUTE_ID; //菜单ID
|
||||
private String PARENT_ID; // 上级菜单ID
|
||||
private String PARENT_IDS; // 上级菜单串
|
||||
private String PATH; // 路由地址
|
||||
private String REDIRECT; // 路由重定向地址
|
||||
private String COMPONENT; // 文件位置(非子节点均填children)
|
||||
private String META; // 菜单扩展字段(json格式)
|
||||
private String ROUTE_ORDER; // 菜单排序
|
||||
private String ROUTE_ICON; // 菜单图标
|
||||
private String ROUTE_STATE; //
|
||||
private String SHIRO_KEY; //
|
||||
private String SHOW_MODEL; //
|
||||
private String ROUTE_TYPE; //
|
||||
private String ROUTE_NAME;
|
||||
|
||||
|
||||
private String target;
|
||||
private List<Route> subMenu;
|
||||
private boolean hasMenu = false;
|
||||
|
||||
public String getROUTE_ID() {
|
||||
return ROUTE_ID;
|
||||
}
|
||||
|
||||
public void setROUTE_ID(String ROUTE_ID) {
|
||||
this.ROUTE_ID = ROUTE_ID;
|
||||
}
|
||||
|
||||
public String getPARENT_ID() {
|
||||
return PARENT_ID;
|
||||
}
|
||||
|
||||
public void setPARENT_ID(String PARENT_ID) {
|
||||
this.PARENT_ID = PARENT_ID;
|
||||
}
|
||||
|
||||
public String getPARENT_IDS() {
|
||||
return PARENT_IDS;
|
||||
}
|
||||
|
||||
public void setPARENT_IDS(String PARENT_IDS) {
|
||||
this.PARENT_IDS = PARENT_IDS;
|
||||
}
|
||||
|
||||
public String getPATH() {
|
||||
return PATH;
|
||||
}
|
||||
|
||||
public void setPATH(String PATH) {
|
||||
this.PATH = PATH;
|
||||
}
|
||||
|
||||
public String getREDIRECT() {
|
||||
return REDIRECT;
|
||||
}
|
||||
|
||||
public void setREDIRECT(String REDIRECT) {
|
||||
this.REDIRECT = REDIRECT;
|
||||
}
|
||||
|
||||
public String getCOMPONENT() {
|
||||
return COMPONENT;
|
||||
}
|
||||
|
||||
public void setCOMPONENT(String COMPONENT) {
|
||||
this.COMPONENT = COMPONENT;
|
||||
}
|
||||
|
||||
public String getMETA() {
|
||||
return META;
|
||||
}
|
||||
|
||||
public void setMETA(String META) {
|
||||
this.META = META;
|
||||
}
|
||||
|
||||
public String getROUTE_ORDER() {
|
||||
return ROUTE_ORDER;
|
||||
}
|
||||
|
||||
public void setROUTE_ORDER(String ROUTE_ORDER) {
|
||||
this.ROUTE_ORDER = ROUTE_ORDER;
|
||||
}
|
||||
|
||||
public String getROUTE_ICON() {
|
||||
return ROUTE_ICON;
|
||||
}
|
||||
|
||||
public void setROUTE_ICON(String ROUTE_ICON) {
|
||||
this.ROUTE_ICON = ROUTE_ICON;
|
||||
}
|
||||
|
||||
public String getROUTE_STATE() {
|
||||
return ROUTE_STATE;
|
||||
}
|
||||
|
||||
public void setROUTE_STATE(String ROUTE_STATE) {
|
||||
this.ROUTE_STATE = ROUTE_STATE;
|
||||
}
|
||||
|
||||
public String getSHIRO_KEY() {
|
||||
return SHIRO_KEY;
|
||||
}
|
||||
|
||||
public void setSHIRO_KEY(String SHIRO_KEY) {
|
||||
this.SHIRO_KEY = SHIRO_KEY;
|
||||
}
|
||||
|
||||
public String getSHOW_MODEL() {
|
||||
return SHOW_MODEL;
|
||||
}
|
||||
|
||||
public void setSHOW_MODEL(String SHOW_MODEL) {
|
||||
this.SHOW_MODEL = SHOW_MODEL;
|
||||
}
|
||||
|
||||
public String getROUTE_TYPE() {
|
||||
return ROUTE_TYPE;
|
||||
}
|
||||
|
||||
public void setROUTE_TYPE(String ROUTE_TYPE) {
|
||||
this.ROUTE_TYPE = ROUTE_TYPE;
|
||||
}
|
||||
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(String target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public List<Route> getSubMenu() {
|
||||
return subMenu;
|
||||
}
|
||||
|
||||
public void setSubMenu(List<Route> subMenu) {
|
||||
this.subMenu = subMenu;
|
||||
}
|
||||
|
||||
public boolean isHasMenu() {
|
||||
return hasMenu;
|
||||
}
|
||||
|
||||
public void setHasMenu(boolean hasMenu) {
|
||||
this.hasMenu = hasMenu;
|
||||
}
|
||||
|
||||
public String getROUTE_NAME() {
|
||||
return ROUTE_NAME;
|
||||
}
|
||||
|
||||
public void setROUTE_NAME(String ROUTE_NAME) {
|
||||
this.ROUTE_NAME = ROUTE_NAME;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.zcloud.mapper.datasource.system;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.system.Route;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:菜单Mapper
|
||||
* 作者:luoxiaobao
|
||||
* 官网:www.qdkjchina.com
|
||||
*/
|
||||
public interface RouteMapper {
|
||||
|
||||
/**新增菜单
|
||||
* @param pd
|
||||
*/
|
||||
void add(PageData pd);
|
||||
|
||||
/**保存修改菜单
|
||||
* @param pd
|
||||
*/
|
||||
void edit(PageData pd);
|
||||
|
||||
/**
|
||||
* 通过菜单ID获取数据
|
||||
* @param pd
|
||||
* @return
|
||||
*/
|
||||
PageData findById(PageData pd);
|
||||
|
||||
/**获取最大的菜单ID
|
||||
* @param pd
|
||||
* @return
|
||||
*/
|
||||
PageData findMaxId(PageData pd);
|
||||
|
||||
/**通过ID获取其子一级菜单
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
List<Route> listSubRouteByParentId(String parentId);
|
||||
|
||||
/**通过ID获取其子一级菜单
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
List<PageData> listRouteByParentId(String parentId);
|
||||
|
||||
/**删除菜单
|
||||
* @param ROUTE_ID
|
||||
*/
|
||||
void delete(String ROUTE_ID);
|
||||
|
||||
/**保存菜单图标
|
||||
* @param pd
|
||||
* @return
|
||||
*/
|
||||
void editicon(PageData pd);
|
||||
|
||||
/**获取所有菜单
|
||||
* @param pd
|
||||
* @return
|
||||
*/
|
||||
List<PageData> listAll(PageData pd);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package com.zcloud.service.system;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.system.Route;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:路由服务接口
|
||||
* 作者:luoxiaobao
|
||||
* 官网:www.qdkjchina.com
|
||||
*/
|
||||
public interface RouteService {
|
||||
|
||||
/**新增路由
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void add(PageData pd) throws Exception;
|
||||
|
||||
/**保存修改路由
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void edit(PageData pd) throws Exception;
|
||||
|
||||
/**获取最大的路由ID
|
||||
* @param pd
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PageData findMaxId(PageData pd) throws Exception;
|
||||
|
||||
/**通过ID获取其子一级路由
|
||||
* @param parentId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Route> listSubRouteByParentId(String parentId)throws Exception;
|
||||
|
||||
/**通过ID获取其子一级路由
|
||||
* @param parentId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> listRouteByParentId(String parentId)throws Exception;
|
||||
|
||||
/**获取所有路由并填充每个路由的子路由列表(系统路由列表)
|
||||
* @param pd
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PageData findById(PageData pd) throws Exception;
|
||||
|
||||
/**删除路由
|
||||
* @param ROUTE_ID
|
||||
* @throws Exception
|
||||
*/
|
||||
public void delete(String ROUTE_ID) throws Exception;
|
||||
|
||||
/**保存路由图标
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void editicon(PageData pd) throws Exception;
|
||||
|
||||
/**获取所有路由
|
||||
* @param pd
|
||||
* @return
|
||||
*/
|
||||
List<PageData> treeAll(PageData pd) throws Exception;
|
||||
|
||||
/**获取所有路由(集合)
|
||||
* @param pd
|
||||
* @return
|
||||
*/
|
||||
List<PageData> listAll(PageData pd) throws Exception;
|
||||
|
||||
/**获取所有菜单并填充每个菜单的子菜单列表(系统菜单列表)
|
||||
* @param MENU_ID
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<Route> listAllMenuJur(String MENU_ID) throws Exception;
|
||||
|
||||
}
|
|
@ -0,0 +1,237 @@
|
|||
package com.zcloud.service.system.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.system.Route;
|
||||
import com.zcloud.mapper.datasource.system.RouteMapper;
|
||||
import com.zcloud.service.system.RouteService;
|
||||
import com.zcloud.util.Tools;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 说明:菜单服务接口实现类
|
||||
* 作者:luoxiaobao
|
||||
* 官网:www.qdkjchina.com
|
||||
*/
|
||||
@Service
|
||||
@Transactional //开启事物
|
||||
public class RouteServiceImpl implements RouteService {
|
||||
|
||||
@Autowired
|
||||
private RouteMapper routeMapper;
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
// @CacheEvict(value="routecache", allEntries=true)
|
||||
public void add(PageData pd) throws Exception {
|
||||
routeMapper.add(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存修改菜单
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
// @CacheEvict(value="routecache", allEntries=true)
|
||||
public void edit(PageData pd) throws Exception {
|
||||
routeMapper.edit(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过菜单ID获取数据
|
||||
*
|
||||
* @param pd
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PageData findById(PageData pd) throws Exception {
|
||||
return routeMapper.findById(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最大的菜单ID
|
||||
*
|
||||
* @param pd
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PageData findMaxId(PageData pd) throws Exception {
|
||||
return routeMapper.findMaxId(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID获取其子一级菜单
|
||||
*
|
||||
* @param parentId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
// @Cacheable(key = "'route-'+#parentId", value = "routecache")
|
||||
public List<Route> listSubRouteByParentId(String parentId) throws Exception {
|
||||
return routeMapper.listSubRouteByParentId(parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID获取其子一级菜单
|
||||
*
|
||||
* @param parentId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
// @Cacheable(key = "'route-'+#parentId", value = "routecache")
|
||||
public List<PageData> listRouteByParentId(String parentId) throws Exception {
|
||||
return routeMapper.listRouteByParentId(parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param ROUTE_ID
|
||||
* @throws Exception
|
||||
*/
|
||||
// @CacheEvict(value="routecache", allEntries=true)
|
||||
public void delete(String ROUTE_ID) throws Exception {
|
||||
routeMapper.delete(ROUTE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存菜单图标
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
@CacheEvict(value = "routecache", allEntries = true)
|
||||
public void editicon(PageData pd) throws Exception {
|
||||
routeMapper.editicon(pd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PageData> treeAll(PageData router) throws Exception {
|
||||
List<PageData> routeList = this.listRouteByParentId(router.get("ROUTE_ID").toString());
|
||||
if ("1".equals(router.getString("removePath"))) {
|
||||
routeList.removeIf((item) -> Tools.isEmpty(item.getString("path"))); //去掉path为空的项
|
||||
}
|
||||
for (PageData route : routeList) {
|
||||
if ("0".equals(route.getString("ROUTE_ID"))) {
|
||||
route.put("PARENT_NAME", "(无)");
|
||||
} else {
|
||||
JSONObject meta = JSONObject.parseObject(route.getString("meta"));
|
||||
route.put("PARENT_NAME", meta.getString("title"));
|
||||
}
|
||||
route.put("meta", JSONObject.parse(route.getString("meta")));
|
||||
if ("1".equals(router.getString("removePath"))) {
|
||||
route.put("removePath", router.getString("removePath"));
|
||||
}
|
||||
route.put("children", this.treeAll(route));
|
||||
}
|
||||
return routeList;
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public List<PageData> treeAll(PageData pd) throws Exception {
|
||||
// List<PageData> list = new ArrayList<PageData>();
|
||||
// List<PageData> routeList = routeMapper.listAll(pd);
|
||||
// Map<String, PageData> map = new HashMap<String, PageData>();
|
||||
// for (PageData r : routeList) {
|
||||
// r.put("meta", JSONObject.parse(r.getString("meta")));
|
||||
// map.put(r.getString("ROUTE_ID"), r);
|
||||
// }
|
||||
//
|
||||
// Iterator<Map.Entry<String, PageData>> it = map.entrySet().iterator();
|
||||
// while (it.hasNext()) {
|
||||
// Map.Entry<String, PageData> entry = it.next();
|
||||
// PageData root = entry.getValue();
|
||||
// if ("0".equals(root.getString("PARENT_ID"))) {
|
||||
// root.put("PARENT_NAME", "(无)");
|
||||
// list.add(entry.getValue());
|
||||
// it.remove();//使用迭代器的remove()方法删除元素
|
||||
// }
|
||||
// }
|
||||
// TreeAppendChildren(map, list);
|
||||
// return list;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<PageData> listAll(PageData pd) throws Exception {
|
||||
return routeMapper.listAll(pd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有菜单并填充每个菜单的子菜单列表(系统菜单列表)(递归处理)
|
||||
*
|
||||
* @param MENU_ID
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<Route> listAllMenuJur(String MENU_ID) throws Exception {
|
||||
List<Route> routeList = this.listSubRouteByParentId(MENU_ID);
|
||||
for (Route route : routeList) {
|
||||
route.setSubMenu(this.listAllMenuJur(route.getROUTE_ID()));
|
||||
route.setTarget("treeFrame");
|
||||
}
|
||||
return routeList;
|
||||
}
|
||||
|
||||
|
||||
private void TreeAppendChildren(Map<String, PageData> map, List<PageData> list) {
|
||||
if (!map.isEmpty()) {
|
||||
for (PageData parent : list) {
|
||||
List<PageData> children = new ArrayList<PageData>();
|
||||
Iterator<Map.Entry<String, PageData>> it = map.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, PageData> entry = it.next();
|
||||
PageData child = entry.getValue();
|
||||
if (parent.getString("ROUTE_ID").equals(child.getString("PARENT_ID"))) {
|
||||
child.put("PARENT_NAME", ((JSONObject) parent.get("meta")).getString("title"));
|
||||
children.add(child);
|
||||
it.remove();//使用迭代器的remove()方法删除元素
|
||||
}
|
||||
}
|
||||
if (children.size() > 0) {
|
||||
parent.put("children", children);
|
||||
TreeAppendChildren(map, children);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private void TreeAppendChildren(Map<String, PageData> map, List<PageData> list) {
|
||||
// if (!map.isEmpty()) {
|
||||
// for (PageData parent : list) {
|
||||
// List<PageData> children = new ArrayList<PageData>();
|
||||
// Iterator<Map.Entry<String, PageData>> it = map.entrySet().iterator();
|
||||
// while (it.hasNext()) {
|
||||
// Map.Entry<String, PageData> entry = it.next();
|
||||
// PageData child = entry.getValue();
|
||||
// if (parent.getString("ROUTE_ID").equals(child.getString("PARENT_ID"))) {
|
||||
// child.put("PARENT_NAME", ((JSONObject) parent.get("meta")).getString("title"));
|
||||
// children.add(child);
|
||||
// it.remove();//使用迭代器的remove()方法删除元素
|
||||
// }
|
||||
// }
|
||||
// if (children.size() > 0) {
|
||||
// parent.put("children", children);
|
||||
// TreeAppendChildren(map, children);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.zcloud.util;
|
||||
|
||||
/**
|
||||
* 说明:TODO
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
/**
|
||||
* @desc 对象返回到前端以及异常抛出的接口类
|
||||
*/
|
||||
public interface BaseResultInterface {
|
||||
|
||||
|
||||
String getCode();
|
||||
|
||||
|
||||
String getMessage();
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
package com.zcloud.util;
|
||||
|
||||
/**
|
||||
* 说明:TODO
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
public enum CodeMessageEnum implements BaseResultInterface {
|
||||
|
||||
/** ********* 0000成功 *************** */
|
||||
SUCCESS("0000", "成功!"),
|
||||
SUCCESS_LOGIN("0001", "用户登录成功"),
|
||||
SUCCESS_LOGOUT("0002", "用户退出成功"),
|
||||
|
||||
/* 默认失败 */
|
||||
COMMON_FAIL("999", "失败"),
|
||||
|
||||
/** ********* 1xxx系统错误 *************** */
|
||||
SERVER_BUSY("1001", "服务器正忙,请稍后再试!"),
|
||||
INTERNAL_SERVER_ERROR("1002", "服务器内部错误"),
|
||||
NOT_FOUND("1003", "未找到该资源!"),
|
||||
REQUEST_METHOD_ERROR("1004", "接口请求方法异常"),
|
||||
SQL_SYNTAX_ERROR_EXCEPTION("1005", "SQL语法错误异常"),
|
||||
NULL_POINT_ERROR_EXCEPTION("1006", "空指针异常信息"),
|
||||
INNER_FRAME_EXCEPTION("1007", "内部框架执行异常"),
|
||||
PARSE_TOKEN_EXCEPTION("1008", "解析token异常"),
|
||||
TOKEN_NOT_EXIST("1009", "token不存在"),
|
||||
TOKEN_SIGNATURE_EXCEPTION("1010", "token签名异常"),
|
||||
TOKEN_EXPIRE("1011", "token过期,请重新登录"),
|
||||
IMG_TYPE_NOT_CONFIG("1012", "请配置图片类型"),
|
||||
NOT_CONFIG_FILE_DIR("1013", "请配置文件路径"),
|
||||
UPLOAD_FILE_ERROR("1014", "文件上传失败"),
|
||||
FILE_NOT_EXIST("1015", "文件不存在"),
|
||||
FILE_HAS_DELETED("1016", "文件已被删除"),
|
||||
DRIVER_CLASS_NOT_FOUND("1017", "数据库的连接驱动正在加载中..."),
|
||||
TRY_CONNECT_DATABASE_ERROR("1018", "尝试连接数据库失败"),
|
||||
CLOSE_CONNECT_DATABASE_ERROR("1019", "关闭数据库连接失败"),
|
||||
DATABASE_NAME_NOT_EXIST("1020", "数据库名称不存在"),
|
||||
CLOSE_DATASOURCE_ERROR("1021", "释放数据库资源异常"),
|
||||
DRUID_DATASOURCE_ERROR("1022", "数据源创建中..."),
|
||||
CREATE_DATABASE_ERROR("1023", "创建数据库失败"),
|
||||
CREATE_TABLE_ERROR("1024", "创建表失败"),
|
||||
UPDATE_TABLE_FIELD_ERROR("1025", "更新表字段失败"),
|
||||
DELETE_TABLE_FIELD_ERROR("1026", "删除表字段失败"),
|
||||
QUERY_ROLE_ERROR("1027", "查询角色失败"),
|
||||
UPDATE_GROUP_ERROR("1028", "更新接口组失败"),
|
||||
DELETE_GROUP_ERROR("1029", "删除接口组失败"),
|
||||
SAVE_INTERFACE_ERROR("1030", "保存接口信息失败"),
|
||||
|
||||
/**
|
||||
* ******2xxx参数错误 *********************
|
||||
*/
|
||||
BODY_NOT_MATCH("2001", "请求的数据格式不符"),
|
||||
SIGNATURE_NOT_MATCH("2002", "请求的数字签名不匹配!"),
|
||||
REQUEST_PATH_NOT_MATCH("2003", "当前请求路径没有权限!"),
|
||||
NOT_UPLOAD_FILE_NAME_ERROR("2004", "上传的文件名不存在,请重新上传"),
|
||||
NOT_SUPPORT_IMG_TYPE("2005", "图片格式不正确,请重新上传"),
|
||||
NOT_SUPPORT_USERNAME_TYPE("2006", "excel用户名不能为空"),
|
||||
NOT_SUPPORT_ROLE_TYPE("2007", "角色不存在"),
|
||||
NOT_SUPPORT_DEPT_TYPE("2008", "部门不存在"),
|
||||
SQL_INJECT_NOT_ALLOWED("2009", "参数中存在数据库关键字,请修改"),
|
||||
TABLE_FIELD_NOT_EXIST("2010", "表字段不存在"),
|
||||
|
||||
/** *********** 3xxx用户错误 ******************* */
|
||||
USER_NOT_LOGIN("3001", "用户未登录"),
|
||||
USER_ACCOUNT_EXPIRED("3002", "账号已过期"),
|
||||
USER_CREDENTIALS_ERROR("3003", "用户名或密码错误"),
|
||||
USER_CREDENTIALS_EXPIRED("3004", "密码过期"),
|
||||
USER_ACCOUNT_NOT_BIND_ENTERPRISE("3005", "当前账号未绑定企业"),
|
||||
USER_ACCOUNT_LOCKED("3006", "账号被锁定"),
|
||||
USER_ACCOUNT_NOT_EXIST("3007", "账号不存在"),
|
||||
USER_ACCOUNT_ALREADY_EXIST("3008", "账号已存在"),
|
||||
USER_ACCOUNT_USE_BY_OTHERS("3009", "账号下线"),
|
||||
USER_NO_PERMISSION("3010", "当前账号没有此权限"),
|
||||
USERNAME_NOT_BLANK("3011", "用户不能为空"),
|
||||
USER_LOGIN_ERROR("3012", "用户登录失败"),
|
||||
USER_LOGOUT_ERROR("3013", "用户退出失败"),
|
||||
USER_ACCOUNT_USE_BY_OTHERS_ERROR("3014", "账号下线异常"),
|
||||
USER_ACCESS_DENIED("3015", "权限认证失败"),
|
||||
USERNAME_EXIST_ERROR("3016", "用户名重名"),
|
||||
|
||||
ROLE_NAME_ALREADY_EXIST("3101", "角色已存在"),
|
||||
|
||||
/** ********** 4xxx业务错误 *********************** */
|
||||
ENTERPRISE_NOT_EXIST("4001", "当前企业不存在"),
|
||||
APP_KEY_EXIST("4002", "应用key已存在"),
|
||||
APP_NOT_EXIST("4003", "应用不存在"),
|
||||
APP_PAGE_NAME_EXIST("4004", "当前页面名称已存在"),
|
||||
APP_PAGE_KEY_EXIST("4005", "当前页面key已存在"),
|
||||
APP_PAGE_NOT_EXIST("4006", "当前页面不存在,或已删除"),
|
||||
APP_PAGE_TYPE_ERROR("4007", "页面类型有误"),
|
||||
APP_PAGE_HOME_IS_NOT_EXIST("4008", "请设置首页"),
|
||||
CAN_NOT_DELETE_HOME_PAGE("4009", "请勿删除首页"),
|
||||
DELETE_PAGE_ERROR("4010", "删除页面失败"),
|
||||
CONFIG_CUSTOM_ERROR("4011", "配置自定义页面失败"),
|
||||
APP_PAGE_PARENT_NOT_EXIST("4012", "当前页面的父级页面不存在,或已删除"),
|
||||
DATASOURCE_NAME_EXIST("4013", "当前数据源名称已经存在,请修改后重试"),
|
||||
DATASOURCE_NOT_EXIST("4014", "当前数据源不存在"),
|
||||
DATASOURCE_HAS_DELETED("4015", "当前数据源已删除"),
|
||||
MODEL_NOT_EXIST("4016", "当前模型不存在"),
|
||||
MODEL_HAS_DELETED("4017", "当前模型已删除"),
|
||||
MODEL_NAME_HAS_EXIST("4018", "当前模型名称已存在"),
|
||||
DATASOURCE_NOT_CONFIG("4019", "数据源配置为空,请联系管理员"),
|
||||
DATASOURCE_NOT_CONFIG_DIALECT("4020", "未配置数据源的类型"),
|
||||
DATASOURCE_NOT_CONFIG_DRIVER_CLASS_NAME("4021", "未配置数据源的驱动"),
|
||||
DEPT_USER_EXIST("4022", "部门下存在用户"),
|
||||
NOT_CONFIG_PAGE_BUTTON_TYPE("4023", "未配置按钮雷星"),
|
||||
MODEL_PAGE_RELATION_MODEL("4024", "已关联当前模型页面"),
|
||||
MODEL_PAGE_NOT_EXIST("4025", "模型页面不存在或已被删除"),
|
||||
MODEL_HAS_RELATION_MODEL_PAGE("4026", "当前模型已关联模型页面,不允许删除"),
|
||||
FORM_NOT_EXIST("4027", "模型表单不存在"),
|
||||
READ_FILE_ERROR("4028", "读取模型页面的模板文件失败"),
|
||||
MODEL_PAGE_CONTENT_NULL("4029", "未配置模型页面的模板文件"),
|
||||
NOT_CONFIG_QUERY_SQL("4030", "未配置查询语句"),
|
||||
APP_PAGE_BUTTON_OPTION_VALUE_ERROR("4031", "未配置接口"),
|
||||
DELETE_COLUMN_ERROR("4032", "删除当前失败"),
|
||||
INSERT_DATA_ERROR("4033", "新建数据失败"),
|
||||
EDIT_DATA_ERROR("4034", "编辑数据失败"),
|
||||
DATASOURCE_HAS_MODELS("4035", "当前数据源存在模型,不允许删除"),
|
||||
NOT_CONFIG_FORM_API("4036", "未配置模型表单页的接口信息"),
|
||||
PLEASE_WRITE_AT_LEAST_DATA("4037", "请至少填写一行数据"),
|
||||
AMIS_PAGE_ERROR("4038", "分页参数异常"),
|
||||
QUERY_APP_PAGE_QUERY_FIELD_ERROR("4039", "查询搜素参数异常"),
|
||||
REQUEST_PARAM_NOT_IN_APP_PAGE_QUERY_FIELD("4040", "请求参数不在查询数据表中"),
|
||||
STYLE_LANGUAGE_ON_CSS("4041", "自定义css中的样式语言不能为空"),
|
||||
APP_CONFIG_TYPE_NOT_EXIST("4042", "不支持当前应用设置的类型"),
|
||||
APP_CONFIG_NOT_EXIST_OR_DELETED("4043", "当前设置不存在或已被删除"),
|
||||
APP_HAS_CONFIG_ON_THIS_TYPE("4044", "当前应用设置的类型已存在,请更新"),
|
||||
NOT_SUPPORT_COMPONENT_FRAME("4045", "不支持当前组件框架"),
|
||||
NOT_SUPPORT_COMPONENT_TYPE("4046", "不支持当前组件类型"),
|
||||
CURRENT_APP_KEY_EXIST("4047", "当前应用的组件key已存在"),
|
||||
CREATE_CUSTOM_COMPONENT_ERROR("4048", "新增自定义组件失败"),
|
||||
APP_CUSTOM_COMPONENT_NOT_EXIST("4049", "当前组件不存在或已被删除"),
|
||||
UPDATE_CUSTOM_COMPONENT_ERROR("4050", "更新自定义组件失败"),
|
||||
DELETED_CUSTOM_COMPONENT_ERROR("4051", "删除自定义组件失败"),
|
||||
INSERT_COMPONENT_DEPENDENCE_ERROR("4052", "新增自定义组件依赖项失败"),
|
||||
DELETE_COMPONENT_DEPENDENCE_ERROR("4053", "删除自定义组件依赖项失败"),
|
||||
CURRENT_COMPONENT_DEPENDENCE_NOT_EXIST("4054", "当前自定义组件依赖项不存在或已被删除"),
|
||||
CURRENT_APP_NAME_EXIST("4055", "当前应用的组件名称已存在"),
|
||||
NOT_SUPPORT_DATASOURCE_FROM("4056", "不支持当前的数据库来源"),
|
||||
JDBC_CONFIG_ERROR("4057", "平台内置的数据源配置有误"),
|
||||
NOT_SUPPORT_MODEL_TYPE("4058", "不支持当前的页面模板"),
|
||||
NOT_SUPPORT_CUSTOM_PAGE("4059", "暂不支持自定义页面"),
|
||||
FORM_PAGE_ON_DEVELOPING("4060", "自定义页面的该功能正在开发中..."),
|
||||
APP_PAGE_QUERY_FIELD_NOT_EXIST("4061", "当前查询条件不存在,或已被删除"),
|
||||
APP_PAGE_BUTTON_NOT_EXIST("4062", "当前页面按钮不存在,或已被删除"),
|
||||
TABLE_KEY_MORE_THEN_ONE("4063", "主键超过一个"),
|
||||
TABLE_KEY_LESS_THEN_ONE("4064", "主键必须存在"),
|
||||
TABLE_KEY_MUST_BE_INT("4065", "主键必须为整数类型"),
|
||||
TABLE_FIELD_MUST_EXIST("4066", "必须存在表字段"),
|
||||
CURRENT_MODEL_PAGE_HAS_CONVERSION_CUSTOM_PAGE("4067", "当前模型页面已转成自定义页面"),
|
||||
NOT_SUPPORT_RELEASE_STATUS("4068", "发布版本状态有误"),
|
||||
APP_FORM_BUTTON_NOT_EXIST("4067", "当前表单按钮不存在,或已被删除"),
|
||||
DATASOURCE_KEY_EXIST_ERROR("4068","数据源key已存在")
|
||||
;
|
||||
|
||||
CodeMessageEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/** 返回到前端的code值 */
|
||||
private String code;
|
||||
|
||||
/** 返回到前端的code对应的message值 */
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
// public static CodeVo getJsonObjectByCode(String code) {
|
||||
// CodeVo codeVo = new CodeVo();
|
||||
// if (Tools.isEmpty(code)) {
|
||||
// return codeVo;
|
||||
// }
|
||||
// for (CodeMessageEnum enumObj : CodeMessageEnum.values()) {
|
||||
// if (enumObj.getCode().equals(code)) {
|
||||
// return new CodeVo(code, enumObj.message);
|
||||
// }
|
||||
// }
|
||||
// return codeVo;
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zcloud.mapper.datasource.system.RouteMapper">
|
||||
|
||||
<resultMap type="com.zcloud.entity.system.Route" id="routeResultMap">
|
||||
<id column="ROUTE_ID" property="ROUTE_ID"/>
|
||||
<result column="PARENT_ID" property="PARENT_ID"/>
|
||||
<result column="PARENT_IDS" property="PARENT_IDS"/>
|
||||
<result column="PATH" property="PATH"/>
|
||||
<result column="REDIRECT" property="REDIRECT"/>
|
||||
<result column="COMPONENT" property="COMPONENT"/>
|
||||
<result column="META" property="META"/>
|
||||
<result column="ROUTE_ORDER" property="ROUTE_ORDER"/>
|
||||
<result column="ROUTE_ICON" property="ROUTE_ICON"/>
|
||||
<result column="ROUTE_STATE" property="ROUTE_STATE"/>
|
||||
<result column="SHIRO_KEY" property="SHIRO_KEY"/>
|
||||
<result column="SHOW_MODEL" property="SHOW_MODEL"/>
|
||||
<result column="ROUTE_TYPE" property="ROUTE_TYPE"/>
|
||||
<result column="ROUTE_NAME" property="ROUTE_NAME"/>
|
||||
</resultMap>
|
||||
|
||||
<!--表名 -->
|
||||
<sql id="tableName">
|
||||
SYS_ROUTE
|
||||
</sql>
|
||||
|
||||
<!-- 字段 -->
|
||||
<sql id="Field">
|
||||
ROUTE_ID,
|
||||
PARENT_ID,
|
||||
PARENT_IDS,
|
||||
PATH,
|
||||
REDIRECT,
|
||||
COMPONENT,
|
||||
META,
|
||||
ROUTE_ORDER,
|
||||
ROUTE_ICON,
|
||||
ROUTE_STATE,
|
||||
SHIRO_KEY,
|
||||
SHOW_MODEL,
|
||||
ROUTE_TYPE,
|
||||
ROUTE_NAME
|
||||
</sql>
|
||||
|
||||
<!-- 字段值 -->
|
||||
<sql id="FieldValue">
|
||||
#{ROUTE_ID},
|
||||
#{PARENT_ID},
|
||||
#{PARENT_IDS},
|
||||
#{PATH},
|
||||
#{REDIRECT},
|
||||
#{COMPONENT},
|
||||
#{META},
|
||||
#{ROUTE_ORDER},
|
||||
#{ROUTE_ICON},
|
||||
#{ROUTE_STATE},
|
||||
#{SHIRO_KEY},
|
||||
#{SHOW_MODEL},
|
||||
#{ROUTE_TYPE},
|
||||
#{ROUTE_NAME}
|
||||
</sql>
|
||||
|
||||
<!--新增 -->
|
||||
<insert id="add" parameterType="pd">
|
||||
insert into
|
||||
<include refid="tableName"></include>
|
||||
(
|
||||
<include refid="Field"></include>
|
||||
) values (
|
||||
<include refid="FieldValue"></include>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!--编辑 -->
|
||||
<update id="edit" parameterType="menu">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
PARENT_ID = #{PARENT_ID},
|
||||
PARENT_IDS = #{PARENT_IDS},
|
||||
PATH = #{PATH},
|
||||
REDIRECT = #{REDIRECT},
|
||||
COMPONENT = #{COMPONENT},
|
||||
META = #{META},
|
||||
ROUTE_ORDER = #{ROUTE_ORDER},
|
||||
ROUTE_ICON = #{ROUTE_ICON},
|
||||
ROUTE_STATE = #{ROUTE_STATE},
|
||||
SHIRO_KEY = #{SHIRO_KEY},
|
||||
SHOW_MODEL = #{SHOW_MODEL},
|
||||
ROUTE_TYPE = #{ROUTE_TYPE},
|
||||
ROUTE_NAME = #{ROUTE_NAME}
|
||||
where
|
||||
ROUTE_ID=#{ROUTE_ID}
|
||||
</update>
|
||||
|
||||
<!--通过菜单ID获取数据 -->
|
||||
<select id="findById" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
where ROUTE_ID=#{ROUTE_ID}
|
||||
</select>
|
||||
|
||||
<!--取最大ID-->
|
||||
<select id="findMaxId" parameterType="pd" resultType="pd">
|
||||
select IFNULL(MAX(ROUTE_ID),0) MID from
|
||||
<include refid="tableName"></include>
|
||||
</select>
|
||||
|
||||
|
||||
<!--获取所有菜单 -->
|
||||
<select id="listAll" parameterType="pd" resultType="pd">
|
||||
select
|
||||
ROUTE_ID,
|
||||
PARENT_ID,
|
||||
PARENT_IDS,
|
||||
PATH path,
|
||||
REDIRECT,
|
||||
COMPONENT component,
|
||||
META meta,
|
||||
ROUTE_ORDER,
|
||||
ROUTE_ICON,
|
||||
ROUTE_STATE,
|
||||
SHIRO_KEY,
|
||||
SHOW_MODEL,
|
||||
ROUTE_TYPE,
|
||||
ROUTE_NAME
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
order by ROUTE_ORDER asc
|
||||
</select>
|
||||
|
||||
<!--删除菜单-->
|
||||
<delete id="delete" parameterType="String">
|
||||
delete from
|
||||
<include refid="tableName"></include>
|
||||
where ROUTE_ID=#{ROUTE_ID}
|
||||
</delete>
|
||||
|
||||
<!--保存菜单图标 -->
|
||||
<update id="editicon" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ROUTE_ICON = #{ICON}
|
||||
where
|
||||
ROUTE_ID=#{ROUTE_ID}
|
||||
</update>
|
||||
|
||||
|
||||
<!--通过ID获取其子一级菜单 -->
|
||||
<select id="listSubRouteByParentId" parameterType="String" resultMap="routeResultMap">
|
||||
SELECT
|
||||
<include refid="Field"></include>
|
||||
FROM
|
||||
<include refid="tableName"></include>
|
||||
WHERE
|
||||
PARENT_ID = #{parentId}
|
||||
ORDER BY
|
||||
ROUTE_ORDER
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!--获取所有菜单 -->
|
||||
<select id="listRouteByParentId" parameterType="String" resultType="pd">
|
||||
select
|
||||
ROUTE_ID,
|
||||
PARENT_ID,
|
||||
PARENT_IDS,
|
||||
PATH path,
|
||||
REDIRECT,
|
||||
COMPONENT component,
|
||||
META meta,
|
||||
ROUTE_ORDER,
|
||||
ROUTE_ICON,
|
||||
ROUTE_STATE,
|
||||
SHIRO_KEY,
|
||||
SHOW_MODEL,
|
||||
ROUTE_TYPE,
|
||||
ROUTE_NAME
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
WHERE
|
||||
PARENT_ID = #{parentId}
|
||||
order by ROUTE_ORDER asc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue