Add group role tables

This commit is contained in:
2023-10-25 11:02:40 +08:00
parent 087e6ae8c3
commit 979d1d8fb8
75 changed files with 1172 additions and 30 deletions

View File

@@ -0,0 +1,43 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import java.io.Serializable
/**
* <p>
* 页面元素
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_element")
class Element : Serializable {
@TableId("id")
var id: Long? = null
/**
* 元素名
*/
@TableField("name")
var name: String? = null
/**
* 权限ID
*/
@TableField("power_id")
var powerId: Long? = null
/**
* 菜单ID
*/
@TableField("menu_id")
var menuId: Long? = null
override fun toString(): String {
return "Element(id=$id, name=$name, powerId=$powerId, menuId=$menuId)"
}
}

View File

@@ -0,0 +1,46 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.*
import java.io.Serializable
/**
* <p>
* 用户组
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_group")
class Group : Serializable {
@TableId("id")
var id: Long? = null
/**
* 用户组名
*/
@TableField("name")
var name: String? = null
/**
* 启用
*/
@TableField("enable")
var enable: Int? = null
@TableField("deleted")
@TableLogic
var deleted: Long? = null
@TableField("version")
@Version
var version: Int? = null
@TableField(exist = false)
var roles: List<Role>? = null
override fun toString(): String {
return "Group(id=$id, name=$name, enable=$enable, deleted=$deleted, version=$version, roles=$roles)"
}
}

View File

@@ -0,0 +1,49 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import java.io.Serializable
/**
* <p>
* 菜单
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_menu")
class Menu : Serializable {
@TableId("id")
var id: Long? = null
/**
* 菜单名
*/
@TableField("name")
var name: String? = null
/**
* URL
*/
@TableField("url")
var url: String? = null
/**
* 权限ID
*/
@TableField("power_id")
var powerId: Long? = null
/**
* 父ID
*/
@TableField("parent_id")
var parentId: Long? = null
override fun toString(): String {
return "Menu(id=$id, name=$name, url=$url, powerId=$powerId, parentId=$parentId)"
}
}

View File

@@ -0,0 +1,55 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import java.io.Serializable
/**
* <p>
* 功能
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_operation")
class Operation : Serializable {
@TableId("id")
var id: Long? = null
/**
* 功能名
*/
@TableField("name")
var name: String? = null
/**
* 功能编码
*/
@TableField("code")
var code: String? = null
/**
* 权限ID
*/
@TableField("power_id")
var powerId: Long? = null
/**
* 父ID
*/
@TableField("parent_id")
var parentId: Long? = null
/**
* 页面元素ID
*/
@TableField("element_id")
var elementId: Long? = null
override fun toString(): String {
return "Operation(id=$id, name=$name, code=$code, powerId=$powerId, parentId=$parentId, elementId=$elementId)"
}
}

View File

@@ -0,0 +1,31 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import java.io.Serializable
/**
* <p>
* 权限
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_power")
class Power : Serializable {
@TableId("id")
var id: Long? = null
/**
* 权限类型
*/
@TableField("type_id")
var typeId: Long? = null
override fun toString(): String {
return "Power(id=$id, typeId=$typeId)"
}
}

View File

@@ -0,0 +1,43 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.*
import java.io.Serializable
/**
* <p>
* 中间表-权限-角色
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_power_role")
class PowerRole : Serializable {
@TableId("id")
var id: Long? = null
/**
* 权限
*/
@TableField("power_id")
var powerId: Long? = null
/**
* 角色
*/
@TableField("role_id")
var roleId: Long? = null
@TableField("deleted")
@TableLogic
var deleted: Long? = null
@TableField("version")
@Version
var version: Int? = null
override fun toString(): String {
return "PowerRole(id=$id, powerId=$powerId, roleId=$roleId, deleted=$deleted, version=$version)"
}
}

View File

@@ -0,0 +1,31 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import java.io.Serializable
/**
* <p>
* 权限类型
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_power_type")
class PowerType : Serializable {
@TableId("id")
var id: Long? = null
/**
* 权限类型名
*/
@TableField("name")
var name: String? = null
override fun toString(): String {
return "PowerType(id=$id, name=$name)"
}
}

