mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-04 22:41:24 +08:00
Added role management
This commit is contained in:
@@ -2,8 +2,10 @@ package com.cfive.pinnacle;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableTransactionManagement
|
||||||
public class PinnacleApplication {
|
public class PinnacleApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
package com.cfive.pinnacle.controller;
|
package com.cfive.pinnacle.controller;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import com.cfive.pinnacle.entity.Role;
|
||||||
|
import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||||
|
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||||
|
import com.cfive.pinnacle.service.IRoleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -15,4 +22,45 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RequestMapping("/role")
|
@RequestMapping("/role")
|
||||||
public class RoleController {
|
public class RoleController {
|
||||||
|
|
||||||
|
private IRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setRoleService(IRoleService roleService) {
|
||||||
|
this.roleService = roleService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public ResponseResult getAllRole() {
|
||||||
|
List<Role> roles = roleService.getAllRole();
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", roles);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public ResponseResult addRole(@RequestBody Role role) {
|
||||||
|
if (roleService.addRole(role)) {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", null);
|
||||||
|
} else {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "error", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ResponseResult deleteRole(@PathVariable Long id) {
|
||||||
|
LambdaQueryWrapper<Role> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(Role::getId, id);
|
||||||
|
if (roleService.remove(wrapper)) {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", null);
|
||||||
|
} else {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "error", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public ResponseResult modifyRole(@RequestBody Role role) {
|
||||||
|
if (roleService.modifyRole(role)) {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", null);
|
||||||
|
} else {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "error", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import java.io.Serial;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -30,6 +32,7 @@ public class Department implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.Version;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ public class Group implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,14 @@ import com.baomidou.mybatisplus.annotation.Version;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.cfive.pinnacle.entity.permission.Element;
|
||||||
|
import com.cfive.pinnacle.entity.permission.Menu;
|
||||||
|
import com.cfive.pinnacle.entity.permission.Operation;
|
||||||
|
import com.cfive.pinnacle.entity.permission.Power;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -29,6 +36,7 @@ public class Role implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,6 +45,18 @@ public class Role implements Serializable {
|
|||||||
@TableField("name")
|
@TableField("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Menu> menus;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Element> elements;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Operation> operations;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Power> powers;
|
||||||
|
|
||||||
@TableField("deleted")
|
@TableField("deleted")
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private Integer deleted;
|
private Integer deleted;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.Version;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -29,18 +31,21 @@ public class RoleGroup implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色
|
* 角色
|
||||||
*/
|
*/
|
||||||
@TableField("role_id")
|
@TableField("role_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 群组
|
* 群组
|
||||||
*/
|
*/
|
||||||
@TableField("group_id")
|
@TableField("group_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
@TableField("deleted")
|
@TableField("deleted")
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import java.io.Serial;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -30,12 +32,14 @@ public class Staff implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户
|
* 用户
|
||||||
*/
|
*/
|
||||||
@TableField("user_id")
|
@TableField("user_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class User implements Serializable {
|
|||||||
* 部门
|
* 部门
|
||||||
*/
|
*/
|
||||||
@TableField("department_id")
|
@TableField("department_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long departmentId;
|
private Long departmentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.Version;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -29,18 +31,21 @@ public class UserGroup implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户
|
* 用户
|
||||||
*/
|
*/
|
||||||
@TableField("user_id")
|
@TableField("user_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户组
|
* 用户组
|
||||||
*/
|
*/
|
||||||
@TableField("group_id")
|
@TableField("group_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
@TableField("deleted")
|
@TableField("deleted")
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.Version;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@@ -29,18 +31,21 @@ public class UserRole implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户
|
* 用户
|
||||||
*/
|
*/
|
||||||
@TableField("user_id")
|
@TableField("user_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色
|
* 角色
|
||||||
*/
|
*/
|
||||||
@TableField("role_id")
|
@TableField("role_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
@TableField("deleted")
|
@TableField("deleted")
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class UserWork implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class Work implements Serializable {
|
|||||||
* 发布者
|
* 发布者
|
||||||
*/
|
*/
|
||||||
@TableField("publisher_id")
|
@TableField("publisher_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long publisherId;
|
private Long publisherId;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@@ -82,6 +83,7 @@ public class Work implements Serializable {
|
|||||||
* 源ID
|
* 源ID
|
||||||
*/
|
*/
|
||||||
@TableField("origin_id")
|
@TableField("origin_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long originId;
|
private Long originId;
|
||||||
|
|
||||||
@TableField("deleted")
|
@TableField("deleted")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -31,6 +33,7 @@ public class Element implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,5 +46,13 @@ public class Element implements Serializable {
|
|||||||
* 权限ID
|
* 权限ID
|
||||||
*/
|
*/
|
||||||
@TableField("power_id")
|
@TableField("power_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long powerId;
|
private Long powerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单ID
|
||||||
|
*/
|
||||||
|
@TableField("menu_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long menuId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -31,6 +33,7 @@ public class File implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,5 +52,6 @@ public class File implements Serializable {
|
|||||||
* 权限ID
|
* 权限ID
|
||||||
*/
|
*/
|
||||||
@TableField("power_id")
|
@TableField("power_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long powerId;
|
private Long powerId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -31,6 +33,7 @@ public class Menu implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,11 +52,13 @@ public class Menu implements Serializable {
|
|||||||
* 权限ID
|
* 权限ID
|
||||||
*/
|
*/
|
||||||
@TableField("power_id")
|
@TableField("power_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long powerId;
|
private Long powerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父ID
|
* 父ID
|
||||||
*/
|
*/
|
||||||
@TableField("parent_id")
|
@TableField("parent_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -31,6 +33,7 @@ public class Operation implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,11 +52,20 @@ public class Operation implements Serializable {
|
|||||||
* 权限ID
|
* 权限ID
|
||||||
*/
|
*/
|
||||||
@TableField("power_id")
|
@TableField("power_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long powerId;
|
private Long powerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面元素ID
|
||||||
|
*/
|
||||||
|
@TableField("element_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long elementId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父ID
|
* 父ID
|
||||||
*/
|
*/
|
||||||
@TableField("parent_id")
|
@TableField("parent_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import java.io.Serial;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -34,18 +36,21 @@ public class OperationLog implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户
|
* 用户
|
||||||
*/
|
*/
|
||||||
@TableField("user_id")
|
@TableField("user_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能
|
* 功能
|
||||||
*/
|
*/
|
||||||
@TableField("operation_id")
|
@TableField("operation_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long operationId;
|
private Long operationId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -31,11 +33,13 @@ public class Power implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限类型
|
* 权限类型
|
||||||
*/
|
*/
|
||||||
@TableField("type_id")
|
@TableField("type_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.Version;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -33,18 +35,21 @@ public class PowerRole implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限
|
* 权限
|
||||||
*/
|
*/
|
||||||
@TableField("power_id")
|
@TableField("power_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long powerId;
|
private Long powerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色
|
* 角色
|
||||||
*/
|
*/
|
||||||
@TableField("role_id")
|
@TableField("role_id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
@TableField("deleted")
|
@TableField("deleted")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -31,6 +33,7 @@ public class PowerType implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.cfive.pinnacle.mapper;
|
package com.cfive.pinnacle.mapper;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.cfive.pinnacle.entity.Role;
|
import com.cfive.pinnacle.entity.Role;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -14,5 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface RoleMapper extends BaseMapper<Role> {
|
public interface RoleMapper extends BaseMapper<Role> {
|
||||||
|
List<Role> getAll();
|
||||||
|
|
||||||
|
Role getOneById(@Param("id") long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.cfive.pinnacle.service;
|
|||||||
import com.cfive.pinnacle.entity.Role;
|
import com.cfive.pinnacle.entity.Role;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 角色 服务类
|
* 角色 服务类
|
||||||
@@ -12,5 +14,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
* @since 2023-04-30
|
* @since 2023-04-30
|
||||||
*/
|
*/
|
||||||
public interface IRoleService extends IService<Role> {
|
public interface IRoleService extends IService<Role> {
|
||||||
|
List<Role> getAllRole();
|
||||||
|
|
||||||
|
Role getRole(long id);
|
||||||
|
|
||||||
|
boolean addRole(Role role);
|
||||||
|
|
||||||
|
boolean modifyRole(Role role);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
package com.cfive.pinnacle.service.impl;
|
package com.cfive.pinnacle.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.cfive.pinnacle.entity.Role;
|
import com.cfive.pinnacle.entity.Role;
|
||||||
|
import com.cfive.pinnacle.entity.permission.PowerRole;
|
||||||
import com.cfive.pinnacle.mapper.RoleMapper;
|
import com.cfive.pinnacle.mapper.RoleMapper;
|
||||||
|
import com.cfive.pinnacle.mapper.permission.PowerRoleMapper;
|
||||||
import com.cfive.pinnacle.service.IRoleService;
|
import com.cfive.pinnacle.service.IRoleService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -17,4 +25,74 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {
|
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {
|
||||||
|
|
||||||
|
private RoleMapper roleMapper;
|
||||||
|
private PowerRoleMapper powerRoleMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setRoleMapper(RoleMapper roleMapper) {
|
||||||
|
this.roleMapper = roleMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setPowerRoleMapper(PowerRoleMapper powerRoleMapper) {
|
||||||
|
this.powerRoleMapper = powerRoleMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Role> getAllRole() {
|
||||||
|
return roleMapper.getAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Role getRole(long id) {
|
||||||
|
return roleMapper.getOneById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean addRole(Role role) {
|
||||||
|
if (roleMapper.insert(role) == 1) {
|
||||||
|
role.getPowers().forEach(power -> {
|
||||||
|
PowerRole powerRole = new PowerRole();
|
||||||
|
powerRole.setRoleId(role.getId());
|
||||||
|
powerRole.setPowerId(power.getId());
|
||||||
|
if (powerRoleMapper.insert(powerRole) != 1) {
|
||||||
|
throw new RuntimeException("Add power_role failure");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Add role failure");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean modifyRole(Role role) {
|
||||||
|
roleMapper.updateById(role);
|
||||||
|
Role originalRole = getRole(role.getId());
|
||||||
|
HashSet<Long> originalPowerIds = new HashSet<>();
|
||||||
|
originalRole.getMenus().forEach(menu -> originalPowerIds.add(menu.getPowerId()));
|
||||||
|
originalRole.getElements().forEach(element -> originalPowerIds.add(element.getPowerId()));
|
||||||
|
originalRole.getOperations().forEach(operation -> originalPowerIds.add(operation.getPowerId()));
|
||||||
|
HashSet<Long> newPowerIds = new HashSet<>();
|
||||||
|
role.getPowers().forEach(power -> newPowerIds.add(power.getId()));
|
||||||
|
HashSet<Long> deletePowerIds = new HashSet<>(originalPowerIds);
|
||||||
|
deletePowerIds.removeAll(newPowerIds);
|
||||||
|
HashSet<Long> addPowerIds = new HashSet<>(newPowerIds);
|
||||||
|
addPowerIds.removeAll(originalPowerIds);
|
||||||
|
deletePowerIds.forEach(deletePowerId -> {
|
||||||
|
LambdaQueryWrapper<PowerRole> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(PowerRole::getRoleId, role.getId())
|
||||||
|
.eq(PowerRole::getPowerId, deletePowerId);
|
||||||
|
powerRoleMapper.delete(wrapper);
|
||||||
|
});
|
||||||
|
addPowerIds.forEach(addPowerId -> {
|
||||||
|
PowerRole powerRole = new PowerRole();
|
||||||
|
powerRole.setRoleId(role.getId());
|
||||||
|
powerRole.setPowerId(addPowerId);
|
||||||
|
powerRoleMapper.insert(powerRole);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,90 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cfive.pinnacle.mapper.RoleMapper">
|
<mapper namespace="com.cfive.pinnacle.mapper.RoleMapper">
|
||||||
|
|
||||||
|
<select id="getAll" resultMap="roleMap">
|
||||||
|
select t_role.id as role_id,
|
||||||
|
t_role.name as role_name,
|
||||||
|
t_role.deleted as role_deleted,
|
||||||
|
t_role.version as role_version,
|
||||||
|
tm.id as menu_id,
|
||||||
|
tm.name as menu_name,
|
||||||
|
tm.url as menu_url,
|
||||||
|
tm.power_id as menu_power_id,
|
||||||
|
tm.parent_id as menu_parent_id,
|
||||||
|
te.id as element_id,
|
||||||
|
te.name as element_name,
|
||||||
|
te.power_id as element_power_id,
|
||||||
|
te.menu_id as element_menu_id,
|
||||||
|
t.id as operation_id,
|
||||||
|
t.name as operation_name,
|
||||||
|
t.code as operation_code,
|
||||||
|
t.power_id as operation_power_id,
|
||||||
|
t.element_id as operation_element_id,
|
||||||
|
t.parent_id as operation_parent_id
|
||||||
|
from t_role
|
||||||
|
left join t_power_role tpr on t_role.id = tpr.role_id
|
||||||
|
left join t_power tp on tp.id = tpr.power_id
|
||||||
|
left join t_menu tm on tp.id = tm.power_id
|
||||||
|
left join t_element te on tp.id = te.power_id
|
||||||
|
left join t_operation t on tp.id = t.power_id
|
||||||
|
where t_role.deleted = 0 and tpr.deleted = 0;
|
||||||
|
</select>
|
||||||
|
<select id="getOneById" resultMap="roleMap">
|
||||||
|
select t_role.id as role_id,
|
||||||
|
t_role.name as role_name,
|
||||||
|
t_role.deleted as role_deleted,
|
||||||
|
t_role.version as role_version,
|
||||||
|
tm.id as menu_id,
|
||||||
|
tm.name as menu_name,
|
||||||
|
tm.url as menu_url,
|
||||||
|
tm.power_id as menu_power_id,
|
||||||
|
tm.parent_id as menu_parent_id,
|
||||||
|
te.id as element_id,
|
||||||
|
te.name as element_name,
|
||||||
|
te.power_id as element_power_id,
|
||||||
|
te.menu_id as element_menu_id,
|
||||||
|
t.id as operation_id,
|
||||||
|
t.name as operation_name,
|
||||||
|
t.code as operation_code,
|
||||||
|
t.power_id as operation_power_id,
|
||||||
|
t.element_id as operation_element_id,
|
||||||
|
t.parent_id as operation_parent_id
|
||||||
|
from t_role
|
||||||
|
left join t_power_role tpr on t_role.id = tpr.role_id
|
||||||
|
left join t_power tp on tp.id = tpr.power_id
|
||||||
|
left join t_menu tm on tp.id = tm.power_id
|
||||||
|
left join t_element te on tp.id = te.power_id
|
||||||
|
left join t_operation t on tp.id = t.power_id
|
||||||
|
where t_role.deleted = 0
|
||||||
|
and tpr.deleted = 0
|
||||||
|
and t_role.id = #{id};
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="roleMap" type="role">
|
||||||
|
<id property="id" column="role_id"/>
|
||||||
|
<result property="name" column="role_name"/>
|
||||||
|
<result property="deleted" column="role_deleted"/>
|
||||||
|
<result property="version" column="role_version"/>
|
||||||
|
<collection property="menus" ofType="menu">
|
||||||
|
<id property="id" column="menu_id"/>
|
||||||
|
<result property="name" column="menu_name"/>
|
||||||
|
<result property="url" column="menu_url"/>
|
||||||
|
<result property="powerId" column="menu_power_id"/>
|
||||||
|
<result property="parentId" column="menu_parent_id"/>
|
||||||
|
</collection>
|
||||||
|
<collection property="elements" ofType="element">
|
||||||
|
<id property="id" column="element_id"/>
|
||||||
|
<result property="name" column="element_name"/>
|
||||||
|
<result property="powerId" column="element_power_id"/>
|
||||||
|
<result property="menuId" column="element_menu_id"/>
|
||||||
|
</collection>
|
||||||
|
<collection property="operations" ofType="operation">
|
||||||
|
<id property="id" column="operation_id"/>
|
||||||
|
<result property="name" column="operation_name"/>
|
||||||
|
<result property="code" column="operation_code"/>
|
||||||
|
<result property="powerId" column="operation_power_id"/>
|
||||||
|
<result property="elementId" column="operation_element_id"/>
|
||||||
|
<result property="parentId" column="operation_parent_id"/>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cfive.pinnacle;
|
package com.cfive.pinnacle;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
@@ -10,4 +11,10 @@ class PinnacleApplicationTests {
|
|||||||
void contextLoads() {
|
void contextLoads() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void generateId() {
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
System.out.println(IdWorker.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
SET FOREIGN_KEY_CHECKS=0;
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
truncate t_menu;
|
truncate t_menu;
|
||||||
truncate t_element;
|
truncate t_element;
|
||||||
@@ -7,54 +7,99 @@ truncate t_operation_log;
|
|||||||
truncate t_operation;
|
truncate t_operation;
|
||||||
truncate t_power;
|
truncate t_power;
|
||||||
truncate t_power_type;
|
truncate t_power_type;
|
||||||
|
truncate t_role;
|
||||||
|
truncate t_power_role;
|
||||||
|
|
||||||
insert into t_power_type (id, name)
|
insert into t_power_type (id, name)
|
||||||
values (1, 'operation'),
|
values (1, 'menu'),
|
||||||
(2, 'menu'),
|
(2, 'element'),
|
||||||
(3, 'element'),
|
(3, 'operation');
|
||||||
(4, 'file');
|
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
insert into t_power (type_id)
|
insert into t_power (type_id)
|
||||||
values (1);
|
values (1);
|
||||||
insert into t_operation (name, code, power_id, parent_id)
|
insert into t_menu (id, name, url, power_id, parent_id)
|
||||||
values ('Select All Power Type', 'system:power_type:all', last_insert_id(), null);
|
VALUES (1, '公用', '/', last_insert_id(), null);
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
insert into t_power (type_id)
|
insert into t_power (type_id)
|
||||||
values (1);
|
values (2);
|
||||||
insert into t_operation (name, code, power_id, parent_id)
|
insert into t_element(id, name, power_id, menu_id)
|
||||||
values ('Select All Power', 'system:power:all', last_insert_id(), null);
|
VALUES (1, '公用', last_insert_id(), 1);
|
||||||
|
commit;
|
||||||
|
|
||||||
|
begin;
|
||||||
|
insert into t_power(type_id)
|
||||||
|
values (3);
|
||||||
|
insert into t_operation(name, code, power_id, element_id, parent_id)
|
||||||
|
VALUES ('查询当前用户权限', 'common:power:self', last_insert_id(), 1, null);
|
||||||
|
commit;
|
||||||
|
|
||||||
|
begin;
|
||||||
|
insert into t_power(type_id)
|
||||||
|
values (3);
|
||||||
|
insert into t_operation(name, code, power_id, element_id, parent_id)
|
||||||
|
VALUES ('查询当前用户信息', 'common:info:self', last_insert_id(), 1, null);
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
insert into t_power (type_id)
|
insert into t_power (type_id)
|
||||||
values (1);
|
values (1);
|
||||||
insert into t_operation (name, code, power_id, parent_id)
|
insert into t_menu (id, name, url, power_id, parent_id)
|
||||||
values ('Select All User', 'system:operation:all', last_insert_id(), null);
|
VALUES (2, '角色管理', '/system/role', last_insert_id(), null);
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
insert into t_power (type_id)
|
insert into t_power (type_id)
|
||||||
values (1);
|
values (2);
|
||||||
insert into t_operation (name, code, power_id, parent_id)
|
insert into t_element (id, name, power_id, menu_id)
|
||||||
values ('Select All User', 'system:menu:all', last_insert_id(), null);
|
VALUES (2, '角色列表', last_insert_id(), 2);
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
insert into t_power (type_id)
|
insert into t_power (type_id)
|
||||||
values (1);
|
values (3);
|
||||||
insert into t_operation (name, code, power_id, parent_id)
|
insert into t_operation (name, code, power_id, element_id, parent_id)
|
||||||
values ('Select All User', 'system:element:all', last_insert_id(), null);
|
VALUES ('查询所有权限', 'system:power:all', last_insert_id(), 2, null);
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
insert into t_power (type_id)
|
insert into t_power (type_id)
|
||||||
values (1);
|
values (3);
|
||||||
insert into t_operation (name, code, power_id, parent_id)
|
insert into t_operation (name, code, power_id, element_id, parent_id)
|
||||||
values ('Select All User', 'system:file:all', last_insert_id(), null);
|
VALUES ('查询所有角色', 'system:role:all', last_insert_id(), 2, null);
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS=1;
|
begin;
|
||||||
|
insert into t_power (type_id)
|
||||||
|
values (3);
|
||||||
|
insert into t_operation (name, code, power_id, element_id, parent_id)
|
||||||
|
VALUES ('查询所有用户', 'system:user:all', last_insert_id(), 2, null);
|
||||||
|
commit;
|
||||||
|
|
||||||
|
insert into t_role (id, name)
|
||||||
|
values (1655784840189972481, '员工'),
|
||||||
|
(1655784928056467457, '组长'),
|
||||||
|
(1655785102375940097, '主管'),
|
||||||
|
(1655785102375940098, '总管');
|
||||||
|
|
||||||
|
insert into t_power_role(id, power_id, role_id)
|
||||||
|
VALUES (1656219345971326978, 1, 1655784840189972481),
|
||||||
|
(1656219345971326979, 2, 1655784840189972481),
|
||||||
|
(1656219345971326980, 3, 1655784840189972481),
|
||||||
|
(1656219345971326981, 4, 1655784840189972481),
|
||||||
|
(1656219345971326982, 5, 1655785102375940098),
|
||||||
|
(1656219345971326983, 6, 1655785102375940098),
|
||||||
|
(1656219345971326984, 7, 1655785102375940098),
|
||||||
|
(1656219345971326985, 8, 1655785102375940098),
|
||||||
|
(1656219345971326986, 9, 1655785102375940098);
|
||||||
|
|
||||||
|
select * from t_role
|
||||||
|
left join t_power_role tpr on t_role.id = tpr.role_id
|
||||||
|
left join t_power tp on tp.id = tpr.power_id
|
||||||
|
left join t_menu tm on tp.id = tm.power_id
|
||||||
|
left join t_element te on tp.id = te.power_id
|
||||||
|
left join t_operation t on tp.id = t.power_id;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
18
sql/init.sql
18
sql/init.sql
@@ -52,7 +52,9 @@ create table `t_element`
|
|||||||
`id` bigint not null primary key auto_increment,
|
`id` bigint not null primary key auto_increment,
|
||||||
`name` varchar(100) not null comment '元素名',
|
`name` varchar(100) not null comment '元素名',
|
||||||
`power_id` bigint not null comment '权限ID',
|
`power_id` bigint not null comment '权限ID',
|
||||||
constraint t_element_power_id_fk foreign key (power_id) references t_power (id)
|
`menu_id` bigint not null comment '菜单ID',
|
||||||
|
constraint t_element_power_id_fk foreign key (power_id) references t_power (id),
|
||||||
|
constraint t_element_menu_id_fk foreign key (menu_id) references t_menu (id)
|
||||||
) comment '页面元素';
|
) comment '页面元素';
|
||||||
|
|
||||||
create table `t_file`
|
create table `t_file`
|
||||||
@@ -66,12 +68,14 @@ create table `t_file`
|
|||||||
|
|
||||||
create table `t_operation`
|
create table `t_operation`
|
||||||
(
|
(
|
||||||
`id` bigint not null primary key auto_increment,
|
`id` bigint not null primary key auto_increment,
|
||||||
`name` varchar(50) not null comment '功能名',
|
`name` varchar(50) not null comment '功能名',
|
||||||
`code` varchar(50) null comment '功能编码',
|
`code` varchar(50) null comment '功能编码',
|
||||||
`power_id` bigint not null comment '权限ID',
|
`power_id` bigint not null comment '权限ID',
|
||||||
`parent_id` bigint null comment '父ID',
|
`parent_id` bigint null comment '父ID',
|
||||||
constraint t_operation_power_id_fk foreign key (power_id) references t_power (id)
|
`element_id` bigint not null comment '页面元素ID',
|
||||||
|
constraint t_operation_power_id_fk foreign key (power_id) references t_power (id),
|
||||||
|
constraint t_operation_element_id_fk foreign key (element_id) references t_element (id)
|
||||||
) comment '功能';
|
) comment '功能';
|
||||||
|
|
||||||
create table `t_department`
|
create table `t_department`
|
||||||
|
|||||||
3
ui/src/assets/svg/plus.svg
Normal file
3
ui/src/assets/svg/plus.svg
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg t="1683996724912" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6300"
|
||||||
|
width="200" height="200"><path d="M896 416H608V128c0-35.34-28.66-64-64-64h-64c-35.34 0-64 28.66-64 64v288H128c-35.34 0-64 28.66-64 64v64c0 35.34 28.66 64 64 64h288v288c0 35.34 28.66 64 64 64h64c35.34 0 64-28.66 64-64V608h288c35.34 0 64-28.66 64-64v-64c0-35.34-28.66-64-64-64z" p-id="6301" /></svg>
|
||||||
|
After Width: | Height: | Size: 559 B |
3
ui/src/assets/svg/refresh.svg
Normal file
3
ui/src/assets/svg/refresh.svg
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg t="1683996153035" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5343"
|
||||||
|
width="200" height="200"><path d="M782.954667 240.512C713.365333 170.901333 617.834667 127.701333 511.765333 127.701333 299.605333 127.701333 128.234667 299.541333 128.234667 511.701333 128.234667 723.861333 299.605333 895.701333 511.765333 895.701333 690.794667 895.701333 840.085333 773.312 882.794667 607.701333L782.954667 607.701333C743.594667 719.552 637.034667 799.701333 511.765333 799.701333 352.874667 799.701333 223.765333 670.592 223.765333 511.701333 223.765333 352.832 352.874667 223.701333 511.765333 223.701333 591.445333 223.701333 662.485333 256.832 714.325333 309.141333L559.765333 463.701333 895.765333 463.701333 895.765333 127.701333 782.954667 240.512Z" p-id="5344" /></svg>
|
||||||
|
After Width: | Height: | Size: 958 B |
3
ui/src/assets/svg/setting.svg
Normal file
3
ui/src/assets/svg/setting.svg
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg t="1683606243187" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2400"
|
||||||
|
width="200" height="200"><path d="M920.419872 418.785859l-76.229871 0c-7.654882-26.792088-18.339822-52.308363-31.735867-76.070394l54.859991-54.859991c24.718891-24.718891 24.718891-64.58807 0-89.306962l-44.653481-44.653481c-24.718891-24.718891-64.58807-24.718891-89.306962 0l-55.816851 55.816851c-22.32674-12.279707-46.248248-21.84831-71.286093-28.865286L606.25074 104.616726c0-34.765924-28.067902-62.833827-62.833827-62.833827l-62.833827 0c-34.765924 0-62.833827 28.067902-62.833827 62.833827l0 76.070394c-25.835228 7.335929-50.554119 17.542439-73.678243 30.300576l-57.411618-57.411618c-24.718891-24.718891-64.58807-24.718891-89.306962 0l-44.653481 44.653481c-24.718891 24.718891-24.718891 64.58807 0 89.306962l57.411618 57.411618c-12.917614 23.124124-22.964647 47.683538-30.300576 73.678243L103.580128 418.626382c-34.765924 0-62.833827 28.067902-62.833827 62.833827l0 62.833827c0 34.765924 28.067902 62.833827 62.833827 62.833827l76.229871 0c7.016976 24.878368 16.585579 48.959352 28.865286 71.286093l-55.816851 55.816851c-24.718891 24.718891-24.718891 64.58807 0 89.306962l44.653481 44.653481c24.718891 24.718891 64.58807 24.718891 89.306962 0l54.859991-54.859991c23.762031 13.555521 49.278306 24.240461 76.070394 31.735867l0 76.229871c0 34.765924 28.067902 62.833827 62.833827 62.833827l62.833827 0c34.765924 0 62.833827-28.067902 62.833827-62.833827L606.25074 845.2266c25.835228-7.335929 50.554119-17.542439 73.678243-30.300576l53.4247 53.4247c24.718891 24.718891 64.58807 24.718891 89.306962 0l44.653481-44.653481c24.718891-24.718891 24.718891-64.58807 0-89.306962L813.889425 680.965582c12.917614-23.124124 22.964647-47.683538 30.300576-73.678243l76.229871 0c34.765924 0 62.833827-28.227379 62.833827-62.833827L983.253699 481.619685C983.253699 447.013238 955.02632 418.785859 920.419872 418.785859M512 701.538078c-104.138296 0-188.50148-84.363183-188.50148-188.50148 0-104.138296 84.363183-188.50148 188.50148-188.50148 104.138296 0 188.50148 84.363183 188.50148 188.50148C700.50148 617.174895 616.138296 701.538078 512 701.538078M512 418.785859c-51.98941 0-94.25074 42.26133-94.25074 94.25074 0 51.98941 42.26133 94.25074 94.25074 94.25074 51.98941 0 94.25074-42.26133 94.25074-94.25074C606.25074 461.047189 563.98941 418.785859 512 418.785859" p-id="2401" /></svg>
|
||||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -6,6 +6,7 @@ import '@/assets/css/base.css'
|
|||||||
import '@/assets/css/common.css'
|
import '@/assets/css/common.css'
|
||||||
|
|
||||||
import 'element-plus/theme-chalk/el-message.css'
|
import 'element-plus/theme-chalk/el-message.css'
|
||||||
|
import 'element-plus/theme-chalk/el-message-box.css'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|||||||
307
ui/src/pages/system/RoleManagement.vue
Normal file
307
ui/src/pages/system/RoleManagement.vue
Normal file
@@ -0,0 +1,307 @@
|
|||||||
|
<template>
|
||||||
|
<el-button bg style="background-color: white" :loading="tableLoading" @click="loadRoleTable">
|
||||||
|
<template #icon>
|
||||||
|
<el-icon>
|
||||||
|
<icon-pinnacle-refresh />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" @click="handleAddBtn">
|
||||||
|
<template #icon>
|
||||||
|
<el-icon>
|
||||||
|
<icon-pinnacle-plus />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
<template #default> 添加 </template>
|
||||||
|
</el-button>
|
||||||
|
<el-table
|
||||||
|
:data="roleTable"
|
||||||
|
v-loading="tableLoading"
|
||||||
|
element-loading-text="Loading..."
|
||||||
|
style="margin-top: 10px"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" />
|
||||||
|
<el-table-column type="index" label="序号" />
|
||||||
|
<el-table-column prop="name" label="名称" />
|
||||||
|
<el-table-column prop="menus" label="权限">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row.powers.length === 0" type="info">无</el-tag>
|
||||||
|
<el-tag v-for="(power, index) in scope.row.powers" :key="index">{{ power }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button size="small" @click="handleEdit(scope.$index, scope.row)"
|
||||||
|
>编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-dialog
|
||||||
|
:title="dialogTitle"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
draggable
|
||||||
|
v-model="dialogVisible"
|
||||||
|
@open="handleDialogOpen"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
|
<el-form label-width="80px" v-loading="dialogLoading">
|
||||||
|
<el-form-item label="角色名称" required>
|
||||||
|
<el-input autocomplete="off" v-model="inputRoleName" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角色权限">
|
||||||
|
<el-tree
|
||||||
|
:data="powerTree"
|
||||||
|
node-key="powerId"
|
||||||
|
:props="powerProps"
|
||||||
|
show-checkbox
|
||||||
|
:render-after-expand="false"
|
||||||
|
:default-checked-keys="defaultSelectedPower"
|
||||||
|
@check-change="handleSelectedPowerChange"
|
||||||
|
/></el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
<template #footer>
|
||||||
|
<el-button type="primary" @click="handleSubmit" :disabled="dialogLoading"
|
||||||
|
>提交</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="handleCancel">取消</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import request from '@/services'
|
||||||
|
import {
|
||||||
|
DATABASE_DELETE_OK,
|
||||||
|
DATABASE_SAVE_OK,
|
||||||
|
DATABASE_SELECT_OK
|
||||||
|
} from '@/constants/Common.constants'
|
||||||
|
import _ from 'lodash'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'RoleManagement',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
tableLoading: true,
|
||||||
|
dialogLoading: true,
|
||||||
|
roleTable: [],
|
||||||
|
powerTree: [],
|
||||||
|
powerProps: {
|
||||||
|
label: 'name',
|
||||||
|
children: 'children'
|
||||||
|
},
|
||||||
|
inputRoleName: '',
|
||||||
|
selectedPower: new Set(),
|
||||||
|
isAddNew: true,
|
||||||
|
defaultSelectedPower: [],
|
||||||
|
dialogTitle: '',
|
||||||
|
editRoleId: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadRoleTable() {
|
||||||
|
this.tableLoading = true
|
||||||
|
request.get('/role').then((res) => {
|
||||||
|
const response = res.data
|
||||||
|
if (response.code === DATABASE_SELECT_OK) {
|
||||||
|
const roles = response.data
|
||||||
|
for (const role of roles) {
|
||||||
|
role.powers = []
|
||||||
|
const menus = role.menus
|
||||||
|
const elements = role.elements
|
||||||
|
const operations = role.operations
|
||||||
|
for (const operation of operations) {
|
||||||
|
const element = _.find(elements, { id: operation.elementId })
|
||||||
|
if (element.operations === undefined) {
|
||||||
|
element.operations = []
|
||||||
|
}
|
||||||
|
element.operations.push(operation)
|
||||||
|
}
|
||||||
|
for (const element of elements) {
|
||||||
|
const menu = _.find(menus, { id: element.menuId })
|
||||||
|
if (menu.elements === undefined) {
|
||||||
|
menu.elements = []
|
||||||
|
}
|
||||||
|
menu.elements.push(element)
|
||||||
|
|
||||||
|
const operas = []
|
||||||
|
_(element.operations).forEach((value) => {
|
||||||
|
operas.push(value.name)
|
||||||
|
})
|
||||||
|
role.powers.push(`${menu.name}/${element.name}/${_.join(operas, ';')}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.roleTable = roles
|
||||||
|
this.tableLoading = false
|
||||||
|
} else {
|
||||||
|
ElMessage.error({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>查询出错</strong>: ' + response.msg
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDialogOpen() {
|
||||||
|
this.getPowerTree()
|
||||||
|
|
||||||
|
if (this.isAddNew) {
|
||||||
|
this.defaultSelectedPower = []
|
||||||
|
this.inputRoleName = ''
|
||||||
|
this.selectedPower.clear()
|
||||||
|
this.dialogTitle = '添加角色'
|
||||||
|
} else {
|
||||||
|
this.dialogTitle = '编辑角色'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getPowerTree() {
|
||||||
|
this.dialogLoading = true
|
||||||
|
request.get('/power').then((res) => {
|
||||||
|
const response = res.data
|
||||||
|
if (response.code === DATABASE_SELECT_OK) {
|
||||||
|
const data = response.data
|
||||||
|
const menuList = data.menuList
|
||||||
|
const elementList = data.elementList
|
||||||
|
const operationList = data.operationList
|
||||||
|
for (const operation of operationList) {
|
||||||
|
const element = _.find(elementList, { id: operation.elementId })
|
||||||
|
if (element.children === undefined) {
|
||||||
|
element.children = []
|
||||||
|
}
|
||||||
|
element.children.push(operation)
|
||||||
|
}
|
||||||
|
for (const element of elementList) {
|
||||||
|
const menu = _.find(menuList, { id: element.menuId })
|
||||||
|
if (menu.children === undefined) {
|
||||||
|
menu.children = []
|
||||||
|
}
|
||||||
|
menu.children.push(element)
|
||||||
|
}
|
||||||
|
this.powerTree = data.menuList
|
||||||
|
this.dialogLoading = false
|
||||||
|
} else {
|
||||||
|
ElMessage.error({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>查询出错</strong>: ' + response.msg
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSelectedPowerChange(data, checked, indeterminate) {
|
||||||
|
if (checked || indeterminate) {
|
||||||
|
this.selectedPower.add(data.powerId)
|
||||||
|
} else {
|
||||||
|
this.selectedPower.delete(data.powerId)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleAddBtn() {
|
||||||
|
this.isAddNew = true
|
||||||
|
this.dialogVisible = true
|
||||||
|
},
|
||||||
|
handleEdit(index, row) {
|
||||||
|
this.inputRoleName = row.name
|
||||||
|
this.editRoleId = row.id
|
||||||
|
this.selectedPower.clear()
|
||||||
|
this.defaultSelectedPower = []
|
||||||
|
for (const operation of row.operations) {
|
||||||
|
this.defaultSelectedPower.push(operation.powerId)
|
||||||
|
this.selectedPower.add(operation.powerId)
|
||||||
|
}
|
||||||
|
for (const element of row.elements) {
|
||||||
|
this.selectedPower.add(element.powerId)
|
||||||
|
}
|
||||||
|
for (const menu of row.menus) {
|
||||||
|
this.selectedPower.add(menu.powerId)
|
||||||
|
}
|
||||||
|
this.isAddNew = false
|
||||||
|
this.dialogVisible = true
|
||||||
|
},
|
||||||
|
handleDelete(index, row) {
|
||||||
|
ElMessageBox.confirm('确定删除该角色吗?', '删除').then(() => {
|
||||||
|
this.tableLoading = true
|
||||||
|
request.delete('/role/' + row.id).then((res) => {
|
||||||
|
const response = res.data
|
||||||
|
if (response.code === DATABASE_DELETE_OK) {
|
||||||
|
ElMessage.success({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>删除成功</strong>'
|
||||||
|
})
|
||||||
|
this.loadRoleTable()
|
||||||
|
} else {
|
||||||
|
ElMessage.error({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>删除失败</strong>: ' + response.msg
|
||||||
|
})
|
||||||
|
this.tableLoading = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSubmit() {
|
||||||
|
this.dialogLoading = true
|
||||||
|
const roleObject = {
|
||||||
|
name: this.inputRoleName,
|
||||||
|
powers: [],
|
||||||
|
id: ''
|
||||||
|
}
|
||||||
|
for (const powerId of this.selectedPower) {
|
||||||
|
const power = {
|
||||||
|
id: powerId
|
||||||
|
}
|
||||||
|
roleObject.powers.push(power)
|
||||||
|
}
|
||||||
|
if (this.isAddNew) {
|
||||||
|
request.post('/role', roleObject).then((res) => {
|
||||||
|
const response = res.data
|
||||||
|
if (response.code === DATABASE_SAVE_OK) {
|
||||||
|
ElMessage.success({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>添加成功</strong>'
|
||||||
|
})
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.loadRoleTable()
|
||||||
|
} else {
|
||||||
|
ElMessage.error({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>添加失败</strong>: ' + response.msg
|
||||||
|
})
|
||||||
|
this.dialogLoading = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
roleObject.id = this.editRoleId
|
||||||
|
request.put('/role', roleObject).then((res) => {
|
||||||
|
const response = res.data
|
||||||
|
if (response.code === DATABASE_SAVE_OK) {
|
||||||
|
ElMessage.success({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>修改成功</strong>'
|
||||||
|
})
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.loadRoleTable()
|
||||||
|
} else {
|
||||||
|
ElMessage.error({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>修改失败</strong>: ' + response.msg
|
||||||
|
})
|
||||||
|
this.dialogLoading = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.loadRoleTable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -179,30 +179,30 @@ const router = createRouter({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/system',
|
||||||
|
name: 'systemManagement',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'role',
|
||||||
|
name: 'systemRole',
|
||||||
|
component: async () =>
|
||||||
|
await import('@/pages/system/RoleManagement.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '角色管理',
|
||||||
|
requiresScrollbar: false,
|
||||||
|
requiresPadding: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
meta: {
|
||||||
|
title: '系统管理',
|
||||||
|
icon: shallowRef(IconPinnacleSetting),
|
||||||
|
requiresScrollbar: false,
|
||||||
|
requiresPadding: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// path: '/system',
|
|
||||||
// name: 'systemManagement',
|
|
||||||
// children: [
|
|
||||||
// {
|
|
||||||
// path: 'role',
|
|
||||||
// name: 'systemRole',
|
|
||||||
// component: async () =>
|
|
||||||
// await import('@/pages/system/RoleManagement.vue'),
|
|
||||||
// meta: {
|
|
||||||
// title: '角色管理',
|
|
||||||
// requiresScrollbar: false,
|
|
||||||
// requiresPadding: true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ],
|
|
||||||
// meta: {
|
|
||||||
// title: '系统管理',
|
|
||||||
// icon: shallowRef(IconPinnacleSetting),
|
|
||||||
// requiresScrollbar: false,
|
|
||||||
// requiresPadding: true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user