Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
69080a8f4a
@ -19,6 +19,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/custom/permission")
|
@RequestMapping("/custom/permission")
|
||||||
@ -67,7 +68,6 @@ public class PermissionController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//参数查询
|
//参数查询
|
||||||
@GetMapping("/getAllParameters")
|
@GetMapping("/getAllParameters")
|
||||||
public Response getAllParameters(
|
public Response getAllParameters(
|
||||||
|
|||||||
@ -10,10 +10,10 @@ import java.util.Date;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Table("yfsjglpt_model_menu_permission")
|
@Table("yfsjglpt_model_menu_dictionary")
|
||||||
public class ModelMenuPermissionPojo {
|
public class ModelMenuPermissionPojo {
|
||||||
|
|
||||||
@RowID(sequence = "yfsjglpt_model_menu_permission_s", type = RowIDType.UUID)
|
@RowID(sequence = "yfsjglpt_model_menu_dictionary_s", type = RowIDType.UUID)
|
||||||
private String id ;
|
private String id ;
|
||||||
/** 上级ID,; */
|
/** 上级ID,; */
|
||||||
private String parentId ;
|
private String parentId ;
|
||||||
@ -33,4 +33,10 @@ public class ModelMenuPermissionPojo {
|
|||||||
private String lastUpdatedBy ;
|
private String lastUpdatedBy ;
|
||||||
/** 最后更新时间,; */
|
/** 最后更新时间,; */
|
||||||
private Date lastUpdateDate ;
|
private Date lastUpdateDate ;
|
||||||
|
|
||||||
|
public ModelMenuPermissionPojo(String id, String parentId, String menuName) {
|
||||||
|
this.id = id;
|
||||||
|
this.parentId = parentId;
|
||||||
|
this.menuName = menuName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.xdap.self_development.pojo;
|
||||||
|
|
||||||
|
import com.definesys.mpaas.query.annotation.RowID;
|
||||||
|
import com.definesys.mpaas.query.annotation.RowIDType;
|
||||||
|
import com.definesys.mpaas.query.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Table("yfsjglpt_model_role_permission")
|
||||||
|
public class ModelRolePermissionPojo {
|
||||||
|
|
||||||
|
@RowID(sequence = "yfsjglpt_model_role_permission_s", type = RowIDType.UUID)
|
||||||
|
/** ID,; */
|
||||||
|
private String id ;
|
||||||
|
/** 角色ID,; */
|
||||||
|
private String roleId ;
|
||||||
|
/** 权限路径ID,; */
|
||||||
|
private String perId ;
|
||||||
|
/** 是否启用,0:未启用;1:启用,; */
|
||||||
|
private int isEnable ;
|
||||||
|
/** 创建人,; */
|
||||||
|
private String createdBy ;
|
||||||
|
/** 创建时间,; */
|
||||||
|
private Date creationDate ;
|
||||||
|
/** 最后更新人,; */
|
||||||
|
private String lastUpdatedBy ;
|
||||||
|
/** 最后更新时间,; */
|
||||||
|
private Date lastUpdateDate ;
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ package com.xdap.self_development.service;
|
|||||||
import com.xdap.self_development.pojo.view.MenuListView;
|
import com.xdap.self_development.pojo.view.MenuListView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface ModelMenuPermissionService {
|
public interface ModelMenuPermissionService {
|
||||||
|
|
||||||
|
|||||||
@ -14,10 +14,7 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@ -29,33 +26,39 @@ public class ModelMenuPermissionServiceImpl implements ModelMenuPermissionServic
|
|||||||
BusinessDatabase businessDatabase;
|
BusinessDatabase businessDatabase;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MenuListView> selectMenus() {
|
public List<MenuListView> selectMenus() {
|
||||||
List<MenuListView> menuListViews = new ArrayList<MenuListView>();
|
|
||||||
|
Map<String, MenuListView> nodeMap = new HashMap<>();
|
||||||
|
List<MenuListView> views = new ArrayList<>();
|
||||||
List<ModelMenuPermissionPojo> permissionPojos = businessDatabase.getBusinessDatabase()
|
List<ModelMenuPermissionPojo> permissionPojos = businessDatabase.getBusinessDatabase()
|
||||||
.doQuery(ModelMenuPermissionPojo.class);
|
.doQuery(ModelMenuPermissionPojo.class);
|
||||||
|
|
||||||
for (ModelMenuPermissionPojo pojo : permissionPojos) {
|
for (ModelMenuPermissionPojo pojo : permissionPojos) {
|
||||||
MenuListView menuListView = new MenuListView();
|
MenuListView node = new MenuListView();
|
||||||
String id = pojo.getId();
|
node.setId(pojo.getId());
|
||||||
menuListView.setId(id);
|
node.setMenu(pojo.getMenuName());
|
||||||
menuListView.setMenu(pojo.getMenuName());
|
node.setListViews(new ArrayList<>());
|
||||||
List<ModelMenuPermissionPojo> pojos = permissionPojos.stream().filter(x -> x.getParentId().equals(id)).collect(Collectors.toList());
|
nodeMap.put(pojo.getId(), node);
|
||||||
|
}
|
||||||
|
|
||||||
if (ObjectUtils.isNotEmpty(pojos)) {
|
for (ModelMenuPermissionPojo pojo : permissionPojos) {
|
||||||
ArrayList<MenuListView> menuListViews1 = new ArrayList<MenuListView>();
|
String parentId = pojo.getParentId();
|
||||||
|
MenuListView currentNode = nodeMap.get(pojo.getId());
|
||||||
|
|
||||||
for (ModelMenuPermissionPojo pojo2 : pojos) {
|
if (ObjectUtils.isEmpty(parentId) || !nodeMap.containsKey(parentId)) {
|
||||||
MenuListView menuListView1 = new MenuListView();
|
// 根节点
|
||||||
String id2 = pojo2.getId();
|
views.add(currentNode);
|
||||||
menuListView1.setId(id2);
|
} else {
|
||||||
menuListView1.setMenu(pojo2.getMenuName());
|
// 子节点,添加到父节点
|
||||||
menuListViews1.add(menuListView1);
|
MenuListView parentNode = nodeMap.get(parentId);
|
||||||
|
if (parentNode.getListViews() == null) {
|
||||||
|
parentNode.setListViews(new ArrayList<>());
|
||||||
}
|
}
|
||||||
menuListView.setListViews(menuListViews1);
|
parentNode.getListViews().add(currentNode);
|
||||||
}
|
}
|
||||||
menuListViews.add(menuListView);
|
}
|
||||||
}
|
|
||||||
return menuListViews;
|
return views;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,8 +44,8 @@ CREATE TABLE yfsjglpt_model_roles(
|
|||||||
|
|
||||||
-- 菜单权限
|
-- 菜单权限
|
||||||
|
|
||||||
DROP TABLE IF EXISTS yfsjglpt_model_menu_permission;
|
DROP TABLE IF EXISTS yfsjglpt_model_menu_dictionary;
|
||||||
CREATE TABLE yfsjglpt_model_menu_permission(
|
CREATE TABLE yfsjglpt_model_menu_dictionary(
|
||||||
`id` VARCHAR(64) NOT NULL COMMENT 'ID',
|
`id` VARCHAR(64) NOT NULL COMMENT 'ID',
|
||||||
`parent_id` VARCHAR(64) COMMENT '上级ID',
|
`parent_id` VARCHAR(64) COMMENT '上级ID',
|
||||||
`menu_name` VARCHAR(64) COMMENT '菜单名称',
|
`menu_name` VARCHAR(64) COMMENT '菜单名称',
|
||||||
@ -57,10 +57,10 @@ CREATE TABLE yfsjglpt_model_menu_permission(
|
|||||||
`last_updated_by` VARCHAR(64) COMMENT '最后更新人',
|
`last_updated_by` VARCHAR(64) COMMENT '最后更新人',
|
||||||
`last_update_date` DATETIME COMMENT '最后更新时间',
|
`last_update_date` DATETIME COMMENT '最后更新时间',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) COMMENT '菜单权限';
|
) COMMENT '菜单字典表';
|
||||||
|
|
||||||
|
|
||||||
-- 菜单参数关联表
|
-- 菜单参数关联表(权限路径表)
|
||||||
DROP TABLE IF EXISTS yfsjglpt_model_menu_parameter;
|
DROP TABLE IF EXISTS yfsjglpt_model_menu_parameter;
|
||||||
CREATE TABLE yfsjglpt_model_menu_parameter(
|
CREATE TABLE yfsjglpt_model_menu_parameter(
|
||||||
`id` VARCHAR(64) NOT NULL COMMENT 'ID',
|
`id` VARCHAR(64) NOT NULL COMMENT 'ID',
|
||||||
@ -73,7 +73,7 @@ CREATE TABLE yfsjglpt_model_menu_parameter(
|
|||||||
`last_updated_by` VARCHAR(64) COMMENT '最后更新人',
|
`last_updated_by` VARCHAR(64) COMMENT '最后更新人',
|
||||||
`last_update_date` DATETIME COMMENT '最后更新时间',
|
`last_update_date` DATETIME COMMENT '最后更新时间',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) COMMENT '菜单参数关联表';
|
) COMMENT '菜单参数关联表(权限路径表)';
|
||||||
|
|
||||||
-- 部门或用户关联角色表
|
-- 部门或用户关联角色表
|
||||||
DROP TABLE IF EXISTS yfsjglpt_model_dep_user_role;
|
DROP TABLE IF EXISTS yfsjglpt_model_dep_user_role;
|
||||||
@ -89,3 +89,18 @@ CREATE TABLE yfsjglpt_model_dep_user_role(
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) COMMENT '部门或用户关联角色表';
|
) COMMENT '部门或用户关联角色表';
|
||||||
|
|
||||||
|
|
||||||
|
--角色权限关联表
|
||||||
|
DROP TABLE IF EXISTS yc_datasource_0.yfsjglpt_model_role_permission;
|
||||||
|
CREATE TABLE yc_datasource_0.yfsjglpt_model_role_permission(
|
||||||
|
`id` VARCHAR(64) NOT NULL COMMENT 'ID',
|
||||||
|
`role_id` VARCHAR(64) COMMENT '角色ID',
|
||||||
|
`per_id` VARCHAR(64) COMMENT '权限路径ID',
|
||||||
|
`is_enable` INT DEFAULT 1 COMMENT '是否启用;0:未启用;1:启用',
|
||||||
|
`created_by` VARCHAR(64) COMMENT '创建人',
|
||||||
|
`creation_date` DATETIME COMMENT '创建时间',
|
||||||
|
`last_updated_by` VARCHAR(64) COMMENT '最后更新人',
|
||||||
|
`last_update_date` DATETIME COMMENT '最后更新时间',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) COMMENT '角色权限关联表';
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user