feat: 项目结构重构
This commit is contained in:
@ -0,0 +1,59 @@
|
||||
package day.gitlab.dolphin.module.rbac.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 部门表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value ="sys_rbac_department")
|
||||
public class Department {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 区划ID
|
||||
*/
|
||||
private String regionId;
|
||||
|
||||
/**
|
||||
* 上级部门ID
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 部门代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 部门排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -1,37 +1,20 @@
|
||||
package day.gitlab.dolphin.rbac.entity;
|
||||
package day.gitlab.dolphin.module.rbac.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 区划项 实体类。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
* 区划项
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("sys_rbac_region")
|
||||
public class Region implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableName(value ="sys_rbac_region")
|
||||
public class Region {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
@ -82,11 +65,10 @@ public class Region implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package day.gitlab.dolphin.module.rbac.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 角色表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value ="sys_rbac_role")
|
||||
public class Role {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 角色排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package day.gitlab.dolphin.module.rbac.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
|
||||
import day.gitlab.dolphin.module.rbac.enums.UserEnabled;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value ="sys_rbac_user")
|
||||
public class User {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 是否启用:0-未启用/1-启用
|
||||
*/
|
||||
private UserEnabled enabled;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package day.gitlab.dolphin.module.rbac.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum UserEnabled implements IEnum<String> {
|
||||
|
||||
ENABLED("1"),
|
||||
DISABLED("0");
|
||||
|
||||
private final String value;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package day.gitlab.dolphin.module.rbac.mapper;
|
||||
|
||||
import day.gitlab.dolphin.module.rbac.entity.Department;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_department(部门表)】的数据库操作Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface DepartmentMapper extends BaseMapper<Department> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package day.gitlab.dolphin.module.rbac.mapper;
|
||||
|
||||
import day.gitlab.dolphin.module.rbac.entity.Region;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_region(区划项)】的数据库操作Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface RegionMapper extends BaseMapper<Region> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package day.gitlab.dolphin.module.rbac.mapper;
|
||||
|
||||
import day.gitlab.dolphin.module.rbac.entity.Role;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_role(角色表)】的数据库操作Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleMapper extends BaseMapper<Role> {
|
||||
|
||||
List<Role> findAllByUserId(String userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package day.gitlab.dolphin.module.rbac.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import day.gitlab.dolphin.module.rbac.entity.User;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_user(用户表)】的数据库操作Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
default User findByUsername(String username) {
|
||||
LambdaQueryWrapper<User> wrapper = Wrappers.<User>lambdaQuery()
|
||||
.eq(User::getUsername, username);
|
||||
return selectOne(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
package day.gitlab.dolphin.module.rbac.service;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_department(部门表)】的数据库操作Service
|
||||
*/
|
||||
public interface DepartmentService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package day.gitlab.dolphin.module.rbac.service;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_region(区划项)】的数据库操作Service
|
||||
*/
|
||||
public interface RegionService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package day.gitlab.dolphin.module.rbac.service;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_role(角色表)】的数据库操作Service
|
||||
*/
|
||||
public interface RoleService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package day.gitlab.dolphin.module.rbac.service;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_user(用户表)】的数据库操作Service
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package day.gitlab.dolphin.module.rbac.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.module.rbac.service.DepartmentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_department(部门表)】的数据库操作Service实现
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentServiceImpl implements DepartmentService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package day.gitlab.dolphin.module.rbac.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.module.rbac.service.RegionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_region(区划项)】的数据库操作Service实现
|
||||
*/
|
||||
@Service
|
||||
public class RegionServiceImpl implements RegionService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package day.gitlab.dolphin.module.rbac.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.module.rbac.service.RoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_role(角色表)】的数据库操作Service实现
|
||||
*/
|
||||
@Service
|
||||
public class RoleServiceImpl implements RoleService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package day.gitlab.dolphin.module.rbac.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.module.rbac.service.UserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 针对表【sys_rbac_user(用户表)】的数据库操作Service实现
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.constants;
|
||||
|
||||
public class UserEnabled {
|
||||
|
||||
public static final String ENABLED = "1";
|
||||
|
||||
public static final String DISABLED = "0";
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 部门表 控制层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department")
|
||||
public class DepartmentController {
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.controller;
|
||||
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import day.gitlab.dolphin.rbac.entity.Region;
|
||||
import day.gitlab.dolphin.rbac.service.RegionService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区划项 控制层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/region")
|
||||
public class RegionController {
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 角色表 控制层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/role")
|
||||
public class RoleController {
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 用户表 控制层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 部门表 实体类。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("sys_rbac_department")
|
||||
public class Department implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 区划ID
|
||||
*/
|
||||
private String regionId;
|
||||
|
||||
/**
|
||||
* 上级部门ID
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 部门代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 部门排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 角色表 实体类。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("sys_rbac_role")
|
||||
public class Role implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 角色排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
@ -1,78 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.RelationOneToMany;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 用户表 实体类。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("sys_rbac_user")
|
||||
public class User implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 是否启用:0-未启用/1-启用
|
||||
*/
|
||||
private String enabled;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
@RelationOneToMany(joinTable = "sys_rbac_user_role",
|
||||
selfField = "id", joinSelfColumn = "user_id",
|
||||
targetField = "id", joinTargetColumn = "role_id")
|
||||
private List<Role> roles;
|
||||
}
|
||||
@ -1,92 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.entity.table;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 部门表 表定义层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public class DepartmentTableDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 部门表
|
||||
*/
|
||||
public static final DepartmentTableDef DEPARTMENT = new DepartmentTableDef();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 部门代码
|
||||
*/
|
||||
public final QueryColumn CODE = new QueryColumn(this, "code");
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
public final QueryColumn NAME = new QueryColumn(this, "name");
|
||||
|
||||
/**
|
||||
* 部门排序
|
||||
*/
|
||||
public final QueryColumn SORT = new QueryColumn(this, "sort");
|
||||
|
||||
/**
|
||||
* 上级部门ID
|
||||
*/
|
||||
public final QueryColumn PARENT_ID = new QueryColumn(this, "parent_id");
|
||||
|
||||
/**
|
||||
* 区划ID
|
||||
*/
|
||||
public final QueryColumn REGION_ID = new QueryColumn(this, "region_id");
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public final QueryColumn DESCRIPTION = new QueryColumn(this, "description");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, REGION_ID, PARENT_ID, NAME, CODE, SORT, DESCRIPTION, CREATE_TIME, UPDATE_TIME};
|
||||
|
||||
public DepartmentTableDef() {
|
||||
super("", "sys_rbac_department");
|
||||
}
|
||||
|
||||
private DepartmentTableDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public DepartmentTableDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new DepartmentTableDef("", "sys_rbac_department", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,107 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.entity.table;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 区划项 表定义层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public class RegionTableDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 区划项
|
||||
*/
|
||||
public static final RegionTableDef REGION = new RegionTableDef();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 区划代码
|
||||
*/
|
||||
public final QueryColumn CODE = new QueryColumn(this, "code");
|
||||
|
||||
/**
|
||||
* 区划名称
|
||||
*/
|
||||
public final QueryColumn NAME = new QueryColumn(this, "name");
|
||||
|
||||
/**
|
||||
* 区划排序
|
||||
*/
|
||||
public final QueryColumn SORT = new QueryColumn(this, "sort");
|
||||
|
||||
/**
|
||||
* 主区划ID
|
||||
*/
|
||||
public final QueryColumn ROOT_ID = new QueryColumn(this, "root_id");
|
||||
|
||||
/**
|
||||
* 区划扩展代码
|
||||
*/
|
||||
public final QueryColumn EXT_CODE = new QueryColumn(this, "ext_code");
|
||||
|
||||
/**
|
||||
* 上级区划ID
|
||||
*/
|
||||
public final QueryColumn PARENT_ID = new QueryColumn(this, "parent_id");
|
||||
|
||||
/**
|
||||
* 主区划代码
|
||||
*/
|
||||
public final QueryColumn ROOT_CODE = new QueryColumn(this, "root_code");
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
|
||||
|
||||
/**
|
||||
* 上级区划代码
|
||||
*/
|
||||
public final QueryColumn PARENT_CODE = new QueryColumn(this, "parent_code");
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");
|
||||
|
||||
/**
|
||||
* 区划描述
|
||||
*/
|
||||
public final QueryColumn DESCRIPTION = new QueryColumn(this, "description");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, PARENT_ID, PARENT_CODE, ROOT_ID, ROOT_CODE, NAME, CODE, EXT_CODE, SORT, DESCRIPTION, CREATE_TIME, UPDATE_TIME};
|
||||
|
||||
public RegionTableDef() {
|
||||
super("", "sys_rbac_region");
|
||||
}
|
||||
|
||||
private RegionTableDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public RegionTableDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new RegionTableDef("", "sys_rbac_region", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.entity.table;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 角色表 表定义层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public class RoleTableDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色表
|
||||
*/
|
||||
public static final RoleTableDef ROLE = new RoleTableDef();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 角色代码
|
||||
*/
|
||||
public final QueryColumn CODE = new QueryColumn(this, "code");
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
public final QueryColumn NAME = new QueryColumn(this, "name");
|
||||
|
||||
/**
|
||||
* 角色排序
|
||||
*/
|
||||
public final QueryColumn SORT = new QueryColumn(this, "sort");
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public final QueryColumn DESCRIPTION = new QueryColumn(this, "description");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, NAME, CODE, SORT, DESCRIPTION, CREATE_TIME, UPDATE_TIME};
|
||||
|
||||
public RoleTableDef() {
|
||||
super("", "sys_rbac_role");
|
||||
}
|
||||
|
||||
private RoleTableDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public RoleTableDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new RoleTableDef("", "sys_rbac_role", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,87 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.entity.table;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户表 表定义层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public class UserTableDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户表
|
||||
*/
|
||||
public static final UserTableDef USER = new UserTableDef();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 是否启用:0-未启用/1-启用
|
||||
*/
|
||||
public final QueryColumn ENABLED = new QueryColumn(this, "enabled");
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
public final QueryColumn NICKNAME = new QueryColumn(this, "nickname");
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
public final QueryColumn PASSWORD = new QueryColumn(this, "password");
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
public final QueryColumn USERNAME = new QueryColumn(this, "username");
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public final QueryColumn DESCRIPTION = new QueryColumn(this, "description");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, USERNAME, NICKNAME, PASSWORD, ENABLED, DESCRIPTION, CREATE_TIME, UPDATE_TIME};
|
||||
|
||||
public UserTableDef() {
|
||||
super("", "sys_rbac_user");
|
||||
}
|
||||
|
||||
private UserTableDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public UserTableDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new UserTableDef("", "sys_rbac_user", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import day.gitlab.dolphin.rbac.entity.Department;
|
||||
|
||||
/**
|
||||
* 部门表 映射层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface DepartmentMapper extends BaseMapper<Department> {
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import day.gitlab.dolphin.rbac.entity.Region;
|
||||
|
||||
/**
|
||||
* 区划项 映射层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface RegionMapper extends BaseMapper<Region> {
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import day.gitlab.dolphin.rbac.entity.Role;
|
||||
|
||||
/**
|
||||
* 角色表 映射层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleMapper extends BaseMapper<Role> {
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.mapper;
|
||||
|
||||
import com.mybatisflex.core.query.QueryCondition;
|
||||
import day.gitlab.dolphin.rbac.entity.table.UserTableDef;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import day.gitlab.dolphin.rbac.entity.User;
|
||||
|
||||
/**
|
||||
* 用户表 映射层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
default User findByUsername(String username) {
|
||||
QueryCondition queryCondition = UserTableDef.USER.USERNAME.eq(username);
|
||||
return selectOneByCondition(queryCondition);
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.service;
|
||||
|
||||
/**
|
||||
* 部门表 服务层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public interface DepartmentService {
|
||||
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.service;
|
||||
|
||||
/**
|
||||
* 区划项 服务层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public interface RegionService {
|
||||
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.service;
|
||||
|
||||
/**
|
||||
* 角色表 服务层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public interface RoleService {
|
||||
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.service;
|
||||
|
||||
/**
|
||||
* 用户表 服务层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.rbac.service.DepartmentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 部门表 服务层实现。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentServiceImpl implements DepartmentService {
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.rbac.service.RegionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 区划项 服务层实现。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Service
|
||||
public class RegionServiceImpl implements RegionService {
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.rbac.service.RoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 角色表 服务层实现。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Service
|
||||
public class RoleServiceImpl implements RoleService {
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.rbac.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.rbac.service.UserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户表 服务层实现。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
}
|
||||
@ -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="day.gitlab.dolphin.module.rbac.mapper.RoleMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="day.gitlab.dolphin.module.rbac.entity.Role">
|
||||
<id property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="code" column="code" />
|
||||
<result property="sort" column="sort" />
|
||||
<result property="description" column="description" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findAllByUserId" resultMap="BaseResultMap">
|
||||
SELECT t2.* FROM sys_rbac_user_role t1
|
||||
LEFT JOIN sys_rbac_role t2 ON t1.role_id = t2.id
|
||||
WHERE t1.user_id = #{userId, jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user