feat: 项目结构重构
This commit is contained in:
@ -1,65 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-modules</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dolphin-module-auth</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- 项目依赖 -->
|
||||
<dependency>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-common-security</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-common-mybatis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-module-rbac</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- Spring Boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<!-- MyBatis Flex -->
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@ -1,8 +0,0 @@
|
||||
package day.gitlab.dolphin.auth.constants;
|
||||
|
||||
public class Exceptions {
|
||||
|
||||
public static final String USERNAME_OR_PASSWORD_INCORRECT = "00010101";
|
||||
|
||||
public static final String USER_NOT_ENABLED = "00010102";
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package day.gitlab.dolphin.auth.controller;
|
||||
|
||||
import day.gitlab.dolphin.auth.entity.dto.LoginDTO;
|
||||
import day.gitlab.dolphin.auth.entity.vo.LoginVO;
|
||||
import day.gitlab.dolphin.auth.entity.vo.UserInfoVO;
|
||||
import day.gitlab.dolphin.auth.service.AuthService;
|
||||
import day.gitlab.dolphin.common.core.entity.Result;
|
||||
import day.gitlab.dolphin.common.security.annotation.AuthorityIgnore;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
|
||||
@Resource
|
||||
private AuthService authService;
|
||||
|
||||
@AuthorityIgnore
|
||||
@PostMapping("/login")
|
||||
public Result<LoginVO> login(@RequestBody LoginDTO loginDTO) {
|
||||
return Result.success(authService.login(loginDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/getUserInfo")
|
||||
public Result<UserInfoVO> getUserInfo() {
|
||||
return Result.success(authService.getUserInfo());
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
package day.gitlab.dolphin.auth.entity.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginDTO {
|
||||
|
||||
@NotNull
|
||||
private String username;
|
||||
|
||||
@NotNull
|
||||
private String password;
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package day.gitlab.dolphin.auth.entity.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LoginVO {
|
||||
|
||||
private String accessToken;
|
||||
|
||||
private String refreshToken;
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package day.gitlab.dolphin.auth.entity.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserInfoVO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String username;
|
||||
|
||||
private List<String> authorities;
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package day.gitlab.dolphin.auth.service;
|
||||
|
||||
import day.gitlab.dolphin.auth.entity.dto.LoginDTO;
|
||||
import day.gitlab.dolphin.auth.entity.vo.LoginVO;
|
||||
import day.gitlab.dolphin.auth.entity.vo.UserInfoVO;
|
||||
|
||||
public interface AuthService {
|
||||
|
||||
LoginVO login(LoginDTO loginDTO);
|
||||
|
||||
UserInfoVO getUserInfo();
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
package day.gitlab.dolphin.auth.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.auth.constants.Exceptions;
|
||||
import day.gitlab.dolphin.auth.entity.dto.LoginDTO;
|
||||
import day.gitlab.dolphin.auth.entity.vo.LoginVO;
|
||||
import day.gitlab.dolphin.auth.entity.vo.UserInfoVO;
|
||||
import day.gitlab.dolphin.auth.service.AuthService;
|
||||
import day.gitlab.dolphin.common.core.i18n.MessagesHelper;
|
||||
import day.gitlab.dolphin.common.core.util.BCrypt;
|
||||
import day.gitlab.dolphin.common.security.Authentication;
|
||||
import day.gitlab.dolphin.common.security.AuthenticationProvider;
|
||||
import day.gitlab.dolphin.common.security.SecurityContextHolder;
|
||||
import day.gitlab.dolphin.common.security.UserPrincipal;
|
||||
import day.gitlab.dolphin.common.security.jwt.JwtInfo;
|
||||
import day.gitlab.dolphin.rbac.constants.UserEnabled;
|
||||
import day.gitlab.dolphin.rbac.entity.Role;
|
||||
import day.gitlab.dolphin.rbac.entity.User;
|
||||
import day.gitlab.dolphin.rbac.mapper.UserMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class AuthServiceImpl implements AuthService, AuthenticationProvider {
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Resource
|
||||
private MessagesHelper messagesHelper;
|
||||
|
||||
@Resource
|
||||
private JwtInfo jwtInfo;
|
||||
|
||||
@Override
|
||||
public LoginVO login(LoginDTO loginDTO) {
|
||||
User dbUser = userMapper.findByUsername(loginDTO.getUsername());
|
||||
if (dbUser == null || !BCrypt.checkpw(loginDTO.getPassword(), dbUser.getPassword())) {
|
||||
throw messagesHelper.newBusinessException(Exceptions.USERNAME_OR_PASSWORD_INCORRECT);
|
||||
}
|
||||
if (!UserEnabled.ENABLED.equals(dbUser.getEnabled())) {
|
||||
throw messagesHelper.newBusinessException(Exceptions.USER_NOT_ENABLED);
|
||||
}
|
||||
|
||||
return LoginVO.builder()
|
||||
.accessToken(jwtInfo.generateAccessToken(dbUser.getId()))
|
||||
.refreshToken(jwtInfo.generateRefreshToken(dbUser.getId()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserInfoVO getUserInfo() {
|
||||
Authentication authentication = SecurityContextHolder.getAuthentication();
|
||||
return UserInfoVO.builder()
|
||||
.id(authentication.getUserPrincipal().getId())
|
||||
.username(authentication.getUserPrincipal().getNickname())
|
||||
.authorities(authentication.getUserAuthorities())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPrincipal getUserPrincipal(String userId) {
|
||||
User user = userMapper.selectOneById(userId);
|
||||
|
||||
return UserPrincipal.builder()
|
||||
.id(user.getId())
|
||||
.username(user.getUsername())
|
||||
.nickname(user.getNickname())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUserAuthorities(String userId) {
|
||||
User user = userMapper.selectOneWithRelationsById(userId);
|
||||
|
||||
List<Role> roles = user.getRoles();
|
||||
if (roles == null || roles.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return roles.stream().map(Role::getCode).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@ -1,60 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-modules</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dolphin-module-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>dolphin-module-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- 项目依赖 -->
|
||||
<!-- Project -->
|
||||
<dependency>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-common-security</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-common-mybatis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- Spring Boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<!-- MyBatis Flex -->
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
package day.gitlab.dolphin.core.constants;
|
||||
|
||||
public class Exceptions {
|
||||
|
||||
public static final String FIELD_REQUIRED = "00020101";
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
package day.gitlab.dolphin.core.controller;
|
||||
|
||||
import day.gitlab.dolphin.common.core.entity.PageResponse;
|
||||
import day.gitlab.dolphin.common.core.entity.QueryPageRequest;
|
||||
import day.gitlab.dolphin.common.core.entity.Result;
|
||||
import day.gitlab.dolphin.common.security.annotation.AuthorityCheck;
|
||||
import day.gitlab.dolphin.common.security.annotation.AuthorityType;
|
||||
import day.gitlab.dolphin.core.entity.dto.DictionaryDTO;
|
||||
import day.gitlab.dolphin.core.entity.vo.DictionaryVO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import day.gitlab.dolphin.core.service.DictionaryService;
|
||||
|
||||
/**
|
||||
* 字典 控制层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dictionary")
|
||||
public class DictionaryController {
|
||||
|
||||
@Resource
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
/**
|
||||
* 分页查询字典。
|
||||
*
|
||||
* @param pageRequest 分页请求参数
|
||||
* @return 分页对象
|
||||
*/
|
||||
@PostMapping("page")
|
||||
public Result<PageResponse<DictionaryVO>> page(@RequestBody QueryPageRequest<DictionaryDTO> pageRequest) {
|
||||
return Result.success(dictionaryService.page(pageRequest));
|
||||
}
|
||||
|
||||
@PostMapping("add")
|
||||
@AuthorityCheck(type = AuthorityType.OR, value = {"ROLE00001"})
|
||||
public Result<Void> add(@RequestBody DictionaryDTO dictionaryDTO) {
|
||||
dictionaryService.add(dictionaryDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("edit")
|
||||
@AuthorityCheck(type = AuthorityType.OR, value = {"ROLE00001"})
|
||||
public Result<Void> edit(@RequestBody DictionaryDTO dictionaryDTO) {
|
||||
dictionaryService.edit(dictionaryDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("delete")
|
||||
@AuthorityCheck(type = AuthorityType.OR, value = {"ROLE00001"})
|
||||
public Result<Void> delete(@RequestBody DictionaryDTO dictionaryDTO) {
|
||||
dictionaryService.delete(dictionaryDTO.getId());
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("deleteBatch")
|
||||
@AuthorityCheck(type = AuthorityType.OR, value = {"ROLE00001"})
|
||||
public Result<Void> deleteBatch(@RequestBody DictionaryDTO dictionaryDTO) {
|
||||
dictionaryService.deleteBatch(dictionaryDTO.getIds());
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.core.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 字典项 控制层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dictionaryItem")
|
||||
public class DictionaryItemController {
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
package day.gitlab.dolphin.core.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
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_core_dictionary")
|
||||
public class Dictionary implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字典代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 字典类型: enum-枚举、tree-树型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 字典描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
package day.gitlab.dolphin.core.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_core_dictionary_item")
|
||||
public class DictionaryItem implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典ID
|
||||
*/
|
||||
private String dictionaryId;
|
||||
|
||||
/**
|
||||
* 父级ID,如果为空则为根节点
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 字典项名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字典项代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 字典项排序,升序排列
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 字典项描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
package day.gitlab.dolphin.core.entity.dto;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DictionarySearchParamsDTO {
|
||||
|
||||
@Min(1)
|
||||
@NotNull
|
||||
private Long current;
|
||||
|
||||
@Min(1)
|
||||
@NotNull
|
||||
private Long size;
|
||||
|
||||
private String name;
|
||||
|
||||
private String code;
|
||||
|
||||
private String type;
|
||||
}
|
||||
@ -1,92 +0,0 @@
|
||||
package day.gitlab.dolphin.core.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 DictionaryItemTableDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典项
|
||||
*/
|
||||
public static final DictionaryItemTableDef DICTIONARY_ITEM = new DictionaryItemTableDef();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
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");
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
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");
|
||||
|
||||
/**
|
||||
* 字典ID
|
||||
*/
|
||||
public final QueryColumn DICTIONARY_ID = new QueryColumn(this, "dictionary_id");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, DICTIONARY_ID, PARENT_ID, NAME, CODE, SORT, DESCRIPTION, CREATE_TIME, UPDATE_TIME};
|
||||
|
||||
public DictionaryItemTableDef() {
|
||||
super("", "sys_core_dictionary_item");
|
||||
}
|
||||
|
||||
private DictionaryItemTableDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public DictionaryItemTableDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new DictionaryItemTableDef("", "sys_core_dictionary_item", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
package day.gitlab.dolphin.core.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 DictionaryTableDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典
|
||||
*/
|
||||
public static final DictionaryTableDef DICTIONARY = new DictionaryTableDef();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 字典代码
|
||||
*/
|
||||
public final QueryColumn CODE = new QueryColumn(this, "code");
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
public final QueryColumn NAME = new QueryColumn(this, "name");
|
||||
|
||||
/**
|
||||
* 字典类型: enum-枚举、tree-树型
|
||||
*/
|
||||
public final QueryColumn TYPE = new QueryColumn(this, "type");
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
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, TYPE, DESCRIPTION, CREATE_TIME, UPDATE_TIME};
|
||||
|
||||
public DictionaryTableDef() {
|
||||
super("", "sys_core_dictionary");
|
||||
}
|
||||
|
||||
private DictionaryTableDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public DictionaryTableDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new DictionaryTableDef("", "sys_core_dictionary", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package day.gitlab.dolphin.core.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import day.gitlab.dolphin.core.entity.DictionaryItem;
|
||||
|
||||
/**
|
||||
* 字典项 映射层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictionaryItemMapper extends BaseMapper<DictionaryItem> {
|
||||
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
package day.gitlab.dolphin.core.mapper;
|
||||
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import day.gitlab.dolphin.common.core.entity.QueryPageRequest;
|
||||
import day.gitlab.dolphin.common.mybatis.Pages;
|
||||
import day.gitlab.dolphin.core.entity.dto.DictionaryDTO;
|
||||
import day.gitlab.dolphin.core.entity.table.DictionaryTableDef;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import day.gitlab.dolphin.core.entity.Dictionary;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 字典 映射层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictionaryMapper extends BaseMapper<Dictionary> {
|
||||
|
||||
default Page<Dictionary> page(QueryPageRequest<DictionaryDTO> pageRequest) {
|
||||
return Pages.paginate(this, pageRequest, (dict, wrapper) -> {
|
||||
if (StringUtils.hasText(dict.getName())) {
|
||||
wrapper.and(DictionaryTableDef.DICTIONARY.NAME.like(dict.getName()));
|
||||
}
|
||||
if (StringUtils.hasText(dict.getCode())) {
|
||||
wrapper.and(DictionaryTableDef.DICTIONARY.CODE.like(dict.getCode()));
|
||||
}
|
||||
if (StringUtils.hasText(dict.getType())) {
|
||||
wrapper.and(DictionaryTableDef.DICTIONARY.TYPE.eq(dict.getType()));
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package day.gitlab.dolphin.core.service;
|
||||
|
||||
/**
|
||||
* 字典项 服务层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public interface DictionaryItemService {
|
||||
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
package day.gitlab.dolphin.core.service;
|
||||
|
||||
import day.gitlab.dolphin.common.core.entity.PageResponse;
|
||||
import day.gitlab.dolphin.common.core.entity.QueryPageRequest;
|
||||
import day.gitlab.dolphin.core.entity.dto.DictionaryDTO;
|
||||
import day.gitlab.dolphin.core.entity.vo.DictionaryVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典 服务层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public interface DictionaryService {
|
||||
|
||||
PageResponse<DictionaryVO> page(QueryPageRequest<DictionaryDTO> pageRequest);
|
||||
|
||||
void add(DictionaryDTO dictionaryDTO);
|
||||
|
||||
void edit(DictionaryDTO dictionaryDTO);
|
||||
|
||||
void delete(String id);
|
||||
|
||||
void deleteBatch(List<String> ids);
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package day.gitlab.dolphin.core.service.impl;
|
||||
|
||||
import day.gitlab.dolphin.core.service.DictionaryItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 字典项 服务层实现。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Service
|
||||
public class DictionaryItemServiceImpl implements DictionaryItemService {
|
||||
|
||||
}
|
||||
@ -1,112 +0,0 @@
|
||||
package day.gitlab.dolphin.core.service.impl;
|
||||
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import day.gitlab.dolphin.common.core.entity.PageResponse;
|
||||
import day.gitlab.dolphin.common.core.entity.QueryPageRequest;
|
||||
import day.gitlab.dolphin.common.core.i18n.MessagesHelper;
|
||||
import day.gitlab.dolphin.common.mybatis.Pages;
|
||||
import day.gitlab.dolphin.core.constants.Exceptions;
|
||||
import day.gitlab.dolphin.core.entity.Dictionary;
|
||||
import day.gitlab.dolphin.core.entity.dto.DictionaryDTO;
|
||||
import day.gitlab.dolphin.core.entity.vo.DictionaryVO;
|
||||
import day.gitlab.dolphin.core.mapper.DictionaryMapper;
|
||||
import day.gitlab.dolphin.core.service.DictionaryService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典 服务层实现。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Service
|
||||
public class DictionaryServiceImpl implements DictionaryService {
|
||||
|
||||
@Resource
|
||||
private DictionaryMapper dictionaryMapper;
|
||||
|
||||
@Resource
|
||||
private MessagesHelper messagesHelper;
|
||||
|
||||
@Override
|
||||
public PageResponse<DictionaryVO> page(QueryPageRequest<DictionaryDTO> pageRequest) {
|
||||
Page<Dictionary> page = dictionaryMapper.page(pageRequest);
|
||||
|
||||
return Pages.toPageResponse(page, (rec) -> {
|
||||
DictionaryVO vo = new DictionaryVO();
|
||||
vo.setId(rec.getId());
|
||||
vo.setName(rec.getName());
|
||||
vo.setCode(rec.getCode());
|
||||
vo.setType(rec.getType());
|
||||
vo.setDescription(rec.getDescription());
|
||||
vo.setCreateTime(rec.getCreateTime());
|
||||
vo.setUpdateTime(rec.getUpdateTime());
|
||||
return vo;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(DictionaryDTO dictionaryDTO) {
|
||||
validate(dictionaryDTO);
|
||||
|
||||
Dictionary dict = Dictionary.builder()
|
||||
.name(dictionaryDTO.getName())
|
||||
.code(dictionaryDTO.getCode())
|
||||
.type(dictionaryDTO.getType())
|
||||
.description(dictionaryDTO.getDescription())
|
||||
.createTime(Timestamp.from(Instant.now()))
|
||||
.updateTime(Timestamp.from(Instant.now()))
|
||||
.build();
|
||||
dictionaryMapper.insert(dict);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(DictionaryDTO dictionaryDTO) {
|
||||
validate(dictionaryDTO);
|
||||
|
||||
Dictionary dict = Dictionary.builder()
|
||||
.id(dictionaryDTO.getId())
|
||||
.name(dictionaryDTO.getName())
|
||||
.code(dictionaryDTO.getCode())
|
||||
.type(dictionaryDTO.getType())
|
||||
.description(dictionaryDTO.getDescription())
|
||||
.updateTime(Timestamp.from(Instant.now()))
|
||||
.build();
|
||||
dictionaryMapper.update(dict);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
dictionaryMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBatch(List<String> ids) {
|
||||
dictionaryMapper.deleteBatchByIds(ids);
|
||||
}
|
||||
|
||||
private void validate(DictionaryDTO dictionaryDTO) {
|
||||
List<String> fields = new ArrayList<>();
|
||||
|
||||
if (!StringUtils.hasText(dictionaryDTO.getName())) {
|
||||
fields.add("name");
|
||||
}
|
||||
if (!StringUtils.hasText(dictionaryDTO.getCode())) {
|
||||
fields.add("code");
|
||||
}
|
||||
if (!StringUtils.hasText(dictionaryDTO.getType())) {
|
||||
fields.add("type");
|
||||
}
|
||||
|
||||
if (!fields.isEmpty()) {
|
||||
throw messagesHelper.newBusinessException(Exceptions.FIELD_REQUIRED, String.join(",", fields));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package day.gitlab.dolphin.module.core.controller;
|
||||
|
||||
import day.gitlab.dolphin.common.web.entity.ApiResponse;
|
||||
import day.gitlab.dolphin.common.web.entity.PageRequest;
|
||||
import day.gitlab.dolphin.common.web.entity.PageResponse;
|
||||
import day.gitlab.dolphin.module.core.controller.dto.DictionaryDTO;
|
||||
import day.gitlab.dolphin.module.core.controller.vo.DictionaryVO;
|
||||
import day.gitlab.dolphin.module.core.service.DictionaryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/dictionary")
|
||||
public class DictionaryController {
|
||||
|
||||
private final DictionaryService dictionaryService;
|
||||
|
||||
@PostMapping("/paginate")
|
||||
public ApiResponse<PageResponse<DictionaryVO>> paginate(@RequestBody PageRequest<DictionaryDTO> pageRequest) {
|
||||
return ApiResponse.success(dictionaryService.paginate(pageRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public ApiResponse<Boolean> update(@RequestBody DictionaryDTO record) {
|
||||
return ApiResponse.success(dictionaryService.update(record));
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ApiResponse<Boolean> delete(@RequestBody DictionaryDTO record) {
|
||||
return ApiResponse.success(dictionaryService.delete(record));
|
||||
}
|
||||
|
||||
@PostMapping("/insert")
|
||||
public ApiResponse<Boolean> insert(@RequestBody DictionaryDTO record) {
|
||||
return ApiResponse.success(dictionaryService.insert(record));
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,10 @@
|
||||
package day.gitlab.dolphin.core.entity.dto;
|
||||
package day.gitlab.dolphin.module.core.controller.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DictionaryDTO {
|
||||
@ -22,6 +18,4 @@ public class DictionaryDTO {
|
||||
private String type;
|
||||
|
||||
private String description;
|
||||
|
||||
private List<String> ids;
|
||||
}
|
||||
@ -1,14 +1,15 @@
|
||||
package day.gitlab.dolphin.core.entity.vo;
|
||||
package day.gitlab.dolphin.module.core.controller.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DictionaryVO {
|
||||
@ -0,0 +1,31 @@
|
||||
package day.gitlab.dolphin.module.core.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("sys_core_dictionary")
|
||||
public class Dictionary {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String code;
|
||||
|
||||
private String type;
|
||||
|
||||
private String description;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private Timestamp updateTime;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package day.gitlab.dolphin.module.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import day.gitlab.dolphin.module.core.entity.Dictionary;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DictionaryMapper extends BaseMapper<Dictionary> {
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package day.gitlab.dolphin.module.core.service;
|
||||
|
||||
import day.gitlab.dolphin.common.web.entity.PageRequest;
|
||||
import day.gitlab.dolphin.common.web.entity.PageResponse;
|
||||
import day.gitlab.dolphin.module.core.controller.dto.DictionaryDTO;
|
||||
import day.gitlab.dolphin.module.core.controller.vo.DictionaryVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictionaryService {
|
||||
|
||||
PageResponse<DictionaryVO> paginate(PageRequest<DictionaryDTO> pageRequest);
|
||||
|
||||
boolean update(DictionaryDTO record);
|
||||
|
||||
boolean delete(DictionaryDTO record);
|
||||
|
||||
boolean insert(DictionaryDTO record);
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package day.gitlab.dolphin.module.core.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import day.gitlab.dolphin.common.core.util.Strings;
|
||||
import day.gitlab.dolphin.common.mybatis.util.Pages;
|
||||
import day.gitlab.dolphin.common.web.entity.PageRequest;
|
||||
import day.gitlab.dolphin.common.web.entity.PageResponse;
|
||||
import day.gitlab.dolphin.module.core.controller.dto.DictionaryDTO;
|
||||
import day.gitlab.dolphin.module.core.controller.vo.DictionaryVO;
|
||||
import day.gitlab.dolphin.module.core.entity.Dictionary;
|
||||
import day.gitlab.dolphin.module.core.mapper.DictionaryMapper;
|
||||
import day.gitlab.dolphin.module.core.service.DictionaryService;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DictionaryServiceImpl implements DictionaryService {
|
||||
|
||||
@NonNull
|
||||
private final DictionaryMapper dictionaryMapper;
|
||||
|
||||
@Override
|
||||
public PageResponse<DictionaryVO> paginate(PageRequest<DictionaryDTO> pageRequest) {
|
||||
Page<Dictionary> paginate = Pages.paginate(pageRequest, dictionaryMapper, (dto, wrapper) -> {
|
||||
if (Strings.isNotBlank(dto.getName())) {
|
||||
wrapper.like("name", dto.getName());
|
||||
}
|
||||
if (Strings.isNotBlank(dto.getCode())) {
|
||||
wrapper.eq("code", dto.getCode());
|
||||
}
|
||||
if (Strings.isNotBlank(dto.getType())) {
|
||||
wrapper.eq("type", dto.getType());
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
});
|
||||
|
||||
return Pages.toPageResponse(paginate, (record) -> {
|
||||
DictionaryVO dictionaryVO = new DictionaryVO();
|
||||
BeanUtils.copyProperties(record, dictionaryVO);
|
||||
return dictionaryVO;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(DictionaryDTO record) {
|
||||
Dictionary dictionary = dictionaryMapper.selectById(record.getId());
|
||||
if (dictionary != null) {
|
||||
if (Strings.isNotBlank(dictionary.getName())) {
|
||||
dictionary.setName(dictionary.getName());
|
||||
}
|
||||
if (Strings.isNotBlank(dictionary.getCode())) {
|
||||
dictionary.setCode(dictionary.getCode());
|
||||
}
|
||||
if (Strings.isNotBlank(dictionary.getType())) {
|
||||
dictionary.setType(dictionary.getType());
|
||||
}
|
||||
if (Strings.isNotBlank(dictionary.getDescription())) {
|
||||
dictionary.setDescription(dictionary.getDescription());
|
||||
}
|
||||
dictionary.setUpdateTime(Timestamp.from(Instant.now()));
|
||||
return dictionaryMapper.updateById(dictionary) == 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(DictionaryDTO record) {
|
||||
Dictionary dictionary = dictionaryMapper.selectById(record.getId());
|
||||
if (dictionary != null) {
|
||||
return dictionaryMapper.deleteById(dictionary.getId()) == 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insert(DictionaryDTO record) {
|
||||
Dictionary dictionary = new Dictionary();
|
||||
BeanUtils.copyProperties(record, dictionary);
|
||||
dictionary.setCreateTime(Timestamp.from(Instant.now()));
|
||||
dictionary.setUpdateTime(Timestamp.from(Instant.now()));
|
||||
return dictionaryMapper.insert(dictionary) == 1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
<?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.core.mapper.DictionaryMapper">
|
||||
<!--
|
||||
<resultMap id="BaseResultMap" type="day.gitlab.dolphin.module.core.entity.Dictionary">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="name" property="name" jdbcType="VARCHAR"/>
|
||||
<result column="code" property="code" jdbcType="VARCHAR"/>
|
||||
<result column="type" property="type" jdbcType="VARCHAR"/>
|
||||
<result column="description" property="description" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="day.gitlab.dolphin.module.core.entity.Dictionary">
|
||||
INSERT INTO sys_core_dictionary(id, name, code, type, description)
|
||||
VALUES (
|
||||
#{id, jdbcType=VARCHAR},
|
||||
#{name, jdbcType=VARCHAR},
|
||||
#{code, jdbcType=VARCHAR},
|
||||
#{type, jdbcType=VARCHAR},
|
||||
#{description, jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="delete" parameterType="java.lang.String">
|
||||
DELETE FROM sys_core_dictionary
|
||||
WHERE id = #{id, jdbcType=VARCHAR}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatch" parameterType="java.util.List">
|
||||
DELETE FROM sys_core_dictionary
|
||||
WHERE id IN
|
||||
<foreach collection="list" item="id" open="(" separator=", " close=")">
|
||||
#{id, jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="update" parameterType="day.gitlab.dolphin.module.core.entity.Dictionary">
|
||||
UPDATE sys_core_dictionary
|
||||
<set>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name, jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="code != null and code != ''">
|
||||
code = #{code, jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
type = #{type, jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description, jdbcType=VARCHAR},
|
||||
</if>
|
||||
update_time = CURRENT_TIMESTAMP
|
||||
</set>
|
||||
WHERE id = #{id, jdbcType=VARCHAR}
|
||||
</update>-->
|
||||
</mapper>
|
||||
@ -1,60 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-modules</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dolphin-module-rbac</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>dolphin-module-rbac</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- 项目依赖 -->
|
||||
<!-- Project -->
|
||||
<dependency>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-common-security</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-common-mybatis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- Spring Boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<!-- MyBatis Flex -->
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -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>
|
||||
@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>day.gitlab</groupId>
|
||||
<artifactId>dolphin-backend</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dolphin-modules</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<artifactId>dolphin-modules</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>dolphin-module-core</module>
|
||||
<module>dolphin-module-rbac</module>
|
||||
<module>dolphin-module-auth</module>
|
||||
</modules>
|
||||
<modules>
|
||||
<module>dolphin-module-core</module>
|
||||
<module>dolphin-module-rbac</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user