feat(新增): 模板生成文件
This commit is contained in:
parent
3783a74b56
commit
c8e14fca20
|
@ -0,0 +1,23 @@
|
||||||
|
package cn.bunny.dao.entity.system
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.BaseEntity
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
|
import lombok.experimental.Accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 系统菜单图标
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_menu_icon")
|
||||||
|
@Schema(name = "MenuIcon对象", title = "系统菜单图标", description = "系统菜单图标")
|
||||||
|
data class MenuIcon(
|
||||||
|
@Schema(name = "iconName", title = "icon 名称")
|
||||||
|
var iconName: String? = null,
|
||||||
|
) : BaseEntity()
|
|
@ -0,0 +1,35 @@
|
||||||
|
package cn.bunny.dao.entity.system
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.BaseEntity
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
|
import io.swagger.annotations.ApiModel
|
||||||
|
import io.swagger.annotations.ApiModelProperty
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
|
import lombok.experimental.Accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_power")
|
||||||
|
@ApiModel(value = "", description = "")
|
||||||
|
@Schema(name = "Power对象", title = "权限", description = "权限")
|
||||||
|
class Power(
|
||||||
|
@Schema(name = "parentId", title = "父级id")
|
||||||
|
var parentId: Long? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("权限编码")
|
||||||
|
var powerCode: String? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("权限名称")
|
||||||
|
var powerName: String? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("请求路径")
|
||||||
|
var requestUrl: String? = null,
|
||||||
|
) : BaseEntity()
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.bunny.dao.entity.system
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.BaseEntity
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
|
import io.swagger.annotations.ApiModel
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
|
import lombok.experimental.Accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_role")
|
||||||
|
@ApiModel(value = "", description = "")
|
||||||
|
@Schema(name = "Role对象", title = "角色", description = "角色")
|
||||||
|
class Role(
|
||||||
|
@Schema(name = "roleCode", title = "角色代码")
|
||||||
|
var roleCode: String? = null,
|
||||||
|
|
||||||
|
@Schema(name = "description", title = "描述")
|
||||||
|
var description: String? = null,
|
||||||
|
) : BaseEntity()
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.bunny.dao.entity.system
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.BaseEntity
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
|
import lombok.experimental.Accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_role_power")
|
||||||
|
@Schema(name = "RolePower对象", title = "角色权限关系", description = "角色权限关系")
|
||||||
|
class RolePower(
|
||||||
|
@Schema(name = "roleId", title = "角色id")
|
||||||
|
var roleId: String? = null,
|
||||||
|
|
||||||
|
@Schema(name = "powerId", title = "权限id")
|
||||||
|
var powerId: String? = null,
|
||||||
|
) : BaseEntity()
|
|
@ -0,0 +1,42 @@
|
||||||
|
package cn.bunny.dao.entity.system
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.BaseEntity
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
|
import io.swagger.annotations.ApiModel
|
||||||
|
import io.swagger.annotations.ApiModelProperty
|
||||||
|
import lombok.experimental.Accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 系统菜单表
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_router")
|
||||||
|
@ApiModel(value = "Router对象", description = "系统菜单表")
|
||||||
|
data class Router(
|
||||||
|
@ApiModelProperty("在项目中路径")
|
||||||
|
var routerPath: String? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("路由名称")
|
||||||
|
var routeName: String? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("父级id")
|
||||||
|
var parentId: Long? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("路由title")
|
||||||
|
var title: String? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("图标")
|
||||||
|
var icon: String? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("等级")
|
||||||
|
var routerRank: Int? = null,
|
||||||
|
|
||||||
|
@ApiModelProperty("是否显示")
|
||||||
|
var visible: Boolean? = null,
|
||||||
|
) : BaseEntity()
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.bunny.dao.entity.system
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
|
import lombok.experimental.Accessors
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 路由和权限关系表
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_router_power")
|
||||||
|
@Schema(name = "RouterPower对象", title = "路由和权限关系表", description = "路由和权限关系表")
|
||||||
|
data class RouterPower(
|
||||||
|
@Schema(name = "routerId", title = "路由ID")
|
||||||
|
var routerId: Long? = null,
|
||||||
|
|
||||||
|
@Schema(name = "powerId", title = "角色ID")
|
||||||
|
var powerId: Long? = null,
|
||||||
|
) : Serializable
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.bunny.dao.entity.system
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.BaseEntity
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
|
import lombok.experimental.Accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_router_role")
|
||||||
|
@Schema(name = "RouterRole对象", title = "路由角色关系", description = "路由角色关系")
|
||||||
|
data class RouterRole(
|
||||||
|
@Schema(name = "routerId", title = "路由ID")
|
||||||
|
var routerId: Long? = null,
|
||||||
|
|
||||||
|
@Schema(name = "roleId", title = "角色ID")
|
||||||
|
var roleId: Long? = null,
|
||||||
|
) : BaseEntity()
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.bunny.dao.entity.system
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.BaseEntity
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
|
import lombok.experimental.Accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_user_role")
|
||||||
|
@Schema(name = "UserRole对象", title = "用户角色关系", description = "用户角色关系")
|
||||||
|
class UserRole(
|
||||||
|
@Schema(name = "userId", title = "用户id")
|
||||||
|
var userId: String? = null,
|
||||||
|
|
||||||
|
@Schema(name = "roleId", title = "角色id")
|
||||||
|
var roleId: String? = null,
|
||||||
|
) : BaseEntity()
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/power")
|
||||||
|
public class PowerController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/role")
|
||||||
|
public class RoleController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rolePower")
|
||||||
|
public class RolePowerController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 路由和权限关系表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/routerPower")
|
||||||
|
public class RouterPowerController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/routerRole")
|
||||||
|
public class RouterRoleController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/userRole")
|
||||||
|
public class UserRoleController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.Power;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface PowerMapper extends BaseMapper<Power> {
|
||||||
|
/**
|
||||||
|
* * 根据用户id查询当前用户所有角色
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
List<Power> selectListByUserId(long userId);
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.Role;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RoleMapper extends BaseMapper<Role> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 根据用户id查询当前用户所有角色
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
List<Role> selectListByUserId(long userId);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RolePower;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RolePowerMapper extends BaseMapper<RolePower> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RouterPower;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 路由和权限关系表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RouterPowerMapper extends BaseMapper<RouterPower> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RouterRole;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RouterRoleMapper extends BaseMapper<RouterRole> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.UserRole;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface UserRoleMapper extends BaseMapper<UserRole> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.Power;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
public interface PowerService extends IService<Power> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RolePower;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
public interface RolePowerService extends IService<RolePower> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.Role;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RouterPower;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 路由和权限关系表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
public interface RouterPowerService extends IService<RouterPower> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RouterRole;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
public interface RouterRoleService extends IService<RouterRole> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.UserRole;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
public interface UserRoleService extends IService<UserRole> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.Power;
|
||||||
|
import cn.bunny.services.mapper.PowerMapper;
|
||||||
|
import cn.bunny.services.service.PowerService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PowerServiceImpl extends ServiceImpl<PowerMapper, Power> implements PowerService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RolePower;
|
||||||
|
import cn.bunny.services.mapper.RolePowerMapper;
|
||||||
|
import cn.bunny.services.service.RolePowerService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RolePowerServiceImpl extends ServiceImpl<RolePowerMapper, RolePower> implements RolePowerService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.Role;
|
||||||
|
import cn.bunny.services.mapper.RoleMapper;
|
||||||
|
import cn.bunny.services.service.RoleService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RouterPower;
|
||||||
|
import cn.bunny.services.mapper.RouterPowerMapper;
|
||||||
|
import cn.bunny.services.service.RouterPowerService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 路由和权限关系表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RouterPowerServiceImpl extends ServiceImpl<RouterPowerMapper, RouterPower> implements RouterPowerService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.RouterRole;
|
||||||
|
import cn.bunny.services.mapper.RouterRoleMapper;
|
||||||
|
import cn.bunny.services.service.RouterRoleService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RouterRoleServiceImpl extends ServiceImpl<RouterRoleMapper, RouterRole> implements RouterRoleService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.UserRole;
|
||||||
|
import cn.bunny.services.mapper.UserRoleMapper;
|
||||||
|
import cn.bunny.services.service.UserRoleService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-09-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?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="cn.bunny.services.mapper.PowerMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.Power">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="parent_id" property="parentId"/>
|
||||||
|
<result column="power_code" property="powerCode"/>
|
||||||
|
<result column="power_name" property="powerName"/>
|
||||||
|
<result column="request_url" property="requestUrl"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
<result column="create_user" property="createUser"/>
|
||||||
|
<result column="update_user" property="updateUser"/>
|
||||||
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, parent_id, power_code, power_name, request_url, create_time, update_time, create_user, update_user, is_deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 根据用户id查询当前用户所有角色 -->
|
||||||
|
<select id="selectListByUserId" resultType="cn.bunny.dao.entity.system.Power">
|
||||||
|
SELECT p.*
|
||||||
|
FROM sys_user u,
|
||||||
|
sys_user_role ur,
|
||||||
|
sys_role_power rp,
|
||||||
|
sys_power p
|
||||||
|
WHERE u.id = ur.user_id
|
||||||
|
AND ur.role_id = rp.role_id
|
||||||
|
AND rp.power_id = p.id
|
||||||
|
AND u.id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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="cn.bunny.services.mapper.RoleMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.Role">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="role_code" property="roleCode"/>
|
||||||
|
<result column="description" property="description"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
<result column="create_user" property="createUser"/>
|
||||||
|
<result column="update_user" property="updateUser"/>
|
||||||
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, role_code, description, create_time, update_time, create_user, update_user, is_deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 根据用户id查询当前用户所有角色 -->
|
||||||
|
<select id="selectListByUserId" resultType="cn.bunny.dao.entity.system.Role">
|
||||||
|
SELECT r.*
|
||||||
|
FROM sys_user u,
|
||||||
|
sys_role r,
|
||||||
|
sys_user_role ur
|
||||||
|
WHERE u.id = ur.user_id
|
||||||
|
AND r.id = ur.role_id
|
||||||
|
AND r.id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?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="cn.bunny.services.mapper.RolePowerMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.RolePower">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="role_id" property="roleId"/>
|
||||||
|
<result column="power_id" property="powerId"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
<result column="create_user" property="createUser"/>
|
||||||
|
<result column="update_user" property="updateUser"/>
|
||||||
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, role_id, power_id, create_time, update_time, create_user, update_user, is_deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?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="cn.bunny.services.mapper.RouterPowerMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.RouterPower">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="router_id" property="routerId"/>
|
||||||
|
<result column="power_id" property="powerId"/>
|
||||||
|
<result column="create_user" property="createUser"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
<result column="update_user" property="updateUser"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, router_id, power_id, create_user, update_time, update_user, create_time, is_deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?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="cn.bunny.services.mapper.RouterRoleMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.RouterRole">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="router_id" property="routerId"/>
|
||||||
|
<result column="role_id" property="roleId"/>
|
||||||
|
<result column="create_user" property="createUser"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
<result column="update_user" property="updateUser"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, router_id, role_id, create_user, update_time, update_user, create_time, is_deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?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="cn.bunny.services.mapper.UserRoleMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.UserRole">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="user_id" property="userId"/>
|
||||||
|
<result column="role_id" property="roleId"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
<result column="create_user" property="createUser"/>
|
||||||
|
<result column="update_user" property="updateUser"/>
|
||||||
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, user_id, role_id, create_time, update_time, create_user, update_user, is_deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cn.bunny.services.service.impl
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.system.AdminUser
|
||||||
|
import cn.bunny.services.mapper.UserMapper
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@RunWith(SpringRunner::class)
|
||||||
|
class UserServiceImplTest {
|
||||||
|
@Autowired
|
||||||
|
private lateinit var userMapper: UserMapper
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun updateUser() {
|
||||||
|
val adminUser = AdminUser()
|
||||||
|
adminUser.id = 1
|
||||||
|
adminUser.lastLoginIpAddress = "内网IP"
|
||||||
|
userMapper.updateById(adminUser)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue