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.security.crypto.password.PasswordEncoder
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import top.fatweb.api.entity.permission.User
|
import top.fatweb.api.entity.permission.User
|
||||||
import top.fatweb.api.service.IUserService
|
import top.fatweb.api.service.permission.IUserService
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
@Component
|
@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
|
@Version
|
||||||
var version: Int? = null
|
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 {
|
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 com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||||
import org.apache.ibatis.annotations.Mapper
|
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 com.baomidou.mybatisplus.extension.service.IService
|
||||||
import top.fatweb.api.entity.permission.User
|
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.LoginUser
|
||||||
import top.fatweb.api.entity.permission.User
|
import top.fatweb.api.entity.permission.User
|
||||||
import top.fatweb.api.exception.TokenHasExpiredException
|
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.IAuthenticationService
|
||||||
|
import top.fatweb.api.service.permission.IUserService
|
||||||
import top.fatweb.api.util.JwtUtil
|
import top.fatweb.api.util.JwtUtil
|
||||||
import top.fatweb.api.util.RedisUtil
|
import top.fatweb.api.util.RedisUtil
|
||||||
import top.fatweb.api.util.WebUtil
|
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 org.springframework.stereotype.Service
|
||||||
import top.fatweb.api.entity.permission.LoginUser
|
import top.fatweb.api.entity.permission.LoginUser
|
||||||
import top.fatweb.api.entity.permission.User
|
import top.fatweb.api.entity.permission.User
|
||||||
import top.fatweb.api.service.IUserService
|
import top.fatweb.api.service.permission.IUserService
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
class UserDetailsServiceImpl(val userService: IUserService) : UserDetailsService {
|
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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import top.fatweb.api.entity.permission.User
|
import top.fatweb.api.entity.permission.User
|
||||||
import top.fatweb.api.mapper.UserMapper
|
import top.fatweb.api.mapper.permission.UserMapper
|
||||||
import top.fatweb.api.service.IUserService
|
import top.fatweb.api.service.permission.IUserService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -41,9 +41,9 @@ on duplicate key update name = values(name),
|
|||||||
|
|
||||||
insert into t_element(id, name, power_id, menu_id)
|
insert into t_element(id, name, power_id, menu_id)
|
||||||
values (1010100, '公用', id, 1010000),
|
values (1010100, '公用', id, 1010000),
|
||||||
(101010100, '基础', id, 101010000),
|
(101010100, '角色基础', id, 101010000),
|
||||||
(102010100, '基础', id, 102010000),
|
(102010100, '用户组基础', id, 102010000),
|
||||||
(103010100, '基础', id, 103010000)
|
(103010100, '用户基础', id, 103010000)
|
||||||
on duplicate key update name = values(name),
|
on duplicate key update name = values(name),
|
||||||
power_id=values(power_id),
|
power_id=values(power_id),
|
||||||
menu_id = values(menu_id);
|
menu_id = values(menu_id);
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ drop table if exists t_power;
|
|||||||
|
|
||||||
create table if not exists t_power
|
create table if not exists t_power
|
||||||
(
|
(
|
||||||
`id` bigint not null primary key,
|
id bigint not null primary key,
|
||||||
`type_id` bigint not null comment '权限类型'
|
type_id bigint not null comment '权限类型'
|
||||||
) comment '权限';
|
) comment '权限';
|
||||||
@@ -2,9 +2,9 @@ drop table if exists t_menu;
|
|||||||
|
|
||||||
create table if not exists t_menu
|
create table if not exists t_menu
|
||||||
(
|
(
|
||||||
`id` bigint not null primary key,
|
id bigint not null primary key,
|
||||||
`name` varchar(30) not null comment ' 菜单名',
|
name varchar(30) not null comment ' 菜单名',
|
||||||
`url` varchar(100) null comment 'URL',
|
url varchar(100) null comment 'URL',
|
||||||
`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'
|
||||||
) comment '菜单';
|
) comment '菜单';
|
||||||
@@ -2,8 +2,8 @@ drop table if exists t_element;
|
|||||||
|
|
||||||
create table if not exists t_element
|
create table if not exists t_element
|
||||||
(
|
(
|
||||||
`id` bigint not null primary key,
|
id bigint not null primary key,
|
||||||
`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',
|
||||||
`menu_id` bigint not null comment '菜单ID'
|
menu_id bigint not null comment '菜单ID'
|
||||||
) comment '页面元素';
|
) comment '页面元素';
|
||||||
@@ -2,10 +2,10 @@ drop table if exists t_operation;
|
|||||||
|
|
||||||
create table if not exists t_operation
|
create table if not exists t_operation
|
||||||
(
|
(
|
||||||
`id` bigint not null primary key,
|
id bigint not null primary key,
|
||||||
`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',
|
||||||
`element_id` bigint not null comment '页面元素ID'
|
element_id bigint not null comment '页面元素ID'
|
||||||
) comment '功能';
|
) comment '功能';
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
drop table if exists t_group;
|
||||||
|
|
||||||
|
create table if not exists t_group
|
||||||
|
(
|
||||||
|
id bigint not null primary key,
|
||||||
|
name varchar(30) not null comment '用户组名',
|
||||||
|
enable int not null comment '启用',
|
||||||
|
deleted bigint not null default 0,
|
||||||
|
version int not null default 0,
|
||||||
|
constraint t_group_unique unique (name, deleted)
|
||||||
|
) comment '用户组';
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
drop table if exists t_user_group;
|
||||||
|
|
||||||
|
create table if not exists t_user_group
|
||||||
|
(
|
||||||
|
id bigint not null primary key,
|
||||||
|
user_id bigint not null comment '用户',
|
||||||
|
group_id bigint not null comment '用户组',
|
||||||
|
deleted bigint not null default 0,
|
||||||
|
version int not null default 0
|
||||||
|
) comment '中间表-用户-用户组';
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
drop table if exists t_role;
|
||||||
|
|
||||||
|
create table if not exists t_role
|
||||||
|
(
|
||||||
|
id bigint not null primary key,
|
||||||
|
name varchar(20) not null comment '角色名',
|
||||||
|
enable int not null comment '启用',
|
||||||
|
deleted bigint not null default 0,
|
||||||
|
version int not null default 0,
|
||||||
|
constraint t_role_unique unique (name, deleted)
|
||||||
|
) comment '角色';
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
drop table if exists t_role_group;
|
||||||
|
|
||||||
|
create table if not exists t_role_group
|
||||||
|
(
|
||||||
|
id bigint not null primary key,
|
||||||
|
role_id bigint not null comment '角色',
|
||||||
|
group_id bigint not null comment '群组',
|
||||||
|
deleted bigint not null default 0,
|
||||||
|
version int not null default 0
|
||||||
|
) comment '中间表-角色-用户组';
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
drop table if exists t_user_role;
|
||||||
|
|
||||||
|
create table if not exists t_user_role
|
||||||
|
(
|
||||||
|
id bigint not null primary key,
|
||||||
|
user_id bigint not null comment '用户',
|
||||||
|
role_id bigint not null comment '角色',
|
||||||
|
deleted bigint not null default 0,
|
||||||
|
version int not null default 0
|
||||||
|
) comment '中间表-用户-角色';
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
drop table if exists t_power_role;
|
||||||
|
|
||||||
|
create table if not exists t_power_role
|
||||||
|
(
|
||||||
|
id bigint not null primary key,
|
||||||
|
power_id bigint not null comment '权限',
|
||||||
|
role_id bigint not null comment '角色',
|
||||||
|
deleted bigint not null default 0,
|
||||||
|
version int not null default 0
|
||||||
|
) comment '中间表-权限-角色';
|
||||||
5
src/main/resources/mapper/permission/ElementMapper.xml
Normal file
5
src/main/resources/mapper/permission/ElementMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.ElementMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/GroupMapper.xml
Normal file
5
src/main/resources/mapper/permission/GroupMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.GroupMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/MenuMapper.xml
Normal file
5
src/main/resources/mapper/permission/MenuMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.MenuMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/OperationMapper.xml
Normal file
5
src/main/resources/mapper/permission/OperationMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.OperationMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/PowerMapper.xml
Normal file
5
src/main/resources/mapper/permission/PowerMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.PowerMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/PowerRoleMapper.xml
Normal file
5
src/main/resources/mapper/permission/PowerRoleMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.PowerRoleMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/PowerTypeMapper.xml
Normal file
5
src/main/resources/mapper/permission/PowerTypeMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.PowerTypeMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/RoleGroupMapper.xml
Normal file
5
src/main/resources/mapper/permission/RoleGroupMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.RoleGroupMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/RoleMapper.xml
Normal file
5
src/main/resources/mapper/permission/RoleMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.RoleMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/UserGroupMapper.xml
Normal file
5
src/main/resources/mapper/permission/UserGroupMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.UserGroupMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="top.fatweb.api.mapper.UserMapper">
|
<mapper namespace="top.fatweb.api.mapper.permission.UserMapper">
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
5
src/main/resources/mapper/permission/UserRoleMapper.xml
Normal file
5
src/main/resources/mapper/permission/UserRoleMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="top.fatweb.api.mapper.permission.UserRoleMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user