View File

@@ -0,0 +1,55 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.*
import java.io.Serializable
/**
* <p>
* 角色
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_role")
class Role : Serializable {
@TableId("id")
var id: Long? = null
/**
* 角色名
*/
@TableField("name")
var name: String? = null
/**
* 启用
*/
@TableField("enable")
var enable: Int? = null
@TableField("deleted")
@TableLogic
var deleted: Long? = null
@TableField("version")
@Version
var version: Int? = null
@TableField(exist = false)
var menus: List<Menu>? = null
@TableField(exist = false)
var elements: List<Element>? = null
@TableField(exist = false)
var operations: List<Operation>? = null
@TableField(exist = false)
var powers: List<Power>? = null
override fun toString(): String {
return "Role(id=$id, name=$name, enable=$enable, deleted=$deleted, version=$version, menus=$menus, elements=$elements, operations=$operations, powers=$powers)"
}
}

View File

@@ -0,0 +1,43 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.*
import java.io.Serializable
/**
* <p>
* 中间表-角色-用户组
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_role_group")
class RoleGroup : Serializable {
@TableId("id")
var id: Long? = null
/**
* 角色
*/
@TableField("role_id")
var roleId: Long? = null
/**
* 群组
*/
@TableField("group_id")
var groupId: Long? = null
@TableField("deleted")
@TableLogic
var deleted: Long? = null
@TableField("version")
@Version
var version: Int? = null
override fun toString(): String {
return "RoleGroup(id=$id, roleId=$roleId, groupId=$groupId, deleted=$deleted, version=$version)"
}
}

View File

@@ -92,7 +92,22 @@ class User() : Serializable {
@Version
var version: Int? = null
@TableField(exist = false)
var roles: List<Role>? = null
@TableField(exist = false)
var groups: List<Group>? = null
@TableField(exist = false)
var menus: List<Menu>? = null
@TableField(exist = false)
var elements: List<Element>? = null
@TableField(exist = false)
var operations: List<Operation>? = null
override fun toString(): String {
return "User(id=$id, username=$username, password=$password, locking=$locking, expiration=$expiration, credentialsExpiration=$credentialsExpiration, enable=$enable, lastLoginTime=$lastLoginTime, lastLoginIp=$lastLoginIp, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version)"
return "User(id=$id, username=$username, password=$password, locking=$locking, expiration=$expiration, credentialsExpiration=$credentialsExpiration, enable=$enable, lastLoginTime=$lastLoginTime, lastLoginIp=$lastLoginIp, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, roles=$roles, groups=$groups, menus=$menus, elements=$elements, operations=$operations)"
}
}

View File

@@ -0,0 +1,43 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.*
import java.io.Serializable
/**
* <p>
* 中间表-用户-用户组
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_user_group")
class UserGroup : Serializable {
@TableId("id")
var id: Long? = null
/**
* 用户
*/
@TableField("user_id")
var userId: Long? = null
/**
* 用户组
*/
@TableField("group_id")
var groupId: Long? = null
@TableField("deleted")
@TableLogic
var deleted: Long? = null
@TableField("version")
@Version
var version: Int? = null
override fun toString(): String {
return "UserGroup(id=$id, userId=$userId, groupId=$groupId, deleted=$deleted, version=$version)"
}
}

View File

@@ -0,0 +1,43 @@
package top.fatweb.api.entity.permission
import com.baomidou.mybatisplus.annotation.*
import java.io.Serializable
/**
* <p>
* 中间表-用户-角色
* </p>
*
* @author FatttSnake
* @since 2023-10-25
*/
@TableName("t_user_role")
class UserRole : Serializable {
@TableId("id")
var id: Long? = null
/**
* 用户
*/
@TableField("user_id")
var userId: Long? = null
/**
* 角色
*/
@TableField("role_id")
var roleId: Long? = null
@TableField("deleted")
@TableLogic
var deleted: Long? = null
@TableField("version")
@Version
var version: Int? = null
override fun toString(): String {
return "UserRole(id=$id, userId=$userId, roleId=$roleId, deleted=$deleted, version=$version)"
}
}