Add group role tables
This commit is contained in:
@@ -7,7 +7,7 @@ import org.slf4j.LoggerFactory
|
||||
import org.springframework.security.crypto.password.PasswordEncoder
|
||||
import org.springframework.stereotype.Component
|
||||
import top.fatweb.api.entity.permission.User
|
||||
import top.fatweb.api.service.IUserService
|
||||
import top.fatweb.api.service.permission.IUserService
|
||||
import kotlin.random.Random
|
||||
|
||||
@Component
|
||||
|
||||
43
src/main/kotlin/top/fatweb/api/entity/permission/Element.kt
Normal file
43
src/main/kotlin/top/fatweb/api/entity/permission/Element.kt
Normal 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)"
|
||||
}
|
||||
}
|
||||
46
src/main/kotlin/top/fatweb/api/entity/permission/Group.kt
Normal file
46
src/main/kotlin/top/fatweb/api/entity/permission/Group.kt
Normal 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)"
|
||||
}
|
||||
}
|
||||
49
src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt
Normal file
49
src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt
Normal 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)"
|
||||
}
|
||||
}
|
||||
@@ -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)"
|
||||
}
|
||||
}
|
||||
31
src/main/kotlin/top/fatweb/api/entity/permission/Power.kt
Normal file
31
src/main/kotlin/top/fatweb/api/entity/permission/Power.kt
Normal 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)"
|
||||
}
|
||||
}
|
||||
@@ -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)"
|
||||
}
|
||||
}
|
||||
@@ -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)"
|
||||
}
|
||||
}
|
||||
55
src/main/kotlin/top/fatweb/api/entity/permission/Role.kt
Normal file
55
src/main/kotlin/top/fatweb/api/entity/permission/Role.kt
Normal 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)"
|
||||
}
|
||||
}
|
||||
@@ -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)"
|
||||
}
|
||||
}
|
||||
@@ -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)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)"
|
||||
}
|
||||
}
|
||||
43
src/main/kotlin/top/fatweb/api/entity/permission/UserRole.kt
Normal file
43
src/main/kotlin/top/fatweb/api/entity/permission/UserRole.kt
Normal 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)"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.Element
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 页面元素 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface ElementMapper : BaseMapper<Element>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.Group
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户组 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface GroupMapper : BaseMapper<Group>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.Menu
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface MenuMapper : BaseMapper<Menu>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.Operation
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 功能 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface OperationMapper : BaseMapper<Operation>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.Power
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface PowerMapper : BaseMapper<Power>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.PowerRole
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-权限-角色 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface PowerRoleMapper : BaseMapper<PowerRole>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.PowerType
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限类型 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface PowerTypeMapper : BaseMapper<PowerType>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.RoleGroup
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-角色-用户组 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface RoleGroupMapper : BaseMapper<RoleGroup>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.Role
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface RoleMapper : BaseMapper<Role>
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.UserGroup
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-用户-用户组 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface UserGroupMapper : BaseMapper<UserGroup>
|
||||
@@ -1,4 +1,4 @@
|
||||
package top.fatweb.api.mapper
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.api.mapper.permission
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import top.fatweb.api.entity.permission.UserRole
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-用户-角色 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Mapper
|
||||
interface UserRoleMapper : BaseMapper<UserRole>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.Element
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 页面元素 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IElementService : IService<Element>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.Group
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户组 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IGroupService : IService<Group>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.Menu
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IMenuService : IService<Menu>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.Operation
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 功能 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IOperationService : IService<Operation>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.PowerRole
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-权限-角色 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IPowerRoleService : IService<PowerRole>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.Power
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IPowerService : IService<Power>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.PowerType
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限类型 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IPowerTypeService : IService<PowerType>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.RoleGroup
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-角色-用户组 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IRoleGroupService : IService<RoleGroup>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.Role
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IRoleService : IService<Role>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.UserGroup
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-用户-用户组 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IUserGroupService : IService<UserGroup>
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.UserRole
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-用户-角色 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
interface IUserRoleService : IService<UserRole>
|
||||
@@ -1,4 +1,4 @@
|
||||
package top.fatweb.api.service
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.User
|
||||
@@ -11,8 +11,8 @@ import top.fatweb.api.constant.SecurityConstants
|
||||
import top.fatweb.api.entity.permission.LoginUser
|
||||
import top.fatweb.api.entity.permission.User
|
||||
import top.fatweb.api.exception.TokenHasExpiredException
|
||||
import top.fatweb.api.service.IUserService
|
||||
import top.fatweb.api.service.permission.IAuthenticationService
|
||||
import top.fatweb.api.service.permission.IUserService
|
||||
import top.fatweb.api.util.JwtUtil
|
||||
import top.fatweb.api.util.RedisUtil
|
||||
import top.fatweb.api.util.WebUtil
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.Element
|
||||
import top.fatweb.api.mapper.permission.ElementMapper
|
||||
import top.fatweb.api.service.permission.IElementService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 页面元素 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class ElementServiceImpl : ServiceImpl<ElementMapper, Element>(), IElementService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.Group
|
||||
import top.fatweb.api.mapper.permission.GroupMapper
|
||||
import top.fatweb.api.service.permission.IGroupService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户组 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class GroupServiceImpl : ServiceImpl<GroupMapper, Group>(), IGroupService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.Menu
|
||||
import top.fatweb.api.mapper.permission.MenuMapper
|
||||
import top.fatweb.api.service.permission.IMenuService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class MenuServiceImpl : ServiceImpl<MenuMapper, Menu>(), IMenuService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.Operation
|
||||
import top.fatweb.api.mapper.permission.OperationMapper
|
||||
import top.fatweb.api.service.permission.IOperationService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 功能 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class OperationServiceImpl : ServiceImpl<OperationMapper, Operation>(), IOperationService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.PowerRole
|
||||
import top.fatweb.api.mapper.permission.PowerRoleMapper
|
||||
import top.fatweb.api.service.permission.IPowerRoleService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-权限-角色 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class PowerRoleServiceImpl : ServiceImpl<PowerRoleMapper, PowerRole>(), IPowerRoleService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.Power
|
||||
import top.fatweb.api.mapper.permission.PowerMapper
|
||||
import top.fatweb.api.service.permission.IPowerService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class PowerServiceImpl : ServiceImpl<PowerMapper, Power>(), IPowerService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.PowerType
|
||||
import top.fatweb.api.mapper.permission.PowerTypeMapper
|
||||
import top.fatweb.api.service.permission.IPowerTypeService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限类型 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class PowerTypeServiceImpl : ServiceImpl<PowerTypeMapper, PowerType>(), IPowerTypeService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.RoleGroup
|
||||
import top.fatweb.api.mapper.permission.RoleGroupMapper
|
||||
import top.fatweb.api.service.permission.IRoleGroupService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-角色-用户组 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class RoleGroupServiceImpl : ServiceImpl<RoleGroupMapper, RoleGroup>(), IRoleGroupService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.Role
|
||||
import top.fatweb.api.mapper.permission.RoleMapper
|
||||
import top.fatweb.api.service.permission.IRoleService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class RoleServiceImpl : ServiceImpl<RoleMapper, Role>(), IRoleService
|
||||
@@ -6,7 +6,7 @@ import org.springframework.security.core.userdetails.UserDetailsService
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.LoginUser
|
||||
import top.fatweb.api.entity.permission.User
|
||||
import top.fatweb.api.service.IUserService
|
||||
import top.fatweb.api.service.permission.IUserService
|
||||
|
||||
@Service
|
||||
class UserDetailsServiceImpl(val userService: IUserService) : UserDetailsService {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.UserGroup
|
||||
import top.fatweb.api.mapper.permission.UserGroupMapper
|
||||
import top.fatweb.api.service.permission.IUserGroupService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-用户-用户组 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class UserGroupServiceImpl : ServiceImpl<UserGroupMapper, UserGroup>(), IUserGroupService
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.UserRole
|
||||
import top.fatweb.api.mapper.permission.UserRoleMapper
|
||||
import top.fatweb.api.service.permission.IUserRoleService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中间表-用户-角色 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author FatttSnake
|
||||
* @since 2023-10-25
|
||||
*/
|
||||
@Service
|
||||
class UserRoleServiceImpl : ServiceImpl<UserRoleMapper, UserRole>(), IUserRoleService
|
||||
@@ -1,10 +1,10 @@
|
||||
package top.fatweb.api.service.impl
|
||||
package top.fatweb.api.service.permission.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.entity.permission.User
|
||||
import top.fatweb.api.mapper.UserMapper
|
||||
import top.fatweb.api.service.IUserService
|
||||
import top.fatweb.api.mapper.permission.UserMapper
|
||||
import top.fatweb.api.service.permission.IUserService
|
||||
|
||||
/**
|
||||
* <p>
|
||||
Reference in New Issue
Block a user