Rename table t_element to t_func
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
package top.fatweb.api.converter.permission
|
||||
|
||||
import top.fatweb.api.entity.permission.Element
|
||||
import top.fatweb.api.vo.permission.base.ElementVo
|
||||
|
||||
/**
|
||||
* Element converter
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object ElementConverter {
|
||||
fun elementToElementVo(element: Element) = ElementVo(
|
||||
id = element.id,
|
||||
name = element.name,
|
||||
parentId = element.parentId,
|
||||
menuId = element.menuId
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package top.fatweb.api.converter.permission
|
||||
|
||||
import top.fatweb.api.entity.permission.Func
|
||||
import top.fatweb.api.vo.permission.base.FuncVo
|
||||
|
||||
/**
|
||||
* Function converter
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object FuncConverter {
|
||||
fun funcToFuncVo(func: Func) = FuncVo(
|
||||
id = func.id,
|
||||
name = func.name,
|
||||
parentId = func.parentId,
|
||||
menuId = func.menuId
|
||||
)
|
||||
}
|
||||
@@ -14,6 +14,6 @@ object OperationConverter {
|
||||
id = operation.id,
|
||||
name = operation.name,
|
||||
code = operation.code,
|
||||
elementId = operation.elementId
|
||||
funcId = operation.funcId
|
||||
)
|
||||
}
|
||||
@@ -13,7 +13,7 @@ object PowerConverter {
|
||||
fun powerSetToPowerSetVo(powerSet: PowerSet) = PowerSetVo(
|
||||
moduleList = powerSet.moduleList?.map { ModuleConverter.moduleToModuleVo(it) },
|
||||
menuList = powerSet.menuList?.map { MenuConverter.menuToMenuVo(it) },
|
||||
elementList = powerSet.elementList?.map { ElementConverter.elementToElementVo(it) },
|
||||
funcList = powerSet.funcList?.map { FuncConverter.funcToFuncVo(it) },
|
||||
operationList = powerSet.operationList?.map { OperationConverter.operationToOperationVo(it) }
|
||||
)
|
||||
}
|
||||
@@ -33,7 +33,7 @@ object RoleConverter {
|
||||
updateTime = role.updateTime,
|
||||
modules = role.modules?.map { ModuleConverter.moduleToModuleVo(it) },
|
||||
menus = role.menus?.map { MenuConverter.menuToMenuVo(it) },
|
||||
elements = role.elements?.map { ElementConverter.elementToElementVo(it) },
|
||||
funcs = role.funcs?.map { FuncConverter.funcToFuncVo(it) },
|
||||
operations = role.operations?.map { OperationConverter.operationToOperationVo(it) }
|
||||
)
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ object UserConverter {
|
||||
menus = user.menus?.map {
|
||||
MenuConverter.menuToMenuVo(it)
|
||||
},
|
||||
elements = user.elements?.map {
|
||||
ElementConverter.elementToElementVo(it)
|
||||
funcs = user.funcs?.map {
|
||||
FuncConverter.funcToFuncVo(it)
|
||||
},
|
||||
operations = user.operations?.map {
|
||||
OperationConverter.operationToOperationVo(it)
|
||||
|
||||
@@ -6,19 +6,19 @@ import com.baomidou.mybatisplus.annotation.TableName
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Element entity
|
||||
* Function entity
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableName("t_element")
|
||||
class Element : Serializable {
|
||||
@TableName("t_func")
|
||||
class Func : Serializable {
|
||||
|
||||
@TableId("id")
|
||||
var id: Long? = null
|
||||
|
||||
/**
|
||||
* 元素名
|
||||
* 功能名
|
||||
*/
|
||||
@TableField("name")
|
||||
var name: String? = null
|
||||
@@ -36,6 +36,6 @@ class Element : Serializable {
|
||||
var menuId: Long? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "Element(id=$id, name=$name, parentId=$parentId, menuId=$menuId)"
|
||||
return "Func(id=$id, name=$name, parentId=$parentId, menuId=$menuId)"
|
||||
}
|
||||
}
|
||||
@@ -18,24 +18,24 @@ class Operation : Serializable {
|
||||
var id: Long? = null
|
||||
|
||||
/**
|
||||
* 功能名
|
||||
* 操作名
|
||||
*/
|
||||
@TableField("name")
|
||||
var name: String? = null
|
||||
|
||||
/**
|
||||
* 功能编码
|
||||
* 操作编码
|
||||
*/
|
||||
@TableField("code")
|
||||
var code: String? = null
|
||||
|
||||
/**
|
||||
* 页面元素ID
|
||||
* 功能ID
|
||||
*/
|
||||
@TableField("element_id")
|
||||
var elementId: Long? = null
|
||||
@TableField("func_id")
|
||||
var funcId: Long? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "Operation(id=$id, name=$name, code=$code, elementId=$elementId)"
|
||||
return "Operation(id=$id, name=$name, code=$code, funcId=$funcId)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class PowerSet : Serializable {
|
||||
|
||||
var menuList: List<Menu>? = null
|
||||
|
||||
var elementList: List<Element>? = null
|
||||
var funcList: List<Func>? = null
|
||||
|
||||
var operationList: List<Operation>? = null
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class Role : Serializable {
|
||||
var menus: List<Menu>? = null
|
||||
|
||||
@TableField(exist = false)
|
||||
var elements: List<Element>? = null
|
||||
var funcs: List<Func>? = null
|
||||
|
||||
@TableField(exist = false)
|
||||
var operations: List<Operation>? = null
|
||||
@@ -64,6 +64,6 @@ class Role : Serializable {
|
||||
var powers: List<Power>? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "Role(id=$id, name=$name, enable=$enable, deleted=$deleted, version=$version, modules=$modules, menus=$menus, elements=$elements, operations=$operations, powers=$powers)"
|
||||
return "Role(id=$id, name=$name, enable=$enable, deleted=$deleted, version=$version, modules=$modules, menus=$menus, funcs=$funcs, operations=$operations, powers=$powers)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,12 +118,12 @@ class User() : Serializable {
|
||||
var menus: List<Menu>? = null
|
||||
|
||||
@TableField(exist = false)
|
||||
var elements: List<Element>? = null
|
||||
var funcs: List<Func>? = 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, currentLoginTime=$currentLoginTime, currentLoginIp=$currentLoginIp, lastLoginTime=$lastLoginTime, lastLoginIp=$lastLoginIp, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, userInfo=$userInfo, roles=$roles, groups=$groups, modules=$modules, menus=$menus, elements=$elements, operations=$operations)"
|
||||
return "User(id=$id, username=$username, password=$password, locking=$locking, expiration=$expiration, credentialsExpiration=$credentialsExpiration, enable=$enable, currentLoginTime=$currentLoginTime, currentLoginIp=$currentLoginIp, lastLoginTime=$lastLoginTime, lastLoginIp=$lastLoginIp, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, userInfo=$userInfo, roles=$roles, groups=$groups, modules=$modules, menus=$menus, funcs=$funcs, operations=$operations)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ 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
|
||||
import top.fatweb.api.entity.permission.Func
|
||||
|
||||
/**
|
||||
* Element mapper
|
||||
* Function mapper
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Mapper
|
||||
interface ElementMapper : BaseMapper<Element>
|
||||
interface FuncMapper : BaseMapper<Func>
|
||||
@@ -1,12 +1,12 @@
|
||||
package top.fatweb.api.service.permission
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.api.entity.permission.Element
|
||||
import top.fatweb.api.entity.permission.Func
|
||||
|
||||
/**
|
||||
* Element service interface
|
||||
* Function service interface
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
interface IElementService : IService<Element>
|
||||
interface IFuncService : IService<Func>
|
||||
@@ -1,16 +0,0 @@
|
||||
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
|
||||
|
||||
/**
|
||||
* Element service implement
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Service
|
||||
class ElementServiceImpl : ServiceImpl<ElementMapper, Element>(), IElementService
|
||||
@@ -0,0 +1,16 @@
|
||||
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.Func
|
||||
import top.fatweb.api.mapper.permission.FuncMapper
|
||||
import top.fatweb.api.service.permission.IFuncService
|
||||
|
||||
/**
|
||||
* Function service implement
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Service
|
||||
class FuncServiceImpl : ServiceImpl<FuncMapper, Func>(), IFuncService
|
||||
@@ -18,13 +18,13 @@ import top.fatweb.api.service.permission.*
|
||||
class PowerServiceImpl(
|
||||
private val moduleService: IModuleService,
|
||||
private val menuService: IMenuService,
|
||||
private val elementService: IElementService,
|
||||
private val funcService: IFuncService,
|
||||
private val operationService: IOperationService
|
||||
) : ServiceImpl<PowerMapper, Power>(), IPowerService {
|
||||
override fun getList() = PowerConverter.powerSetToPowerSetVo(PowerSet().apply {
|
||||
moduleList = moduleService.list()
|
||||
menuList = menuService.list()
|
||||
elementList = elementService.list()
|
||||
funcList = funcService.list()
|
||||
operationList = operationService.list()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import top.fatweb.api.entity.permission.PowerRole
|
||||
import top.fatweb.api.entity.permission.Role
|
||||
import top.fatweb.api.mapper.permission.RoleMapper
|
||||
import top.fatweb.api.param.permission.role.*
|
||||
import top.fatweb.api.service.permission.IElementService
|
||||
import top.fatweb.api.service.permission.IFuncService
|
||||
import top.fatweb.api.service.permission.IMenuService
|
||||
import top.fatweb.api.service.permission.IPowerRoleService
|
||||
import top.fatweb.api.service.permission.IRoleService
|
||||
@@ -28,7 +28,7 @@ import top.fatweb.api.vo.permission.RoleWithPowerVo
|
||||
@Service
|
||||
class RoleServiceImpl(
|
||||
private val powerRoleService: IPowerRoleService,
|
||||
private val elementService: IElementService,
|
||||
private val funcService: IFuncService,
|
||||
private val menuService: IMenuService
|
||||
) : ServiceImpl<RoleMapper, Role>(), IRoleService {
|
||||
override fun getPage(roleGetParam: RoleGetParam?): PageVo<RoleWithPowerVo> {
|
||||
@@ -150,7 +150,7 @@ class RoleServiceImpl(
|
||||
|
||||
private fun getElementParent(id: Long, parentIds: HashSet<Long>) {
|
||||
parentIds.add(id)
|
||||
elementService.getById(id)?.parentId?.let {
|
||||
funcService.getById(id)?.parentId?.let {
|
||||
getElementParent(it, parentIds)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class UserServiceImpl(
|
||||
private val userInfoService: IUserInfoService,
|
||||
private val moduleService: IModuleService,
|
||||
private val menuService: IMenuService,
|
||||
private val elementService: IElementService,
|
||||
private val funcService: IFuncService,
|
||||
private val operationService: IOperationService,
|
||||
private val userRoleService: IUserRoleService,
|
||||
private val userGroupService: IUserGroupService
|
||||
@@ -50,7 +50,7 @@ class UserServiceImpl(
|
||||
if (user.id == 0L) {
|
||||
user.modules = moduleService.list()
|
||||
user.menus = menuService.list()
|
||||
user.elements = elementService.list()
|
||||
user.funcs = funcService.list()
|
||||
user.operations = operationService.list()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package top.fatweb.api.vo.permission
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import top.fatweb.api.vo.permission.base.ElementVo
|
||||
import top.fatweb.api.vo.permission.base.FuncVo
|
||||
import top.fatweb.api.vo.permission.base.MenuVo
|
||||
import top.fatweb.api.vo.permission.base.ModuleVo
|
||||
import top.fatweb.api.vo.permission.base.OperationVo
|
||||
@@ -20,9 +20,9 @@ data class PowerSetVo(
|
||||
@Schema(description = "菜单列表")
|
||||
val menuList: List<MenuVo>?,
|
||||
|
||||
@Schema(description = "页面元素列表")
|
||||
val elementList: List<ElementVo>?,
|
||||
|
||||
@Schema(description = "功能列表")
|
||||
val funcList: List<FuncVo>?,
|
||||
|
||||
@Schema(description = "操作列表")
|
||||
val operationList: List<OperationVo>?
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package top.fatweb.api.vo.permission
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import top.fatweb.api.vo.permission.base.ElementVo
|
||||
import top.fatweb.api.vo.permission.base.FuncVo
|
||||
import top.fatweb.api.vo.permission.base.MenuVo
|
||||
import top.fatweb.api.vo.permission.base.ModuleVo
|
||||
import top.fatweb.api.vo.permission.base.OperationVo
|
||||
@@ -38,9 +38,9 @@ data class RoleWithPowerVo(
|
||||
@Schema(description = "菜单列表")
|
||||
val menus: List<MenuVo>?,
|
||||
|
||||
@Schema(description = "页面元素列表")
|
||||
val elements: List<ElementVo>?,
|
||||
|
||||
@Schema(description = "功能列表")
|
||||
val funcs: List<FuncVo>?,
|
||||
|
||||
@Schema(description = "操作列表")
|
||||
val operations: List<OperationVo>?
|
||||
)
|
||||
|
||||
@@ -59,9 +59,9 @@ data class UserWithPowerInfoVo(
|
||||
@Schema(description = "菜单列表")
|
||||
val menus: List<MenuVo>?,
|
||||
|
||||
@Schema(description = "页面元素列表")
|
||||
val elements: List<ElementVo>?,
|
||||
|
||||
@Schema(description = "功能列表")
|
||||
val funcs: List<FuncVo>?,
|
||||
|
||||
@Schema(description = "操作列表")
|
||||
val operations: List<OperationVo>?
|
||||
)
|
||||
@@ -3,16 +3,16 @@ package top.fatweb.api.vo.permission.base
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
/**
|
||||
* Element value object
|
||||
* Function value object
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "页面元素返回参数")
|
||||
data class ElementVo(
|
||||
@Schema(description = "功能返回参数")
|
||||
data class FuncVo(
|
||||
val id: Long?,
|
||||
|
||||
@Schema(description = "元素名", example = "AddButton")
|
||||
@Schema(description = "功能名", example = "AddButton")
|
||||
val name: String?,
|
||||
|
||||
@Schema(description = "父 ID")
|
||||
@@ -8,16 +8,16 @@ import io.swagger.v3.oas.annotations.media.Schema
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "功能返回参数")
|
||||
@Schema(description = "操作返回参数")
|
||||
data class OperationVo(
|
||||
val id: Long?,
|
||||
|
||||
@Schema(description = "功能名", example = "Add User")
|
||||
@Schema(description = "操作名", example = "Add User")
|
||||
val name: String?,
|
||||
|
||||
@Schema(description = "功能编码", example = "system:user:add")
|
||||
@Schema(description = "操作编码", example = "system:user:add")
|
||||
val code: String?,
|
||||
|
||||
@Schema(description = "页面元素 ID")
|
||||
val elementId: Long?
|
||||
@Schema(description = "功能 ID")
|
||||
val funcId: Long?
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user