Initial project source

这个提交包含在:
apple
2026-11-20 15:32:57 +08:00
当前提交 fb47c07f7c
共修改 8405 个文件,包含 806907 行新增和 0 行删除
+26
查看文件
@@ -0,0 +1,26 @@
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
FROM bellsoft/liberica-openjdk-rocky:21.0.12-cds
# FROM bellsoft/liberica-openjdk-rocky:25.0.4-cds
# FROM findepi/graalvm:java21-native
LABEL maintainer="AiXun Technology <343559364@qq.com>"
RUN mkdir -p /aixun-admin/system/logs \
/aixun-admin/system/temp \
/aixun-admin/skywalking/agent
WORKDIR /aixun-admin/system
ENV SERVER_PORT=9201 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_GC_OPTS="-XX:+UseZGC" JAVA_OPTS=""
EXPOSE ${SERVER_PORT}
ADD ./target/aixun-system.jar ./app.jar
SHELL ["/bin/bash", "-c"]
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
#-Dskywalking.agent.service_name=aixun-system \
#-javaagent:/aixun-admin/skywalking/agent/skywalking-agent.jar \
-XX:+HeapDumpOnOutOfMemoryError ${JAVA_GC_OPTS} ${JAVA_OPTS} \
-jar app.jar
+135
查看文件
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-modules</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>aixun-system</artifactId>
<description>
aixun-system系统模块
</description>
<dependencies>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-nacos</artifactId>
</dependency>
<!-- AiXun Common Log -->
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-log</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-service-impl</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-doc</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-web</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-mybatis</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-dubbo</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-seata</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-security</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-translation</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-sensitive</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-encrypt</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-common-excel</artifactId>
</dependency>
<!-- AiXun Api System -->
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-api-system</artifactId>
</dependency>
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-api-resource</artifactId>
</dependency>
<!-- AiXun Api System -->
<dependency>
<groupId>cn.aixunkeji</groupId>
<artifactId>aixun-api-workflow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,21 @@
package cn.aixunkeji.system;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
/**
* 系统模块
*
*/
@EnableDubbo
@SpringBootApplication
public class AiXunSystemApplication {
public static void main(String[] args) {
SpringApplication application = new SpringApplication(AiXunSystemApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ ");
}
}
@@ -0,0 +1,64 @@
package cn.aixunkeji.system.controller.monitor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.utils.StringUtils;
import org.redisson.spring.data.connection.RedissonConnectionFactory;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisConnectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
/**
* 缓存监控
*
*/
@RequiredArgsConstructor
@RestController
@RequestMapping("/cache")
public class CacheController {
private final RedissonConnectionFactory connectionFactory;
/**
* 获取缓存监控列表
*/
@SaCheckPermission("monitor:cache:list")
@GetMapping()
public R<CacheListInfoVo> getInfo() throws Exception {
RedisConnection connection = connectionFactory.getConnection();
try {
Properties commandStats = connection.commands().info("commandstats");
List<Map<String, String>> pieList = new ArrayList<>();
if (commandStats != null) {
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
}
return R.ok(new CacheListInfoVo(
connection.commands().info(),
connection.commands().dbSize(), pieList));
} finally {
// 归还连接给连接池
RedisConnectionUtils.releaseConnection(connection, connectionFactory);
}
}
/**
* 缓存监控列表信息
*
* @param info 信息
* @param dbSize 数据库
* @param commandStats 命令统计
*/
public record CacheListInfoVo(Properties info, Long dbSize, List<Map<String, String>> commandStats) {}
}
@@ -0,0 +1,93 @@
package cn.aixunkeji.system.controller.monitor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.lock.annotation.Lock4j;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.constant.CacheNames;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.redis.utils.RedisUtils;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysLoginInfoBo;
import cn.aixunkeji.system.domain.vo.SysLoginInfoVo;
import cn.aixunkeji.system.service.ISysLoginInfoService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 系统访问记录
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/loginInfo")
public class SysLoginInfoController extends BaseController {
private final ISysLoginInfoService loginInfoService;
/**
* 获取系统访问记录列表
*/
@SaCheckPermission("monitor:logininfo:list")
@GetMapping("/list")
public R<PageResult<SysLoginInfoVo>> list(SysLoginInfoBo loginInfo, PageQuery pageQuery) {
return R.ok(loginInfoService.selectPageLoginInfoList(loginInfo, pageQuery));
}
/**
* 导出系统访问记录列表
*/
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@SaCheckPermission("monitor:logininfo:export")
@PostMapping("/export")
public void export(SysLoginInfoBo loginInfo, HttpServletResponse response) {
List<SysLoginInfoVo> list = loginInfoService.selectLoginInfoList(loginInfo);
ExcelBuilder.of(list, SysLoginInfoVo.class).sheetName("登录日志").toResponse(response);
}
/**
* 批量删除登录日志
*
* @param infoIds 日志ids
*/
@SaCheckPermission("monitor:logininfo:remove")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public R<Void> remove(@PathVariable Long[] infoIds) {
return toAjax(loginInfoService.deleteLoginInfoByIds(infoIds));
}
/**
* 清理系统访问记录
*/
@SaCheckPermission("monitor:logininfo:remove")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@Lock4j
@DeleteMapping("/clean")
public R<Void> clean() {
loginInfoService.cleanLoginInfo();
return R.ok();
}
@SaCheckPermission("monitor:logininfo:unlock")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@RepeatSubmit()
@GetMapping("/unlock/{userName}")
public R<Void> unlock(@PathVariable("userName") String userName) {
String loginName = CacheNames.PWD_ERR_CNT_KEY + userName;
if (RedisUtils.hasKey(loginName)) {
RedisUtils.deleteObject(loginName);
}
return R.ok();
}
}
@@ -0,0 +1,77 @@
package cn.aixunkeji.system.controller.monitor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.lock.annotation.Lock4j;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysOperLogBo;
import cn.aixunkeji.system.domain.vo.SysOperLogVo;
import cn.aixunkeji.system.service.ISysOperLogService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 操作日志记录
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/operlog")
public class SysOperlogController extends BaseController {
private final ISysOperLogService operLogService;
/**
* 获取操作日志记录列表
*/
@SaCheckPermission("monitor:operlog:list")
@GetMapping("/list")
public R<PageResult<SysOperLogVo>> list(SysOperLogBo operLog, PageQuery pageQuery) {
return R.ok(operLogService.selectPageOperLogList(operLog, pageQuery));
}
/**
* 导出操作日志记录列表
*/
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@SaCheckPermission("monitor:operlog:export")
@PostMapping("/export")
public void export(SysOperLogBo operLog, HttpServletResponse response) {
List<SysOperLogVo> list = operLogService.selectOperLogList(operLog);
ExcelBuilder.of(list, SysOperLogVo.class).sheetName("操作日志").toResponse(response);
}
/**
* 批量删除操作日志记录
*
* @param operIds 日志ids
*/
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@SaCheckPermission("monitor:operlog:remove")
@DeleteMapping("/{operIds}")
public R<Void> remove(@PathVariable Long[] operIds) {
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
/**
* 清理操作日志记录
*/
@SaCheckPermission("monitor:operlog:remove")
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@Lock4j
@DeleteMapping("/clean")
public R<Void> clean() {
operLogService.cleanOperLog();
return R.ok();
}
}
@@ -0,0 +1,135 @@
package cn.aixunkeji.system.controller.monitor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.constant.CacheNames;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.utils.StreamUtils;
import cn.aixunkeji.common.core.utils.StringUtils;
import cn.aixunkeji.common.core.utils.ThreadUtils;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.redis.utils.RedisUtils;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.api.domain.SysUserOnline;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.function.Supplier;
/**
* 在线用户监控
*
*/
@RequiredArgsConstructor
@RestController
@RequestMapping("/online")
public class SysUserOnlineController extends BaseController {
/**
* 获取在线用户监控列表
*
* @param ipaddr IP地址
* @param userName 用户名
*/
@SaCheckPermission("monitor:online:list")
@GetMapping("/list")
public R<PageResult<SysUserOnline>> list(String ipaddr, String userName) {
// 获取所有未过期的 token
Collection<String> keys = RedisUtils.keys(CacheNames.ONLINE_TOKEN_KEY + "*");
List<Supplier<SysUserOnline>> suppliers = keys.stream().map(key -> (Supplier<SysUserOnline>) () -> {
String token = StringUtils.substringAfterLast(key, StringUtils.COLON);
// 如果已经过期则跳过
if (StpUtil.stpLogic.getTokenActiveTimeoutByToken(token) < -1) {
return null;
}
return RedisUtils.getCacheObject(CacheNames.ONLINE_TOKEN_KEY + token);
}).toList();
List<SysUserOnline> userOnlineDTOList = ThreadUtils.virtualSubmitAll(suppliers);
userOnlineDTOList.removeAll(Collections.singleton(null));
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) {
userOnlineDTOList = StreamUtils.filter(userOnlineDTOList, userOnline ->
StringUtils.equals(ipaddr, userOnline.getIpaddr()) &&
StringUtils.equals(userName, userOnline.getUserName())
);
} else if (StringUtils.isNotEmpty(ipaddr)) {
userOnlineDTOList = StreamUtils.filter(userOnlineDTOList, userOnline ->
StringUtils.equals(ipaddr, userOnline.getIpaddr())
);
} else if (StringUtils.isNotEmpty(userName)) {
userOnlineDTOList = StreamUtils.filter(userOnlineDTOList, userOnline ->
StringUtils.equals(userName, userOnline.getUserName())
);
}
Collections.reverse(userOnlineDTOList);
List<SysUserOnline> userOnlineList = BeanUtil.copyToList(userOnlineDTOList, SysUserOnline.class);
return R.ok(PageResult.build(userOnlineList));
}
/**
* 强退用户
*
* @param tokenId token值
*/
@SaCheckPermission("monitor:online:forceLogout")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@RepeatSubmit()
@DeleteMapping("/{tokenId}")
public R<Void> forceLogout(@PathVariable String tokenId) {
try {
StpUtil.kickoutByTokenValue(tokenId);
} catch (NotLoginException ignored) {
}
return R.ok();
}
/**
* 获取当前用户登录在线设备
*/
@GetMapping()
public R<PageResult<SysUserOnline>> getInfo() {
// 获取指定账号 id 的 token 集合
List<String> tokenIds = StpUtil.getTokenValueListByLoginId(StpUtil.getLoginIdAsString());
List<Supplier<SysUserOnline>> suppliers = tokenIds.stream().map(token -> (Supplier<SysUserOnline>) () -> {
if (StpUtil.stpLogic.getTokenActiveTimeoutByToken(token) < -1) {
return null;
}
return RedisUtils.getCacheObject(CacheNames.ONLINE_TOKEN_KEY + token);
}).toList();
List<SysUserOnline> userOnlineDTOList = ThreadUtils.virtualSubmitAll(suppliers);
//复制和处理 SysUserOnline 对象列表
Collections.reverse(userOnlineDTOList);
userOnlineDTOList.removeAll(Collections.singleton(null));
List<SysUserOnline> userOnlineList = BeanUtil.copyToList(userOnlineDTOList, SysUserOnline.class);
return R.ok(PageResult.build(userOnlineList));
}
/**
* 强退当前在线设备
*
* @param tokenId token值
*/
@Log(title = "在线设备", businessType = BusinessType.FORCE)
@RepeatSubmit()
@DeleteMapping("/myself/{tokenId}")
public R<Void> remove(@PathVariable("tokenId") String tokenId) {
try {
// 获取指定账号 id 的 token 集合
List<String> keys = StpUtil.getTokenValueListByLoginId(StpUtil.getLoginIdAsString());
keys.stream()
.filter(key -> key.equals(tokenId))
.findFirst()
.ifPresent(key -> StpUtil.kickoutByTokenValue(tokenId));
} catch (NotLoginException ignored) {
}
return R.ok();
}
}
@@ -0,0 +1,120 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.validate.AddGroup;
import cn.aixunkeji.common.core.validate.EditGroup;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysClientBo;
import cn.aixunkeji.system.domain.vo.SysClientVo;
import cn.aixunkeji.system.service.ISysClientService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 客户端管理
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/client")
public class SysClientController extends BaseController {
private final ISysClientService sysClientService;
/**
* 查询客户端管理列表
*/
@SaCheckPermission("system:client:list")
@GetMapping("/list")
public R<PageResult<SysClientVo>> list(SysClientBo bo, PageQuery pageQuery) {
return R.ok(sysClientService.queryPageList(bo, pageQuery));
}
/**
* 导出客户端管理列表
*/
@SaCheckPermission("system:client:export")
@Log(title = "客户端管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(SysClientBo bo, HttpServletResponse response) {
List<SysClientVo> list = sysClientService.queryList(bo);
ExcelBuilder.of(list, SysClientVo.class).sheetName("客户端管理").toResponse(response);
}
/**
* 获取客户端管理详细信息
*
* @param id 主键
*/
@SaCheckPermission("system:client:query")
@GetMapping("/{id}")
public R<SysClientVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(sysClientService.queryById(id));
}
/**
* 新增客户端管理
*/
@SaCheckPermission("system:client:add")
@Log(title = "客户端管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysClientBo bo) {
if (!sysClientService.checkClickKeyUnique(bo)) {
return R.fail("新增客户端'" + bo.getClientKey() + "'失败,客户端key已存在");
}
return toAjax(sysClientService.insertByBo(bo));
}
/**
* 修改客户端管理
*/
@SaCheckPermission("system:client:edit")
@Log(title = "客户端管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysClientBo bo) {
if (!sysClientService.checkClickKeyUnique(bo)) {
return R.fail("修改客户端'" + bo.getClientKey() + "'失败,客户端key已存在");
}
return toAjax(sysClientService.updateByBo(bo));
}
/**
* 状态修改
*/
@SaCheckPermission("system:client:edit")
@Log(title = "客户端管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public R<Void> changeStatus(@RequestBody SysClientBo bo) {
return toAjax(sysClientService.updateClientStatus(bo.getClientId(), bo.getStatus()));
}
/**
* 删除客户端管理
*
* @param ids 主键串
*/
@SaCheckPermission("system:client:remove")
@Log(title = "客户端管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(sysClientService.deleteWithValidByIds(List.of(ids), true));
}
}
@@ -0,0 +1,141 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysConfigBo;
import cn.aixunkeji.system.domain.vo.SysConfigVo;
import cn.aixunkeji.system.service.ISysConfigService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
/**
* 参数配置 信息操作处理
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/config")
public class SysConfigController extends BaseController {
private final ISysConfigService configService;
/**
* 获取参数配置列表
*/
@SaCheckPermission("system:config:list")
@GetMapping("/list")
public R<PageResult<SysConfigVo>> list(SysConfigBo config, PageQuery pageQuery) {
return R.ok(configService.selectPageConfigList(config, pageQuery));
}
/**
* 导出参数配置列表
*/
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:config:export")
@PostMapping("/export")
public void export(SysConfigBo config, HttpServletResponse response) {
List<SysConfigVo> list = configService.selectConfigList(config);
ExcelBuilder.of(list, SysConfigVo.class).sheetName("参数数据").toResponse(response);
}
/**
* 根据参数编号获取详细信息
*
* @param configId 参数ID
*/
@SaCheckPermission("system:config:query")
@GetMapping(value = "/{configId}")
public R<SysConfigVo> getInfo(@PathVariable Long configId) {
return R.ok(configService.selectConfigById(configId));
}
/**
* 根据参数键名查询参数值
*
* @param configKey 参数Key
*/
@GetMapping(value = "/configKey/{configKey}")
public R<String> getConfigKey(@PathVariable String configKey) {
return R.data(configService.selectConfigByKey(configKey));
}
/**
* 新增参数配置
*/
@SaCheckPermission("system:config:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysConfigBo config) {
if (!configService.checkConfigKeyUnique(config)) {
return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
configService.insertConfig(config);
return R.ok();
}
/**
* 修改参数配置
*/
@SaCheckPermission("system:config:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysConfigBo config) {
if (!configService.checkConfigKeyUnique(config)) {
return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
configService.updateConfig(config);
return R.ok();
}
/**
* 根据参数键名修改参数配置
*/
@SaCheckPermission("system:config:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping("/updateByKey")
public R<Void> updateByKey(@RequestBody SysConfigBo config) {
configService.updateConfig(config);
return R.ok();
}
/**
* 删除参数配置
*
* @param configIds 参数ID串
*/
@SaCheckPermission("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public R<Void> remove(@PathVariable Long[] configIds) {
configService.deleteConfigByIds(Arrays.asList(configIds));
return R.ok();
}
/**
* 刷新参数缓存
*/
@SaCheckPermission("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public R<Void> refreshCache() {
configService.resetConfigCache();
return R.ok();
}
}
@@ -0,0 +1,145 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.convert.Convert;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.utils.StringUtils;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysDeptBo;
import cn.aixunkeji.system.domain.vo.SysDeptVo;
import cn.aixunkeji.system.service.ISysDeptService;
import cn.aixunkeji.system.service.ISysPostService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 部门信息
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/dept")
public class SysDeptController extends BaseController {
private final ISysDeptService deptService;
private final ISysPostService postService;
/**
* 获取部门列表
*/
@SaCheckPermission("system:dept:list")
@GetMapping("/list")
public R<List<SysDeptVo>> list(SysDeptBo dept) {
List<SysDeptVo> depts = deptService.selectDeptList(dept);
return R.ok(depts);
}
/**
* 查询部门列表(排除节点)
*
* @param deptId 部门ID
*/
@SaCheckPermission("system:dept:list")
@GetMapping("/list/exclude/{deptId}")
public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId") Long deptId) {
List<SysDeptVo> depts = deptService.selectDeptList(new SysDeptBo());
depts.removeIf(d -> d.getDeptId().equals(deptId)
|| StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId)));
return R.ok(depts);
}
/**
* 根据部门编号获取详细信息
*
* @param deptId 部门ID
*/
@SaCheckPermission("system:dept:query")
@GetMapping(value = "/{deptId}")
public R<SysDeptVo> getInfo(@PathVariable Long deptId) {
deptService.checkDeptDataScope(deptId);
return R.ok(deptService.selectDeptById(deptId));
}
/**
* 新增部门
*/
@SaCheckPermission("system:dept:add")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysDeptBo dept) {
if (!deptService.checkDeptNameUnique(dept)) {
return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
return toAjax(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@SaCheckPermission("system:dept:edit")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysDeptBo dept) {
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept)) {
return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} else if (dept.getParentId().equals(deptId)) {
return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} else if (StringUtils.equals(SystemConstants.DISABLE, dept.getStatus())) {
if (deptService.selectNormalChildrenDeptById(deptId) > 0) {
return R.fail("该部门包含未停用的子部门!");
} else if (deptService.checkDeptExistUser(deptId)) {
return R.fail("该部门下存在已分配用户,不能禁用!");
}
}
return toAjax(deptService.updateDept(dept));
}
/**
* 删除部门
*
* @param deptId 部门ID
*/
@SaCheckPermission("system:dept:remove")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public R<Void> remove(@PathVariable Long deptId) {
if (StringUtils.equals(SystemConstants.ROOT_DEPT_ANCESTORS, String.valueOf(deptId))) {
return R.warn("根部门不允许删除");
}
if (deptService.hasChildByDeptId(deptId)) {
return R.warn("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId)) {
return R.warn("部门存在用户,不允许删除");
}
if (postService.countPostByDeptId(deptId) > 0) {
return R.warn("部门存在岗位,不允许删除");
}
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId));
}
/**
* 获取部门选择框列表
*
* @param deptIds 部门ID串
*/
@SaCheckPermission("system:dept:query")
@GetMapping("/optionselect")
public R<List<SysDeptVo>> optionselect(@RequestParam(required = false) Long[] deptIds) {
return R.ok(deptService.selectDeptByIds(deptIds == null ? null : List.of(deptIds)));
}
}
@@ -0,0 +1,126 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysDictDataBo;
import cn.aixunkeji.system.domain.vo.SysDictDataVo;
import cn.aixunkeji.system.service.ISysDictDataService;
import cn.aixunkeji.system.service.ISysDictTypeService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 数据字典信息
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/dict/data")
public class SysDictDataController extends BaseController {
private final ISysDictDataService dictDataService;
private final ISysDictTypeService dictTypeService;
/**
* 查询字典数据列表
*/
@SaCheckPermission("system:dict:list")
@GetMapping("/list")
public R<PageResult<SysDictDataVo>> list(SysDictDataBo dictData, PageQuery pageQuery) {
return R.ok(dictDataService.selectPageDictDataList(dictData, pageQuery));
}
/**
* 导出字典数据列表
*/
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:dict:export")
@PostMapping("/export")
public void export(SysDictDataBo dictData, HttpServletResponse response) {
List<SysDictDataVo> list = dictDataService.selectDictDataList(dictData);
ExcelBuilder.of(list, SysDictDataVo.class).sheetName("字典数据").toResponse(response);
}
/**
* 查询字典数据详细
*
* @param dictCode 字典code
*/
@SaCheckPermission("system:dict:query")
@GetMapping(value = "/{dictCode}")
public R<SysDictDataVo> getInfo(@PathVariable Long dictCode) {
return R.ok(dictDataService.selectDictDataById(dictCode));
}
/**
* 根据字典类型查询字典数据信息
*
* @param dictType 字典类型
*/
@GetMapping(value = "/type/{dictType}")
public R<List<SysDictDataVo>> dictType(@PathVariable String dictType) {
List<SysDictDataVo> data = dictTypeService.selectDictDataByType(dictType);
if (ObjectUtil.isNull(data)) {
data = new ArrayList<>();
}
return R.ok(data);
}
/**
* 新增字典数据
*/
@SaCheckPermission("system:dict:add")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysDictDataBo dict) {
if (!dictDataService.checkDictDataUnique(dict)) {
return R.fail("新增字典数据'" + dict.getDictValue() + "'失败,字典键值已存在");
}
dictDataService.insertDictData(dict);
return R.ok();
}
/**
* 修改保存字典数据
*/
@SaCheckPermission("system:dict:edit")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysDictDataBo dict) {
if (!dictDataService.checkDictDataUnique(dict)) {
return R.fail("修改字典数据'" + dict.getDictValue() + "'失败,字典键值已存在");
}
dictDataService.updateDictData(dict);
return R.ok();
}
/**
* 删除字典数据
*
* @param dictCodes 字典code串
*/
@SaCheckPermission("system:dict:remove")
@Log(title = "字典数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public R<Void> remove(@PathVariable Long[] dictCodes) {
dictDataService.deleteDictDataByIds(Arrays.asList(dictCodes));
return R.ok();
}
}
@@ -0,0 +1,129 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysDictTypeBo;
import cn.aixunkeji.system.domain.vo.SysDictTypeVo;
import cn.aixunkeji.system.service.ISysDictTypeService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
/**
* 数据字典信息
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/dict/type")
public class SysDictTypeController extends BaseController {
private final ISysDictTypeService dictTypeService;
/**
* 查询字典类型列表
*/
@SaCheckPermission("system:dict:list")
@GetMapping("/list")
public R<PageResult<SysDictTypeVo>> list(SysDictTypeBo dictType, PageQuery pageQuery) {
return R.ok(dictTypeService.selectPageDictTypeList(dictType, pageQuery));
}
/**
* 导出字典类型列表
*/
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:dict:export")
@PostMapping("/export")
public void export(SysDictTypeBo dictType, HttpServletResponse response) {
List<SysDictTypeVo> list = dictTypeService.selectDictTypeList(dictType);
ExcelBuilder.of(list, SysDictTypeVo.class).sheetName("字典类型").toResponse(response);
}
/**
* 查询字典类型详细
*
* @param dictId 字典ID
*/
@SaCheckPermission("system:dict:query")
@GetMapping(value = "/{dictId}")
public R<SysDictTypeVo> getInfo(@PathVariable Long dictId) {
return R.ok(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@SaCheckPermission("system:dict:add")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysDictTypeBo dict) {
if (!dictTypeService.checkDictTypeUnique(dict)) {
return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dictTypeService.insertDictType(dict);
return R.ok();
}
/**
* 修改字典类型
*/
@SaCheckPermission("system:dict:edit")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysDictTypeBo dict) {
if (!dictTypeService.checkDictTypeUnique(dict)) {
return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dictTypeService.updateDictType(dict);
return R.ok();
}
/**
* 删除字典类型
*
* @param dictIds 字典ID串
*/
@SaCheckPermission("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public R<Void> remove(@PathVariable Long[] dictIds) {
dictTypeService.deleteDictTypeByIds(Arrays.asList(dictIds));
return R.ok();
}
/**
* 刷新字典缓存
*/
@SaCheckPermission("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@RepeatSubmit()
@DeleteMapping("/refreshCache")
public R<Void> refreshCache() {
dictTypeService.resetDictCache();
return R.ok();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/optionselect")
public R<List<SysDictTypeVo>> optionselect() {
List<SysDictTypeVo> dictTypes = dictTypeService.selectDictTypeAll();
return R.ok(dictTypes);
}
}
@@ -0,0 +1,180 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.hutool.core.lang.tree.Tree;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.utils.StringUtils;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.satoken.utils.LoginHelper;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.SysMenu;
import cn.aixunkeji.system.domain.bo.SysMenuBo;
import cn.aixunkeji.system.domain.vo.RouterVo;
import cn.aixunkeji.system.domain.vo.SysMenuVo;
import cn.aixunkeji.system.service.ISysMenuService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 菜单信息
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/menu")
public class SysMenuController extends BaseController {
private final ISysMenuService menuService;
/**
* 获取路由信息
*
* @return 路由信息
*/
@GetMapping("/getRouters")
public R<List<RouterVo>> getRouters() {
List<SysMenu> menus = menuService.selectMenuTreeByUserId(LoginHelper.getUserId());
return R.ok(menuService.buildMenus(menus));
}
/**
* 获取菜单列表
*/
@SaCheckPermission("system:menu:list")
@GetMapping("/list")
public R<List<SysMenuVo>> list(SysMenuBo menu) {
List<SysMenuVo> menus = menuService.selectMenuList(menu, LoginHelper.getUserId());
return R.ok(menus);
}
/**
* 根据菜单编号获取详细信息
*
* @param menuId 菜单ID
*/
@SaCheckPermission("system:menu:query")
@GetMapping(value = "/{menuId}")
public R<SysMenuVo> getInfo(@PathVariable Long menuId) {
return R.ok(menuService.selectMenuById(menuId));
}
/**
* 获取菜单下拉树列表
*/
@SaCheckPermission("system:menu:query")
@GetMapping("/treeselect")
public R<List<Tree<Long>>> treeselect(SysMenuBo menu) {
List<SysMenuVo> menus = menuService.selectMenuList(menu, LoginHelper.getUserId());
return R.ok(menuService.buildMenuTreeSelect(menus));
}
/**
* 加载对应角色菜单列表树
*
* @param roleId 角色ID
*/
@SaCheckPermission("system:menu:query")
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public R<MenuTreeSelectVo> roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
List<SysMenuVo> menus = menuService.selectMenuList(LoginHelper.getUserId());
MenuTreeSelectVo selectVo = new MenuTreeSelectVo(
menuService.selectMenuListByRoleId(roleId),
menuService.buildMenuTreeSelect(menus));
return R.ok(selectVo);
}
/**
* 新增菜单
*/
@SaCheckRole(SystemConstants.SUPER_ADMIN_ROLE_KEY)
@SaCheckPermission("system:menu:add")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysMenuBo menu) {
if (!menuService.checkMenuNameUnique(menu)) {
return R.fail("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (SystemConstants.YES.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
return R.fail("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
} else if (!menuService.checkRouteConfigUnique(menu)) {
return R.fail("新增菜单'" + menu.getMenuName() + "'失败,路由名称或地址已存在");
}
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@SaCheckRole(SystemConstants.SUPER_ADMIN_ROLE_KEY)
@SaCheckPermission("system:menu:edit")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysMenuBo menu) {
if (!menuService.checkMenuNameUnique(menu)) {
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (SystemConstants.YES.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
} else if (menu.getMenuId().equals(menu.getParentId())) {
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
} else if (!menuService.checkRouteConfigUnique(menu)) {
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,路由名称或地址已存在");
}
return toAjax(menuService.updateMenu(menu));
}
/**
* 删除菜单
*
* @param menuId 菜单ID
*/
@SaCheckRole(SystemConstants.SUPER_ADMIN_ROLE_KEY)
@SaCheckPermission("system:menu:remove")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public R<Void> remove(@PathVariable("menuId") Long menuId) {
if (menuService.hasChildByMenuId(menuId)) {
return R.warn("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId)) {
return R.warn("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
/**
* 批量级联删除菜单
*
* @param menuIds 菜单ID串
*/
@SaCheckRole(SystemConstants.SUPER_ADMIN_ROLE_KEY)
@SaCheckPermission("system:menu:remove")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/cascade/{menuIds}")
public R<Void> remove(@PathVariable("menuIds") Long[] menuIds) {
List<Long> menuIdList = List.of(menuIds);
if (menuService.hasChildByMenuId(menuIdList)) {
return R.warn("存在子菜单,不允许删除");
}
menuService.deleteMenuById(menuIdList);
return R.ok();
}
/**
* 角色菜单列表树信息
*
* @param checkedKeys 选中菜单列表
* @param menus 菜单下拉树结构列表
*/
public record MenuTreeSelectVo(List<Long> checkedKeys, List<Tree<Long>> menus) {
}
}
@@ -0,0 +1,115 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.enums.PushSourceEnum;
import cn.aixunkeji.common.core.enums.PushTypeEnum;
import cn.aixunkeji.common.core.service.DictService;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.resource.api.RemoteMessageService;
import cn.aixunkeji.resource.api.domain.RemotePushPayLoad;
import cn.aixunkeji.system.domain.bo.SysNoticeBo;
import cn.aixunkeji.system.domain.vo.SysNoticeVo;
import cn.aixunkeji.system.service.ISysNoticeService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* 公告 信息操作处理
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/notice")
public class SysNoticeController extends BaseController {
private final ISysNoticeService noticeService;
private final DictService dictService;
@DubboReference
private RemoteMessageService remoteMessageService;
/**
* 获取通知公告列表
*/
@SaCheckPermission("system:notice:list")
@GetMapping("/list")
public R<PageResult<SysNoticeVo>> list(SysNoticeBo notice, PageQuery pageQuery) {
return R.ok(noticeService.selectPageNoticeList(notice, pageQuery));
}
/**
* 根据通知公告编号获取详细信息
*
* @param noticeId 公告ID
*/
@SaCheckPermission("system:notice:query")
@GetMapping(value = "/{noticeId}")
public R<SysNoticeVo> getInfo(@PathVariable Long noticeId) {
return R.ok(noticeService.selectNoticeById(noticeId));
}
/**
* 新增通知公告
*/
@SaCheckPermission("system:notice:add")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysNoticeBo notice) {
int rows = noticeService.insertNotice(notice);
if (rows <= 0) {
return R.fail();
}
String type = dictService.getDictLabel("sys_notice_type", notice.getNoticeType());
Map<String, Object> data = new HashMap<>(6);
data.put("noticeType", notice.getNoticeType());
data.put("noticeTypeLabel", type);
data.put("noticeTitle", notice.getNoticeTitle());
data.put("noticeId", notice.getNoticeId());
data.put("noticeContent", notice.getNoticeContent());
data.put("status", notice.getStatus());
remoteMessageService.publishAllPayload(RemotePushPayLoad.of(
PushTypeEnum.NOTICE,
PushSourceEnum.NOTICE,
"[" + type + "] " + notice.getNoticeTitle(),
data,
"/system/notice?noticeId=" + notice.getNoticeId()
));
return R.ok();
}
/**
* 修改通知公告
*/
@SaCheckPermission("system:notice:edit")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysNoticeBo notice) {
return toAjax(noticeService.updateNotice(notice));
}
/**
* 删除通知公告
*
* @param noticeIds 公告ID串
*/
@SaCheckPermission("system:notice:remove")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public R<Void> remove(@PathVariable Long[] noticeIds) {
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}
@@ -0,0 +1,149 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.util.ObjectUtil;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysDeptBo;
import cn.aixunkeji.system.domain.bo.SysPostBo;
import cn.aixunkeji.system.domain.vo.SysPostVo;
import cn.aixunkeji.system.service.ISysDeptService;
import cn.aixunkeji.system.service.ISysPostService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 岗位信息操作处理
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/post")
public class SysPostController extends BaseController {
private final ISysPostService postService;
private final ISysDeptService deptService;
/**
* 获取岗位列表
*/
@SaCheckPermission("system:post:list")
@GetMapping("/list")
public R<PageResult<SysPostVo>> list(SysPostBo post, PageQuery pageQuery) {
return R.ok(postService.selectPagePostList(post, pageQuery));
}
/**
* 导出岗位列表
*/
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:post:export")
@PostMapping("/export")
public void export(SysPostBo post, HttpServletResponse response) {
List<SysPostVo> list = postService.selectPostList(post);
ExcelBuilder.of(list, SysPostVo.class).sheetName("岗位数据").toResponse(response);
}
/**
* 根据岗位编号获取详细信息
*
* @param postId 岗位ID
*/
@SaCheckPermission("system:post:query")
@GetMapping(value = "/{postId}")
public R<SysPostVo> getInfo(@PathVariable Long postId) {
return R.ok(postService.selectPostById(postId));
}
/**
* 新增岗位
*/
@SaCheckPermission("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysPostBo post) {
if (!postService.checkPostNameUnique(post)) {
return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (!postService.checkPostCodeUnique(post)) {
return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
return toAjax(postService.insertPost(post));
}
/**
* 修改岗位
*/
@SaCheckPermission("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysPostBo post) {
if (!postService.checkPostNameUnique(post)) {
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (!postService.checkPostCodeUnique(post)) {
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} else if (SystemConstants.DISABLE.equals(post.getStatus())
&& postService.countUserPostById(post.getPostId()) > 0) {
return R.fail("该岗位下存在已分配用户,不能禁用!");
}
return toAjax(postService.updatePost(post));
}
/**
* 删除岗位
*
* @param postIds 岗位ID串
*/
@SaCheckPermission("system:post:remove")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public R<Void> remove(@PathVariable Long[] postIds) {
return toAjax(postService.deletePostByIds(Arrays.asList(postIds)));
}
/**
* 获取岗位选择框列表
*
* @param postIds 岗位ID串
* @param deptId 部门id
*/
@SaCheckPermission("system:post:query")
@GetMapping("/optionselect")
public R<List<SysPostVo>> optionselect(@RequestParam(required = false) Long[] postIds, @RequestParam(required = false) Long deptId) {
List<SysPostVo> list = new ArrayList<>();
if (ObjectUtil.isNotNull(deptId)) {
SysPostBo post = new SysPostBo();
post.setDeptId(deptId);
list = postService.selectPostList(post);
} else if (postIds != null) {
list = postService.selectPostByIds(List.of(postIds));
}
return R.ok(list);
}
/**
* 获取部门树列表
*/
@SaCheckPermission("system:post:list")
@GetMapping("/deptTree")
public R<List<Tree<Long>>> deptTree(SysDeptBo dept) {
return R.ok(deptService.selectDeptTreeList(dept));
}
}
@@ -0,0 +1,119 @@
package cn.aixunkeji.system.controller.system;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.crypto.digest.BCrypt;
import jakarta.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.utils.StringUtils;
import cn.aixunkeji.common.encrypt.annotation.ApiEncrypt;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.helper.DataPermissionHelper;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.satoken.utils.LoginHelper;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.bo.SysUserBo;
import cn.aixunkeji.system.domain.bo.SysUserProfileBo;
import cn.aixunkeji.system.domain.vo.ProfileUserVo;
import cn.aixunkeji.system.domain.vo.SysUserVo;
import cn.aixunkeji.system.service.ISysUserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 个人信息 业务处理
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/user/profile")
public class SysProfileController extends BaseController {
private final ISysUserService userService;
/**
* 个人信息
*/
@GetMapping
public R<ProfileVo> profile() {
SysUserVo user = userService.selectUserById(LoginHelper.getUserId());
String roleGroup = userService.selectUserRoleGroup(user.getUserId());
String postGroup = userService.selectUserPostGroup(user.getUserId());
// 单独做一个vo专门给个人中心用 避免数据被脱敏
ProfileUserVo profileUser = BeanUtil.toBean(user, ProfileUserVo.class);
ProfileVo profileVo = new ProfileVo(profileUser, roleGroup, postGroup);
return R.ok(profileVo);
}
/**
* 修改用户信息
*/
@RepeatSubmit
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public R<Void> updateProfile(@Validated @RequestBody SysUserProfileBo profile) {
SysUserBo user = BeanUtil.toBean(profile, SysUserBo.class);
user.setUserId(LoginHelper.getUserId());
String username = LoginHelper.getUsername();
if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) {
return R.fail("修改用户'" + username + "'失败,手机号码已存在");
}
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return R.fail("修改用户'" + username + "'失败,邮箱账号已存在");
}
int rows = DataPermissionHelper.ignore(() -> userService.updateUserProfile(user));
if (rows > 0) {
return R.ok();
}
return R.fail("修改个人信息异常,请联系管理员");
}
/**
* 重置密码
*
* @param bo 新旧密码
*/
@RepeatSubmit
@ApiEncrypt
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public R<Void> updatePwd(@Validated @RequestBody SysUserPasswordBo bo) {
SysUserVo user = userService.selectUserById(LoginHelper.getUserId());
String password = user.getPassword();
if (!BCrypt.checkpw(bo.oldPassword(), password)) {
return R.fail("修改密码失败,旧密码错误");
}
if (BCrypt.checkpw(bo.newPassword(), password)) {
return R.fail("新密码不能与旧密码相同");
}
int rows = DataPermissionHelper.ignore(() -> userService.resetUserPwd(user.getUserId(), BCrypt.hashpw(bo.newPassword())));
if (rows > 0) {
return R.ok();
}
return R.fail("修改密码异常,请联系管理员");
}
/**
* 用户个人信息
*
* @param user 用户信息
* @param roleGroup 用户所属角色组
* @param postGroup 用户所属岗位组
*/
public record ProfileVo(ProfileUserVo user, String roleGroup, String postGroup) {
}
/**
* 用户密码修改
*
* @param oldPassword 旧密码
* @param newPassword 新密码
*/
public record SysUserPasswordBo(
@NotBlank(message = "旧密码不能为空") String oldPassword,
@NotBlank(message = "新密码不能为空") String newPassword) {
}
}
@@ -0,0 +1,262 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.tree.Tree;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.utils.SpringUtils;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.domain.SysUserRole;
import cn.aixunkeji.system.domain.bo.SysDeptBo;
import cn.aixunkeji.system.domain.bo.SysRoleBo;
import cn.aixunkeji.system.domain.bo.SysUserBo;
import cn.aixunkeji.system.domain.vo.SysRoleVo;
import cn.aixunkeji.system.domain.vo.SysUserVo;
import cn.aixunkeji.system.event.OnlineUserCleanEvent;
import cn.aixunkeji.system.service.ISysDeptService;
import cn.aixunkeji.system.service.ISysRoleService;
import cn.aixunkeji.system.service.ISysUserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 角色信息
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/role")
public class SysRoleController extends BaseController {
private final ISysRoleService roleService;
private final ISysUserService userService;
private final ISysDeptService deptService;
/**
* 获取角色信息列表
*/
@SaCheckPermission("system:role:list")
@GetMapping("/list")
public R<PageResult<SysRoleVo>> list(SysRoleBo role, PageQuery pageQuery) {
return R.ok(roleService.selectPageRoleList(role, pageQuery));
}
/**
* 导出角色信息列表
*/
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:role:export")
@PostMapping("/export")
public void export(SysRoleBo role, HttpServletResponse response) {
List<SysRoleVo> list = roleService.selectRoleList(role);
ExcelBuilder.of(list, SysRoleVo.class).sheetName("角色数据").toResponse(response);
}
/**
* 根据角色编号获取详细信息
*
* @param roleId 角色ID
*/
@SaCheckPermission("system:role:query")
@GetMapping(value = "/{roleId}")
public R<SysRoleVo> getInfo(@PathVariable Long roleId) {
roleService.checkRoleDataScope(roleId);
return R.ok(roleService.selectRoleById(roleId));
}
/**
* 新增角色
*/
@SaCheckPermission("system:role:add")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysRoleBo role) {
roleService.checkRoleAllowed(role);
if (!roleService.checkRoleNameUnique(role)) {
return R.fail("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
} else if (!roleService.checkRoleKeyUnique(role)) {
return R.fail("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
return toAjax(roleService.insertRole(role));
}
/**
* 修改角色基础信息(不包含菜单权限、数据权限)。
*
* @param role 角色参数
* @return 操作结果
*/
@SaCheckPermission("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysRoleBo role) {
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role)) {
return R.fail("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
} else if (!roleService.checkRoleKeyUnique(role)) {
return R.fail("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
if (roleService.updateRoleBaseInfo(role) > 0) {
SpringUtils.context().publishEvent(OnlineUserCleanEvent.byRole(role.getRoleId()));
return R.ok();
}
return R.fail("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
}
/**
* 修改角色权限信息(菜单权限 + 数据权限)。
*
* @param role 角色参数
* @return 操作结果
*/
@SaCheckPermission("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping("/permission")
public R<Void> editPermission(@RequestBody SysRoleBo role) {
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (roleService.updateRolePermission(role) > 0) {
SpringUtils.context().publishEvent(OnlineUserCleanEvent.byRole(role.getRoleId()));
return R.ok();
}
return R.fail("修改角色'" + role.getRoleName() + "'权限失败,请联系管理员");
}
/**
* 状态修改
*/
@SaCheckPermission("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping("/changeStatus")
public R<Void> changeStatus(@RequestBody SysRoleBo role) {
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (roleService.updateRoleStatus(role.getRoleId(), role.getStatus()) > 0) {
SpringUtils.context().publishEvent(OnlineUserCleanEvent.byRole(role.getRoleId()));
return R.ok();
}
return R.fail("修改角色'" + role.getRoleName() + "'状态失败,请联系管理员");
}
/**
* 删除角色
*
* @param roleIds 角色ID串
*/
@SaCheckPermission("system:role:remove")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public R<Void> remove(@PathVariable Long[] roleIds) {
return toAjax(roleService.deleteRoleByIds(List.of(roleIds)));
}
/**
* 获取角色选择框列表
*
* @param roleIds 角色ID串
*/
@SaCheckPermission("system:role:query")
@GetMapping("/optionselect")
public R<List<SysRoleVo>> optionselect(@RequestParam(required = false) Long[] roleIds) {
return R.ok(roleService.selectRoleByIds(roleIds == null ? null : List.of(roleIds)));
}
/**
* 查询已分配用户角色列表
*/
@SaCheckPermission("system:role:list")
@GetMapping("/authUser/allocatedList")
public R<PageResult<SysUserVo>> allocatedList(SysUserBo user, PageQuery pageQuery) {
return R.ok(userService.selectAllocatedList(user, pageQuery));
}
/**
* 查询未分配用户角色列表
*/
@SaCheckPermission("system:role:list")
@GetMapping("/authUser/unallocatedList")
public R<PageResult<SysUserVo>> unallocatedList(SysUserBo user, PageQuery pageQuery) {
return R.ok(userService.selectUnallocatedList(user, pageQuery));
}
/**
* 取消授权用户
*/
@SaCheckPermission("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@RepeatSubmit()
@PutMapping("/authUser/cancel")
public R<Void> cancelAuthUser(@RequestBody SysUserRole userRole) {
return toAjax(roleService.deleteAuthUser(userRole));
}
/**
* 批量取消授权用户
*
* @param roleId 角色ID
* @param userIds 用户ID串
*/
@SaCheckPermission("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@RepeatSubmit()
@PutMapping("/authUser/cancelAll")
public R<Void> cancelAuthUserAll(Long roleId, Long[] userIds) {
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
/**
* 批量选择用户授权
*
* @param roleId 角色ID
* @param userIds 用户ID串
*/
@SaCheckPermission("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@RepeatSubmit()
@PutMapping("/authUser/selectAll")
public R<Void> selectAuthUserAll(Long roleId, Long[] userIds) {
roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
/**
* 获取对应角色部门树列表
*
* @param roleId 角色ID
*/
@SaCheckPermission("system:role:list")
@GetMapping(value = "/deptTree/{roleId}")
public R<DeptTreeSelectVo> roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
DeptTreeSelectVo selectVo = new DeptTreeSelectVo(
deptService.selectDeptListByRoleId(roleId),
deptService.selectDeptTreeList(new SysDeptBo()));
return R.ok(selectVo);
}
/**
* 角色部门列表树信息
*
* @param checkedKeys 选中部门列表
* @param depts 下拉树结构列表
*/
public record DeptTreeSelectVo(List<Long> checkedKeys, List<Tree<Long>> depts) {
}
}
@@ -0,0 +1,324 @@
package cn.aixunkeji.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.digest.BCrypt;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import cn.aixunkeji.common.core.constant.CacheNames;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.core.domain.PageResult;
import cn.aixunkeji.common.core.domain.R;
import cn.aixunkeji.common.core.utils.StreamUtils;
import cn.aixunkeji.common.core.utils.StringUtils;
import cn.aixunkeji.common.encrypt.annotation.ApiEncrypt;
import cn.aixunkeji.common.excel.core.ExcelResult;
import cn.aixunkeji.common.excel.utils.ExcelBuilder;
import cn.aixunkeji.common.log.annotation.Log;
import cn.aixunkeji.common.log.enums.BusinessType;
import cn.aixunkeji.common.mybatis.core.page.PageQuery;
import cn.aixunkeji.common.mybatis.helper.DataPermissionHelper;
import cn.aixunkeji.common.redis.annotation.RepeatSubmit;
import cn.aixunkeji.common.redis.utils.RedisUtils;
import cn.aixunkeji.common.satoken.utils.LoginHelper;
import cn.aixunkeji.common.web.core.BaseController;
import cn.aixunkeji.system.api.model.LoginUser;
import cn.aixunkeji.system.domain.bo.SysDeptBo;
import cn.aixunkeji.system.domain.bo.SysPostBo;
import cn.aixunkeji.system.domain.bo.SysRoleBo;
import cn.aixunkeji.system.domain.bo.SysUserBo;
import cn.aixunkeji.system.domain.vo.*;
import cn.aixunkeji.system.listener.SysUserImportListener;
import cn.aixunkeji.system.service.ISysDeptService;
import cn.aixunkeji.system.service.ISysPostService;
import cn.aixunkeji.system.service.ISysRoleService;
import cn.aixunkeji.system.service.ISysUserService;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
/**
* 用户信息
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/user")
public class SysUserController extends BaseController {
private final ISysUserService userService;
private final ISysRoleService roleService;
private final ISysPostService postService;
private final ISysDeptService deptService;
/**
* 获取用户列表
*/
@SaCheckPermission("system:user:list")
@GetMapping("/list")
public R<PageResult<SysUserVo>> list(SysUserBo user, PageQuery pageQuery) {
return R.ok(userService.selectPageUserList(user, pageQuery));
}
/**
* 导出用户列表
*/
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:user:export")
@PostMapping("/export")
public void export(SysUserBo user, HttpServletResponse response) {
List<SysUserExportVo> list = userService.selectUserExportList(user);
ExcelBuilder.of(list, SysUserExportVo.class).sheetName("用户数据").toResponse(response);
}
/**
* 导入数据
*
* @param file 导入文件
* @param updateSupport 是否更新已存在数据
*/
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@SaCheckPermission("system:user:import")
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
ExcelResult<SysUserImportVo> result = ExcelBuilder.read(file.getInputStream(), SysUserImportVo.class)
.listener(new SysUserImportListener(updateSupport))
.doRead();
return R.ok(result.getAnalysis());
}
/**
* 获取导入模板
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelBuilder.of(new ArrayList<>(), SysUserImportVo.class).sheetName("用户数据").toResponse(response);
}
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("/getInfo")
public R<UserInfoVo> getInfo() {
UserInfoVo userInfoVo = new UserInfoVo();
LoginUser loginUser = LoginHelper.getLoginUser();
SysUserVo user = DataPermissionHelper.ignore(() -> userService.selectUserById(loginUser.getUserId()));
if (ObjectUtil.isNull(user)) {
return R.fail("没有权限访问用户数据!");
}
user.setRoles(roleService.selectRolesByUserId(user.getUserId()));
userInfoVo.setUser(user);
userInfoVo.setPermissions(loginUser.getMenuPermission());
userInfoVo.setRoles(loginUser.getRolePermission());
return R.ok(userInfoVo);
}
/**
* 根据用户编号获取详细信息
*
* @param userId 用户ID
*/
@SaCheckPermission("system:user:query")
@GetMapping(value = {"/", "/{userId}"})
public R<SysUserInfoVo> getInfo(@PathVariable(value = "userId", required = false) Long userId) {
SysUserInfoVo userInfoVo = new SysUserInfoVo();
if (ObjectUtil.isNotNull(userId)) {
userService.checkUserDataScope(userId);
SysUserVo sysUser = userService.selectUserById(userId);
userInfoVo.setUser(sysUser);
userInfoVo.setRoleIds(roleService.selectRoleListByUserId(userId));
Long deptId = sysUser.getDeptId();
if (ObjectUtil.isNotNull(deptId)) {
SysPostBo postBo = new SysPostBo();
postBo.setDeptId(deptId);
userInfoVo.setPosts(postService.selectPostList(postBo));
userInfoVo.setPostIds(postService.selectPostListByUserId(userId));
}
}
SysRoleBo roleBo = new SysRoleBo();
roleBo.setStatus(SystemConstants.NORMAL);
List<SysRoleVo> roles = roleService.selectRoleList(roleBo);
userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin()));
return R.ok(userInfoVo);
}
/**
* 新增用户
*/
@SaCheckPermission("system:user:add")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping
public R<Void> add(@Validated @RequestBody SysUserBo user) {
deptService.checkDeptDataScope(user.getDeptId());
if (!userService.checkUserNameUnique(user)) {
return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) {
return R.fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return R.fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setPassword(BCrypt.hashpw(user.getPassword()));
return toAjax(userService.insertUser(user));
}
/**
* 修改用户
*/
@SaCheckPermission("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping
public R<Void> edit(@Validated @RequestBody SysUserBo user) {
userService.checkUserAllowed(user.getUserId());
userService.checkUserDataScope(user.getUserId());
deptService.checkDeptDataScope(user.getDeptId());
if (!userService.checkUserNameUnique(user)) {
return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) {
return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
return toAjax(userService.updateUser(user));
}
/**
* 删除用户
*
* @param userIds 角色ID串
*/
@SaCheckPermission("system:user:remove")
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public R<Void> remove(@PathVariable Long[] userIds) {
if (ArrayUtil.contains(userIds, LoginHelper.getUserId())) {
return R.fail("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(userIds));
}
/**
* 根据用户ID串批量获取用户基础信息
*
* @param userIds 用户ID串
* @param deptId 部门ID
*/
@SaCheckPermission("system:user:query")
@GetMapping("/optionselect")
public R<List<SysUserVo>> optionselect(@RequestParam(required = false) Long[] userIds,
@RequestParam(required = false) Long deptId) {
return R.ok(userService.selectUserByIds(ArrayUtil.isEmpty(userIds) ? null : List.of(userIds), deptId));
}
/**
* 重置密码
*/
@ApiEncrypt
@SaCheckPermission("system:user:resetPwd")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping("/resetPwd")
public R<Void> resetPwd(@RequestBody SysUserBo user) {
userService.checkUserAllowed(user.getUserId());
userService.checkUserDataScope(user.getUserId());
user.setPassword(BCrypt.hashpw(user.getPassword()));
return toAjax(userService.resetUserPwd(user.getUserId(), user.getPassword()));
}
/**
* 状态修改
*/
@SaCheckPermission("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping("/changeStatus")
public R<Void> changeStatus(@RequestBody SysUserBo user) {
userService.checkUserAllowed(user.getUserId());
userService.checkUserDataScope(user.getUserId());
return toAjax(userService.updateUserStatus(user.getUserId(), user.getStatus()));
}
/**
* 解锁用户
*/
@SaCheckPermission("system:user:edit")
@Log(title = "用户解锁", businessType = BusinessType.OTHER)
@RepeatSubmit()
@GetMapping("/unlock/{userId}")
public R<Void> unlock(@PathVariable Long userId) {
userService.checkUserAllowed(userId);
userService.checkUserDataScope(userId);
SysUserVo user = userService.selectUserById(userId);
if (ObjectUtil.isNull(user)) {
return R.fail("用户不存在");
}
String loginName = CacheNames.PWD_ERR_CNT_KEY + user.getUserName();
if (RedisUtils.hasKey(loginName)) {
RedisUtils.deleteObject(loginName);
}
return R.ok();
}
/**
* 根据用户编号获取授权角色
*
* @param userId 用户ID
*/
@SaCheckPermission("system:user:query")
@GetMapping("/authRole/{userId}")
public R<SysUserInfoVo> authRole(@PathVariable Long userId) {
userService.checkUserDataScope(userId);
SysUserVo user = userService.selectUserById(userId);
List<SysRoleVo> roles = roleService.selectRolesAuthByUserId(userId);
SysUserInfoVo userInfoVo = new SysUserInfoVo();
userInfoVo.setUser(user);
userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin()));
return R.ok(userInfoVo);
}
/**
* 用户授权角色
*
* @param userId 用户Id
* @param roleIds 角色ID串
*/
@SaCheckPermission("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@RepeatSubmit()
@PutMapping("/authRole")
public R<Void> insertAuthRole(Long userId, Long[] roleIds) {
userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds);
return R.ok();
}
/**
* 获取部门树列表
*/
@SaCheckPermission("system:user:list")
@GetMapping("/deptTree")
public R<List<Tree<Long>>> deptTree(SysDeptBo dept) {
return R.ok(deptService.selectDeptTreeList(dept));
}
/**
* 获取部门下的所有用户信息
*/
@SaCheckPermission("system:user:list")
@GetMapping("/list/dept/{deptId}")
public R<List<SysUserVo>> listByDept(@PathVariable @NotNull Long deptId) {
return R.ok(userService.selectUserListByDept(deptId));
}
}
@@ -0,0 +1,88 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
/**
* 授权管理对象 sys_client
*
* @date 2023-05-15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_client")
public class SysClient extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(value = "id")
private Long id;
/**
* 客户端id
*/
private String clientId;
/**
* 客户端key
*/
private String clientKey;
/**
* 客户端秘钥
*/
private String clientSecret;
/**
* 授权类型
*/
private String grantType;
/**
* 设备类型
*/
private String deviceType;
/**
* 允许访问路径
*/
private String accessPath;
/**
* IP白名单
*/
private String ipWhitelist;
/**
* token活跃超时时间
*/
private Long activeTimeout;
/**
* token固定超时时间
*/
private Long timeout;
/**
* 状态(0正常 1停用)
*/
private String status;
/**
* 删除标志(0代表存在 1代表删除)
*/
@TableLogic
private String delFlag;
}
@@ -0,0 +1,50 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
/**
* 参数配置表 sys_config
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_config")
public class SysConfig extends BaseEntity {
/**
* 参数主键
*/
@TableId(value = "config_id")
private Long configId;
/**
* 参数名称
*/
private String configName;
/**
* 参数键名
*/
private String configKey;
/**
* 参数键值
*/
private String configValue;
/**
* 系统内置(Y是 N否)
*/
private String configType;
/**
* 备注
*/
private String remark;
}
@@ -0,0 +1,92 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
/**
* 部门表 sys_dept
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_dept")
public class SysDept extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 部门ID
*/
@TableId(value = "dept_id")
private Long deptId;
/**
* 父部门ID
*/
private Long parentId;
/**
* 部门名称
*/
private String deptName;
/**
* 部门类别编码
*/
private String deptCategory;
/**
* 显示顺序
*/
private Integer orderNum;
/**
* 负责人
*/
private Long leader;
/**
* 联系电话
*/
private String phone;
/**
* 邮箱
*/
private String email;
/**
* 部门状态:0正常,1停用
*/
private String status;
/**
* 删除标志(0代表存在 1代表删除)
*/
@TableLogic
private String delFlag;
/**
* 祖级列表
*/
private String ancestors;
/**
* 子菜单
*/
@TableField(exist = false)
private List<SysDept> children = new ArrayList<>();
}
@@ -0,0 +1,70 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
/**
* 字典数据表 sys_dict_data
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_dict_data")
public class SysDictData extends BaseEntity {
/**
* 字典编码
*/
@TableId(value = "dict_code")
private Long dictCode;
/**
* 字典排序
*/
private Integer dictSort;
/**
* 字典标签
*/
private String dictLabel;
/**
* 字典键值
*/
private String dictValue;
/**
* 字典类型
*/
private String dictType;
/**
* 样式属性(其他样式扩展)
*/
private String cssClass;
/**
* 表格字典样式
*/
private String listClass;
/**
* 是否默认(Y是 N否)
*/
private String isDefault;
/**
* 备注
*/
private String remark;
public boolean getDefault() {
return SystemConstants.YES.equals(this.isDefault);
}
}
@@ -0,0 +1,40 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
/**
* 字典类型表 sys_dict_type
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_dict_type")
public class SysDictType extends BaseEntity {
/**
* 字典主键
*/
@TableId(value = "dict_id")
private Long dictId;
/**
* 字典名称
*/
private String dictName;
/**
* 字典类型
*/
private String dictType;
/**
* 备注
*/
private String remark;
}
@@ -0,0 +1,79 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 系统访问记录表 sys_login_info
*
*/
@Data
@TableName("sys_login_info")
public class SysLoginInfo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId(value = "info_id")
private Long infoId;
/**
* 用户账号
*/
private String userName;
/**
* 客户端
*/
private String clientKey;
/**
* 设备类型
*/
private String deviceType;
/**
* 登录状态 0成功 1失败
*/
private String status;
/**
* 登录IP地址
*/
private String ipaddr;
/**
* 登录地点
*/
private String loginLocation;
/**
* 浏览器类型
*/
private String browser;
/**
* 操作系统
*/
private String os;
/**
* 提示消息
*/
private String msg;
/**
* 访问时间
*/
private LocalDateTime loginTime;
}
@@ -0,0 +1,200 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.core.constant.Constants;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.core.utils.StringUtils;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 菜单权限表 sys_menu
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_menu")
public class SysMenu extends BaseEntity {
/**
* 菜单ID
*/
@TableId(value = "menu_id")
private Long menuId;
/**
* 父菜单ID
*/
private Long parentId;
/**
* 菜单名称
*/
private String menuName;
/**
* 显示顺序
*/
private Integer orderNum;
/**
* 路由地址
*/
private String path;
/**
* 组件路径
*/
private String component;
/**
* 路由参数
*/
private String queryParam;
/**
* 是否为外链(Y是 N否)
*/
private String isFrame;
/**
* 是否缓存(Y缓存 N不缓存)
*/
private String isCache;
/**
* 类型(M目录 C菜单 F按钮)
*/
private String menuType;
/**
* 显示状态(0显示 1隐藏)
*/
private String visible;
/**
* 菜单状态(0正常 1停用)
*/
private String status;
/**
* 权限字符串
*/
private String perms;
/**
* 菜单图标
*/
private String icon;
/**
* 激活菜单路径
*/
private String activeMenu;
/**
* 扩展字段
*/
private String ext;
/**
* 备注
*/
private String remark;
/**
* 父菜单名称
*/
@TableField(exist = false)
private String parentName;
/**
* 子菜单
*/
@TableField(exist = false)
private List<SysMenu> children = new ArrayList<>();
/**
* 获取路由名称
*/
public String getRouteName() {
String routerName = StringUtils.capitalize(path);
// 非外链并且是一级目录(类型为目录)
if (isMenuFrame()) {
routerName = StringUtils.EMPTY;
}
return routerName;
}
/**
* 获取路由地址
*/
public String getRouterPath() {
String routerPath = this.path;
// 内链打开外网方式
if (!Constants.TOP_PARENT_ID.equals(getParentId()) && isInnerLink()) {
routerPath = innerLinkReplaceEach(routerPath);
}
// 非外链并且是一级目录(类型为目录)
if (Constants.TOP_PARENT_ID.equals(getParentId()) && SystemConstants.TYPE_DIR.equals(getMenuType())
&& SystemConstants.NO.equals(getIsFrame())) {
routerPath = "/" + this.path;
}
// 非外链并且是一级目录(类型为菜单)
else if (isMenuFrame()) {
routerPath = "/";
}
return routerPath;
}
/**
* 获取组件信息
*/
public String getComponentInfo() {
String component = SystemConstants.LAYOUT;
if (StringUtils.isNotEmpty(this.component) && !isMenuFrame()) {
component = this.component;
} else if (StringUtils.isEmpty(this.component) && !Constants.TOP_PARENT_ID.equals(getParentId()) && isInnerLink()) {
component = SystemConstants.INNER_LINK;
} else if (StringUtils.isEmpty(this.component) && isParentView()) {
component = SystemConstants.PARENT_VIEW;
}
return component;
}
/**
* 是否为菜单内部跳转
*/
public boolean isMenuFrame() {
return Constants.TOP_PARENT_ID.equals(getParentId()) && SystemConstants.TYPE_MENU.equals(menuType) && isFrame.equals(SystemConstants.NO);
}
/**
* 是否为内链组件
*/
public boolean isInnerLink() {
return isFrame.equals(SystemConstants.NO) && StringUtils.ishttp(path);
}
/**
* 是否为parent_view组件
*/
public boolean isParentView() {
return !Constants.TOP_PARENT_ID.equals(getParentId()) && SystemConstants.TYPE_DIR.equals(menuType);
}
/**
* 内链域名特殊字符替换
*/
public static String innerLinkReplaceEach(String path) {
return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS, Constants.WWW, ".", StringUtils.COLON},
new String[]{"", "", "", "/", "/"});
}
}
@@ -0,0 +1,50 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
/**
* 通知公告表 sys_notice
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_notice")
public class SysNotice extends BaseEntity {
/**
* 公告ID
*/
@TableId(value = "notice_id")
private Long noticeId;
/**
* 公告标题
*/
private String noticeTitle;
/**
* 公告类型(1通知 2公告)
*/
private String noticeType;
/**
* 公告内容
*/
private String noticeContent;
/**
* 公告状态(0正常 1关闭)
*/
private String status;
/**
* 备注
*/
private String remark;
}
@@ -0,0 +1,139 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 操作日志记录表 oper_log
*
*/
@Data
@TableName("sys_oper_log")
public class SysOperLog implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 日志主键
*/
@TableId(value = "oper_id")
private Long operId;
/**
* 操作模块
*/
private String title;
/**
* 业务类型(0其它 1新增 2修改 3删除)
*/
private Integer businessType;
/**
* 请求方法
*/
private String method;
/**
* 请求方式
*/
private String requestMethod;
/**
* 操作类别(0其它 1后台用户 2手机端用户)
*/
private Integer operatorType;
/**
* 操作人员
*/
private String operName;
/**
* 操作用户ID
*/
private Long userId;
/**
* 操作部门ID
*/
private Long deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 客户端
*/
private String clientKey;
/**
* 设备类型
*/
private String deviceType;
/**
* 浏览器类型
*/
private String browser;
/**
* 操作系统
*/
private String os;
/**
* 请求url
*/
private String operUrl;
/**
* 操作地址
*/
private String operIp;
/**
* 操作地点
*/
private String operLocation;
/**
* 请求参数
*/
private String operParam;
/**
* 返回参数
*/
private String jsonResult;
/**
* 操作状态(0正常 1异常)
*/
private Integer status;
/**
* 错误消息
*/
private String errorMsg;
/**
* 操作时间
*/
private LocalDateTime operTime;
/**
* 消耗时间
*/
private Long costTime;
}
@@ -0,0 +1,67 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
/**
* 岗位表 sys_post
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_post")
public class SysPost extends BaseEntity {
/**
* 岗位序号
*/
@TableId(value = "post_id")
private Long postId;
/**
* 部门id
*/
private Long deptId;
/**
* 岗位编码
*/
private String postCode;
/**
* 岗位名称
*/
private String postName;
/**
* 岗位类别编码
*/
private String postCategory;
/**
* 岗位排序
*/
private Integer postSort;
/**
* 状态(0正常 1停用)
*/
private String status;
/**
* 删除标志(0代表存在 1代表删除)
*/
@TableLogic
private String delFlag;
/**
* 备注
*/
private String remark;
}
@@ -0,0 +1,74 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
/**
* 角色表 sys_role
*
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("sys_role")
public class SysRole extends BaseEntity {
/**
* 角色ID
*/
@TableId(value = "role_id")
private Long roleId;
/**
* 角色名称
*/
private String roleName;
/**
* 角色权限
*/
private String roleKey;
/**
* 角色排序
*/
private Integer roleSort;
/**
* 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:部门及以下或本人数据权限)
*/
private String dataScope;
/**
* 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)
*/
private Boolean menuCheckStrictly;
/**
* 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )
*/
private Boolean deptCheckStrictly;
/**
* 角色状态(0正常 1停用)
*/
private String status;
/**
* 删除标志(0代表存在 1代表删除)
*/
@TableLogic
private String delFlag;
/**
* 备注
*/
private String remark;
}
@@ -0,0 +1,28 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 角色和部门关联 sys_role_dept
*
*/
@Data
@TableName("sys_role_dept")
public class SysRoleDept {
/**
* 角色ID
*/
@TableId(type = IdType.INPUT)
private Long roleId;
/**
* 部门ID
*/
private Long deptId;
}
@@ -0,0 +1,28 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 角色和菜单关联 sys_role_menu
*
*/
@Data
@TableName("sys_role_menu")
public class SysRoleMenu {
/**
* 角色ID
*/
@TableId(type = IdType.INPUT)
private Long roleId;
/**
* 菜单ID
*/
private Long menuId;
}
@@ -0,0 +1,135 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
/**
* 社会化关系对象 sys_social
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_social")
public class SysSocial extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id")
private Long id;
/**
* 用户ID
*/
private Long userId;
/**
* 的唯一ID
*/
private String authId;
/**
* 用户来源
*/
private String source;
/**
* 用户的授权令牌
*/
private String accessToken;
/**
* 用户的授权令牌的有效期,部分平台可能没有
*/
private int expireIn;
/**
* 刷新令牌,部分平台可能没有
*/
private String refreshToken;
/**
* 用户的 open id
*/
private String openId;
/**
* 授权的第三方账号
*/
private String userName;
/**
* 授权的第三方昵称
*/
private String nickName;
/**
* 授权的第三方邮箱
*/
private String email;
/**
* 授权的第三方头像地址
*/
private String avatar;
/**
* 平台的授权信息,部分平台可能没有
*/
private String accessCode;
/**
* 用户的 unionid
*/
private String unionId;
/**
* 授予的权限,部分平台可能没有
*/
private String scope;
/**
* 个别平台的授权信息,部分平台可能没有
*/
private String tokenType;
/**
* id token,部分平台可能没有
*/
private String idToken;
/**
* 小米平台用户的附带属性,部分平台可能没有
*/
private String macAlgorithm;
/**
* 小米平台用户的附带属性,部分平台可能没有
*/
private String macKey;
/**
* 用户的授权code,部分平台可能没有
*/
private String code;
/**
* Twitter平台用户的附带属性,部分平台可能没有
*/
private String oauthToken;
/**
* Twitter平台用户的附带属性,部分平台可能没有
*/
private String oauthTokenSecret;
}
@@ -0,0 +1,124 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.mybatis.core.domain.BaseEntity;
import java.time.LocalDateTime;
/**
* 用户对象 sys_user
*
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("sys_user")
public class SysUser extends BaseEntity {
/**
* 用户ID
*/
@TableId(value = "user_id")
private Long userId;
/**
* 部门ID
*/
private Long deptId;
/**
* 用户账号
*/
private String userName;
/**
* 用户昵称
*/
private String nickName;
/**
* 用户类型(sys_user系统用户)
*/
private String userType;
/**
* 用户邮箱
*/
private String email;
/**
* 手机号码
*/
private String phoneNumber;
/**
* 用户性别
*/
private String gender;
/**
* 用户头像
*/
private Long avatar;
/**
* 密码
*/
@TableField(
insertStrategy = FieldStrategy.NOT_EMPTY,
updateStrategy = FieldStrategy.NOT_EMPTY,
whereStrategy = FieldStrategy.NOT_EMPTY
)
private String password;
/**
* 账号状态(0正常 1停用)
*/
private String status;
/**
* 删除标志(0代表存在 1代表删除)
*/
@TableLogic
private String delFlag;
/**
* 最后登录IP
*/
private String loginIp;
/**
* 最后登录时间
*/
private LocalDateTime loginDate;
/**
* 备注
*/
private String remark;
/**
* 使用用户ID构造系统用户对象。
*
* @param userId 用户ID
*/
public SysUser(Long userId) {
this.userId = userId;
}
/**
* 判断当前用户是否为超级管理员。
*
* @return true 是超级管理员 false 不是超级管理员
*/
public boolean isSuperAdmin() {
return SystemConstants.SUPER_ADMIN_USER_ID.equals(this.userId);
}
}
@@ -0,0 +1,28 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 用户和岗位关联 sys_user_post
*
*/
@Data
@TableName("sys_user_post")
public class SysUserPost {
/**
* 用户ID
*/
@TableId(type = IdType.INPUT)
private Long userId;
/**
* 岗位ID
*/
private Long postId;
}
@@ -0,0 +1,28 @@
package cn.aixunkeji.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 用户和角色关联 sys_user_role
*
*/
@Data
@TableName("sys_user_role")
public class SysUserRole {
/**
* 用户ID
*/
@TableId(type = IdType.INPUT)
private Long userId;
/**
* 角色ID
*/
private Long roleId;
}
@@ -0,0 +1,108 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import cn.aixunkeji.common.core.validate.AddGroup;
import cn.aixunkeji.common.core.validate.EditGroup;
import cn.aixunkeji.system.domain.SysClient;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 授权管理业务对象 sys_client
*
*/
@Data
@AutoMapper(target = SysClient.class, reverseConvertGenerate = false)
public class SysClientBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@NotNull(message = "id不能为空", groups = {EditGroup.class})
private Long id;
/**
* 客户端id
*/
private String clientId;
/**
* 客户端key
*/
@NotBlank(message = "客户端key不能为空", groups = {AddGroup.class, EditGroup.class})
private String clientKey;
/**
* 客户端秘钥
*/
@NotBlank(message = "客户端秘钥不能为空", groups = {AddGroup.class, EditGroup.class})
private String clientSecret;
/**
* 授权类型
*/
@NotNull(message = "授权类型不能为空", groups = {AddGroup.class, EditGroup.class})
private List<String> grantTypeList;
/**
* 授权类型
*/
private String grantType;
/**
* 设备类型
*/
private String deviceType;
/**
* 允许访问路径
*/
private String accessPath;
/**
* 允许访问路径列表
*/
private List<String> accessPathList;
/**
* IP白名单
*/
private String ipWhitelist;
/**
* IP白名单列表
*/
private List<String> ipWhitelistList;
/**
* token活跃超时时间
*/
private Long activeTimeout;
/**
* token固定超时时间
*/
private Long timeout;
/**
* 状态(0正常 1停用)
*/
private String status;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,68 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import cn.aixunkeji.system.domain.SysConfig;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 参数配置业务对象 sys_config
*
*/
@Data
@AutoMapper(target = SysConfig.class, reverseConvertGenerate = false)
public class SysConfigBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 参数主键
*/
private Long configId;
/**
* 参数名称
*/
@NotBlank(message = "参数名称不能为空")
@Size(min = 0, max = 100, message = "参数名称不能超过{max}个字符")
private String configName;
/**
* 参数键名
*/
@NotBlank(message = "参数键名不能为空")
@Size(min = 0, max = 100, message = "参数键名长度不能超过{max}个字符")
private String configKey;
/**
* 参数键值
*/
@NotBlank(message = "参数键值不能为空")
@Size(min = 0, max = 500, message = "参数键值长度不能超过{max}个字符")
private String configValue;
/**
* 系统内置(Y是 N否)
*/
private String configType;
/**
* 备注
*/
private String remark;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,90 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import cn.aixunkeji.system.domain.SysDept;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 部门业务对象 sys_dept
*
*/
@Data
@AutoMapper(target = SysDept.class, reverseConvertGenerate = false)
public class SysDeptBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 部门id
*/
private Long deptId;
/**
* 父部门ID
*/
private Long parentId;
/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过{max}个字符")
private String deptName;
/**
* 部门类别编码
*/
@Size(min = 0, max = 100, message = "部门类别编码长度不能超过{max}个字符")
private String deptCategory;
/**
* 显示顺序
*/
@NotNull(message = "显示顺序不能为空")
private Integer orderNum;
/**
* 负责人
*/
private Long leader;
/**
* 联系电话
*/
@Size(min = 0, max = 11, message = "联系电话长度不能超过{max}个字符")
private String phone;
/**
* 邮箱
*/
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过{max}个字符")
private String email;
/**
* 部门状态(0正常 1停用)
*/
private String status;
/**
* 归属部门id(部门树)
*/
private Long belongDeptId;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,88 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import cn.aixunkeji.system.domain.SysDictData;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 字典数据业务对象 sys_dict_data
*
*/
@Data
@AutoMapper(target = SysDictData.class, reverseConvertGenerate = false)
public class SysDictDataBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 字典编码
*/
private Long dictCode;
/**
* 字典排序
*/
private Integer dictSort;
/**
* 字典标签
*/
@NotBlank(message = "字典标签不能为空")
@Size(min = 0, max = 100, message = "字典标签长度不能超过{max}个字符")
private String dictLabel;
/**
* 字典键值
*/
@NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过{max}个字符")
private String dictValue;
/**
* 字典类型
*/
@NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型长度不能超过{max}个字符")
private String dictType;
/**
* 样式属性(其他样式扩展)
*/
@Size(min = 0, max = 100, message = "样式属性长度不能超过{max}个字符")
private String cssClass;
/**
* 表格回显样式
*/
private String listClass;
/**
* 是否默认(Y是 N否)
*/
private String isDefault;
/**
* 创建部门
*/
private Long createDept;
/**
* 备注
*/
private String remark;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,59 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import cn.aixunkeji.common.core.constant.RegexConstants;
import cn.aixunkeji.system.domain.SysDictType;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 字典类型业务对象 sys_dict_type
*
*/
@Data
@AutoMapper(target = SysDictType.class, reverseConvertGenerate = false)
public class SysDictTypeBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 字典主键
*/
private Long dictId;
/**
* 字典名称
*/
@NotBlank(message = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过{max}个字符")
private String dictName;
/**
* 字典类型
*/
@NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过{max}个字符")
@Pattern(regexp = RegexConstants.DICTIONARY_TYPE, message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
private String dictType;
/**
* 备注
*/
private String remark;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,81 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import cn.aixunkeji.system.domain.SysLoginInfo;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* 系统访问记录业务对象 sys_login_info
*
*/
@Data
@AutoMapper(target = SysLoginInfo.class, reverseConvertGenerate = false)
public class SysLoginInfoBo {
/**
* 访问ID
*/
private Long infoId;
/**
* 用户账号
*/
private String userName;
/**
* 客户端
*/
private String clientKey;
/**
* 设备类型
*/
private String deviceType;
/**
* 登录IP地址
*/
private String ipaddr;
/**
* 登录地点
*/
private String loginLocation;
/**
* 浏览器类型
*/
private String browser;
/**
* 操作系统
*/
private String os;
/**
* 登录状态(0成功 1失败)
*/
private String status;
/**
* 提示消息
*/
private String msg;
/**
* 访问时间
*/
private LocalDateTime loginTime;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,136 @@
package cn.aixunkeji.system.domain.bo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import cn.aixunkeji.common.core.constant.RegexConstants;
import cn.aixunkeji.common.json.validate.JsonPattern;
import cn.aixunkeji.common.json.validate.JsonType;
import cn.aixunkeji.system.domain.SysMenu;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 菜单权限业务对象 sys_menu
*
*/
@Data
@AutoMapper(target = SysMenu.class, reverseConvertGenerate = false)
public class SysMenuBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 菜单ID
*/
private Long menuId;
/**
* 父菜单ID
*/
private Long parentId;
/**
* 菜单名称
*/
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过{max}个字符")
private String menuName;
/**
* 显示顺序
*/
@NotNull(message = "显示顺序不能为空")
private Integer orderNum;
/**
* 路由地址
*/
@Size(min = 0, max = 200, message = "路由地址不能超过{max}个字符")
private String path;
/**
* 组件路径
*/
@Size(min = 0, max = 200, message = "组件路径不能超过{max}个字符")
private String component;
/**
* 路由参数
*/
@JsonPattern(type = JsonType.OBJECT, message = "路由参数必须符合JSON格式")
private String queryParam;
/**
* 是否为外链(Y是 N否)
*/
private String isFrame;
/**
* 是否缓存(Y缓存 N不缓存)
*/
private String isCache;
/**
* 菜单类型(M目录 C菜单 F按钮)
*/
@NotBlank(message = "菜单类型不能为空")
private String menuType;
/**
* 显示状态(0显示 1隐藏)
*/
private String visible;
/**
* 菜单状态(0正常 1停用)
*/
private String status;
/**
* 权限标识
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Size(min = 0, max = 100, message = "权限标识长度不能超过{max}个字符")
@Pattern(regexp = RegexConstants.PERMISSION_STRING,
message = "权限标识必须为三段或四段冒号格式,例如 system:user:list 或 aixun:integration:data-source:view")
private String perms;
/**
* 菜单图标
*/
private String icon;
/**
* 激活菜单路径
*/
@Size(min = 0, max = 255, message = "激活菜单路径长度不能超过{max}个字符")
private String activeMenu;
/**
* 扩展字段
*/
@Size(min = 0, max = 2000, message = "扩展字段长度不能超过{max}个字符")
private String ext;
/**
* 备注
*/
private String remark;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,70 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import cn.aixunkeji.common.core.xss.Xss;
import cn.aixunkeji.system.domain.SysNotice;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 通知公告业务对象 sys_notice
*
*/
@Data
@AutoMapper(target = SysNotice.class, reverseConvertGenerate = false)
public class SysNoticeBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 公告ID
*/
private Long noticeId;
/**
* 公告标题
*/
@Xss(message = "公告标题不能包含脚本字符")
@NotBlank(message = "公告标题不能为空")
@Size(min = 0, max = 50, message = "公告标题不能超过{max}个字符")
private String noticeTitle;
/**
* 公告类型(1通知 2公告)
*/
private String noticeType;
/**
* 公告内容
*/
private String noticeContent;
/**
* 公告状态(0正常 1关闭)
*/
private String status;
/**
* 备注
*/
private String remark;
/**
* 创建人名称
*/
private String createByName;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,151 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import cn.aixunkeji.common.log.event.OperLogEvent;
import cn.aixunkeji.system.domain.SysOperLog;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* 操作日志记录业务对象 sys_oper_log
*
* @date 2023-02-07
*/
@Data
@AutoMappers({
@AutoMapper(target = SysOperLog.class, reverseConvertGenerate = false),
@AutoMapper(target = OperLogEvent.class)
})
public class SysOperLogBo {
/**
* 日志主键
*/
private Long operId;
/**
* 模块标题
*/
private String title;
/**
* 业务类型(0其它 1新增 2修改 3删除)
*/
private Integer businessType;
/**
* 业务类型数组
*/
private Integer[] businessTypes;
/**
* 方法名称
*/
private String method;
/**
* 请求方式
*/
private String requestMethod;
/**
* 操作类别(0其它 1后台用户 2手机端用户)
*/
private Integer operatorType;
/**
* 操作人员
*/
private String operName;
/**
* 操作用户ID
*/
private Long userId;
/**
* 操作部门ID
*/
private Long deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 客户端
*/
private String clientKey;
/**
* 设备类型
*/
private String deviceType;
/**
* 浏览器类型
*/
private String browser;
/**
* 操作系统
*/
private String os;
/**
* 请求URL
*/
private String operUrl;
/**
* 主机地址
*/
private String operIp;
/**
* 操作地点
*/
private String operLocation;
/**
* 请求参数
*/
private String operParam;
/**
* 返回参数
*/
private String jsonResult;
/**
* 操作状态(0正常 1异常)
*/
private Integer status;
/**
* 错误消息
*/
private String errorMsg;
/**
* 操作时间
*/
private LocalDateTime operTime;
/**
* 消耗时间
*/
private Long costTime;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,85 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import cn.aixunkeji.system.domain.SysPost;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 岗位信息业务对象 sys_post
*
*/
@Data
@AutoMapper(target = SysPost.class, reverseConvertGenerate = false)
public class SysPostBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 岗位ID
*/
private Long postId;
/**
* 部门id(单部门)
*/
@NotNull(message = "部门id不能为空")
private Long deptId;
/**
* 归属部门id(部门树)
*/
private Long belongDeptId;
/**
* 岗位编码
*/
@NotBlank(message = "岗位编码不能为空")
@Size(min = 0, max = 64, message = "岗位编码长度不能超过{max}个字符")
private String postCode;
/**
* 岗位名称
*/
@NotBlank(message = "岗位名称不能为空")
@Size(min = 0, max = 50, message = "岗位名称长度不能超过{max}个字符")
private String postName;
/**
* 岗位类别编码
*/
@Size(min = 0, max = 100, message = "类别编码长度不能超过{max}个字符")
private String postCategory;
/**
* 显示顺序
*/
@NotNull(message = "显示顺序不能为空")
private Integer postSort;
/**
* 状态(0正常 1停用)
*/
private String status;
/**
* 备注
*/
private String remark;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,104 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.NoArgsConstructor;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.system.domain.SysRole;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 角色信息业务对象 sys_role
*
*/
@Data
@NoArgsConstructor
@AutoMapper(target = SysRole.class, reverseConvertGenerate = false)
public class SysRoleBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
private Long roleId;
/**
* 角色名称
*/
@NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过{max}个字符")
private String roleName;
/**
* 角色权限字符串
*/
@NotBlank(message = "角色权限字符串不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过{max}个字符")
private String roleKey;
/**
* 显示顺序
*/
@NotNull(message = "显示顺序不能为空")
private Integer roleSort;
/**
* 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:部门及以下或本人数据权限)
*/
private String dataScope;
/**
* 菜单树选择项是否关联显示
*/
private Boolean menuCheckStrictly;
/**
* 部门树选择项是否关联显示
*/
private Boolean deptCheckStrictly;
/**
* 角色状态(0正常 1停用)
*/
private String status;
/**
* 备注
*/
private String remark;
/**
* 菜单组
*/
private Long[] menuIds;
/**
* 部门组(数据权限)
*/
private Long[] deptIds;
/**
* 判断当前角色是否为超级管理员角色。
*
* @return true 是超级管理员角色 false 不是超级管理员角色
*/
public boolean isSuperAdmin() {
return SystemConstants.SUPER_ADMIN_ROLE_ID.equals(this.roleId);
}
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,150 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.NoArgsConstructor;
import cn.aixunkeji.common.core.validate.AddGroup;
import cn.aixunkeji.common.core.validate.EditGroup;
import cn.aixunkeji.system.domain.SysSocial;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 社会化关系业务对象 sys_social
*
*/
@Data
@NoArgsConstructor
@AutoMapper(target = SysSocial.class, reverseConvertGenerate = false)
public class SysSocialBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
private Long id;
/**
* 认证唯一ID
*/
@NotBlank(message = "的唯一ID不能为空", groups = {AddGroup.class, EditGroup.class})
private String authId;
/**
* 用户来源
*/
@NotBlank(message = "用户来源不能为空", groups = {AddGroup.class, EditGroup.class})
private String source;
/**
* 用户的授权令牌
*/
@NotBlank(message = "用户的授权令牌不能为空", groups = {AddGroup.class, EditGroup.class})
private String accessToken;
/**
* 用户的授权令牌的有效期,部分平台可能没有
*/
private int expireIn;
/**
* 刷新令牌,部分平台可能没有
*/
private String refreshToken;
/**
* 平台唯一id
*/
private String openId;
/**
* 用户的 ID
*/
@NotBlank(message = "用户的 ID不能为空", groups = {AddGroup.class, EditGroup.class})
private Long userId;
/**
* 平台的授权信息,部分平台可能没有
*/
private String accessCode;
/**
* 用户的 unionid
*/
private String unionId;
/**
* 授予的权限,部分平台可能没有
*/
private String scope;
/**
* 授权的第三方账号
*/
private String userName;
/**
* 授权的第三方昵称
*/
private String nickName;
/**
* 授权的第三方邮箱
*/
private String email;
/**
* 授权的第三方头像地址
*/
private String avatar;
/**
* 个别平台的授权信息,部分平台可能没有
*/
private String tokenType;
/**
* id token,部分平台可能没有
*/
private String idToken;
/**
* 小米平台用户的附带属性,部分平台可能没有
*/
private String macAlgorithm;
/**
* 小米平台用户的附带属性,部分平台可能没有
*/
private String macKey;
/**
* 用户的授权code,部分平台可能没有
*/
private String code;
/**
* Twitter平台用户的附带属性,部分平台可能没有
*/
private String oauthToken;
/**
* Twitter平台用户的附带属性,部分平台可能没有
*/
private String oauthTokenSecret;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,149 @@
package cn.aixunkeji.system.domain.bo;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.NoArgsConstructor;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.core.xss.Xss;
import cn.aixunkeji.system.domain.SysUser;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 用户信息业务对象 sys_user
*
*/
@Data
@NoArgsConstructor
@AutoMapper(target = SysUser.class, reverseConvertGenerate = false)
public class SysUserBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private Long userId;
/**
* 部门ID
*/
private Long deptId;
/**
* 用户账号
*/
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 2, max = 30, message = "用户账号长度必须在{min}到{max}个字符之间")
private String userName;
/**
* 用户昵称
*/
@Xss(message = "用户昵称不能包含脚本字符")
@NotBlank(message = "用户昵称不能为空")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过{max}个字符")
private String nickName;
/**
* 用户类型(sys_user系统用户)
*/
private String userType;
/**
* 用户邮箱
*/
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过{max}个字符")
private String email;
/**
* 手机号码
*/
private String phoneNumber;
/**
* 用户性别(0男 1女 2未知)
*/
private String gender;
/**
* 头像 OSS ID
*/
private Long avatar;
/**
* 密码
*/
private String password;
/**
* 账号状态(0正常 1停用)
*/
private String status;
/**
* 备注
*/
private String remark;
/**
* 角色组
*/
@Size(min = 1, message = "用户角色不能为空")
private Long[] roleIds;
/**
* 岗位组
*/
private Long[] postIds;
/**
* 数据权限 当前角色ID
*/
private Long roleId;
/**
* 用户ID
*/
private String userIds;
/**
* 排除不查询的用户(工作流用)
*/
private String excludeUserIds;
/**
* 创建者
*/
private Long createBy;
/**
* 更新者
*/
private Long updateBy;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
/**
* 判断当前用户是否为超级管理员。
*
* @return true 是超级管理员 false 不是超级管理员
*/
public boolean isSuperAdmin() {
return SystemConstants.SUPER_ADMIN_USER_ID.equals(this.userId);
}
}
@@ -0,0 +1,67 @@
package cn.aixunkeji.system.domain.bo;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.NoArgsConstructor;
import cn.aixunkeji.common.core.constant.RegexConstants;
import cn.aixunkeji.common.core.xss.Xss;
import cn.aixunkeji.common.sensitive.annotation.Sensitive;
import cn.aixunkeji.common.sensitive.core.SensitiveStrategy;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 个人信息业务处理
*
*/
@Data
@NoArgsConstructor
public class SysUserProfileBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户昵称
*/
@Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过{max}个字符")
private String nickName;
/**
* 用户邮箱
*/
@Sensitive(strategy = SensitiveStrategy.EMAIL)
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过{max}个字符")
private String email;
/**
* 手机号码
*/
@Sensitive(strategy = SensitiveStrategy.PHONE)
@Pattern(regexp = RegexConstants.MOBILE, message = "手机号格式不正确")
private String phoneNumber;
/**
* 用户性别(0男 1女 2未知)
*/
private String gender;
/**
* 头像 OSS ID
*/
private Long avatar;
/**
* 请求参数
*/
private Map<String, Object> params = new HashMap<>();
}
@@ -0,0 +1,16 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.vo.RemoteClientVo;
import cn.aixunkeji.system.domain.vo.SysClientVo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 客户端数据转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysClientVoConvert extends BaseMapper<SysClientVo, RemoteClientVo> {
}
@@ -0,0 +1,17 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.vo.RemoteDictDataVo;
import cn.aixunkeji.system.domain.vo.SysDictDataVo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 字典数据转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysDictDataVoConvert extends BaseMapper<SysDictDataVo, RemoteDictDataVo> {
}
@@ -0,0 +1,17 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.vo.RemoteDictTypeVo;
import cn.aixunkeji.system.domain.vo.SysDictTypeVo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 字典类型转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysDictTypeVoConvert extends BaseMapper<SysDictTypeVo, RemoteDictTypeVo> {
}
@@ -0,0 +1,17 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.bo.RemoteLoginInfoBo;
import cn.aixunkeji.system.domain.bo.SysLoginInfoBo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 登录日志转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysLoginInfoBoConvert extends BaseMapper<RemoteLoginInfoBo, SysLoginInfoBo> {
}
@@ -0,0 +1,26 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.bo.RemoteOperLogBo;
import cn.aixunkeji.system.domain.bo.SysOperLogBo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 操作日志转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysOperLogBoConvert extends BaseMapper<RemoteOperLogBo, SysOperLogBo> {
/**
* RemoteOperLogBoToSysOperLogBo
*
* @param remoteOperLogBo 待转换对象
* @return 转换后对象
*/
@Mapping(target = "businessTypes", ignore = true)
SysOperLogBo convert(RemoteOperLogBo remoteOperLogBo);
}
@@ -0,0 +1,16 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.bo.RemoteSocialBo;
import cn.aixunkeji.system.domain.bo.SysSocialBo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 社交数据转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysSocialBoConvert extends BaseMapper<RemoteSocialBo, SysSocialBo> {
}
@@ -0,0 +1,16 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.vo.RemoteSocialVo;
import cn.aixunkeji.system.domain.vo.SysSocialVo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 社交数据转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysSocialVoConvert extends BaseMapper<SysSocialVo, RemoteSocialVo> {
}
@@ -0,0 +1,27 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.bo.RemoteUserBo;
import cn.aixunkeji.system.domain.bo.SysUserBo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 用户信息转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysUserBoConvert extends BaseMapper<RemoteUserBo, SysUserBo> {
/**
* RemoteUserBoToSysUserBo
*
* @param remoteUserBo 待转换对象
* @return 转换后对象
*/
@Mapping(target = "roleIds", ignore = true)
@Mapping(target = "postIds", ignore = true)
SysUserBo convert(RemoteUserBo remoteUserBo);
}
@@ -0,0 +1,17 @@
package cn.aixunkeji.system.domain.convert;
import io.github.linpeilie.BaseMapper;
import cn.aixunkeji.system.api.domain.vo.RemoteUserVo;
import cn.aixunkeji.system.domain.vo.SysUserVo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
/**
* 租户转换器
*
*/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysUserVoConvert extends BaseMapper<SysUserVo, RemoteUserVo> {
}
@@ -0,0 +1,83 @@
package cn.aixunkeji.system.domain.vo;
import lombok.Data;
import cn.aixunkeji.common.core.utils.StringUtils;
import java.io.Serial;
import java.io.Serializable;
/**
* 路由显示信息
*
*/
@Data
public class MetaVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 设置该路由在侧边栏和面包屑中展示的名字
*/
private String title;
/**
* 设置该路由的图标,对应路径src/assets/icons/svg
*/
private String icon;
/**
* 设置为true,则不会被 <keep-alive>缓存
*/
private Boolean noCache;
/**
* 内链地址(http(s)://开头)
*/
private String link;
/**
* 激活菜单
*/
private String activeMenu;
public MetaVo(String title, String icon) {
this.title = title;
this.icon = icon;
}
public MetaVo(String title, String icon, Boolean noCache) {
this.title = title;
this.icon = icon;
this.noCache = noCache;
}
public MetaVo(String title, String icon, String link) {
this.title = title;
this.icon = icon;
this.link = link;
}
public MetaVo(String title, String icon, Boolean noCache, String link) {
this.title = title;
this.icon = icon;
this.noCache = noCache;
if (StringUtils.ishttp(link)) {
this.link = link;
}
}
public MetaVo(String title, String icon, Boolean noCache, String link, String activeMenu) {
this.title = title;
this.icon = icon;
this.noCache = noCache;
if (StringUtils.ishttp(link)) {
this.link = link;
}
if (StringUtils.startWithAnyIgnoreCase(activeMenu, "/")) {
this.activeMenu = activeMenu;
}
}
}
@@ -0,0 +1,89 @@
package cn.aixunkeji.system.domain.vo;
import lombok.Data;
import cn.aixunkeji.common.translation.annotation.Translation;
import cn.aixunkeji.common.translation.constant.TransConstant;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 用户信息视图对象 sys_user
*
*/
@Data
public class ProfileUserVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private Long userId;
/**
* 部门ID
*/
private Long deptId;
/**
* 用户账号
*/
private String userName;
/**
* 用户昵称
*/
private String nickName;
/**
* 用户类型(sys_user系统用户)
*/
private String userType;
/**
* 用户邮箱
*/
private String email;
/**
* 手机号码
*/
private String phoneNumber;
/**
* 用户性别(0男 1女 2未知)
*/
private String gender;
/**
* 头像 OSS ID
*/
private Long avatar;
/**
* 头像地址
*/
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "avatar")
private String avatarUrl;
/**
* 最后登录IP
*/
private String loginIp;
/**
* 最后登录时间
*/
private LocalDateTime loginDate;
/**
* 部门名
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
private String deptName;
}
@@ -0,0 +1,71 @@
package cn.aixunkeji.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* 路由配置信息
*
*/
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RouterVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 路由名字
*/
private String name;
/**
* 路由地址
*/
private String path;
/**
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
*/
private Boolean hidden;
/**
* 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
*/
private String redirect;
/**
* 组件地址
*/
private String component;
/**
* 路由参数:如 {"id": 1, "name": "ry"}
*/
private String query;
/**
* 扩展字段
*/
private String ext;
/**
* 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
*/
private Boolean alwaysShow;
/**
* 其他元素
*/
private MetaVo meta;
/**
* 子路由
*/
private List<RouterVo> children;
}
@@ -0,0 +1,110 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.domain.SysClient;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* 授权管理视图对象 sys_client
*
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysClient.class)
public class SysClientVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@ExcelProperty(value = "id")
private Long id;
/**
* 客户端id
*/
@ExcelProperty(value = "客户端id")
private String clientId;
/**
* 客户端key
*/
@ExcelProperty(value = "客户端key")
private String clientKey;
/**
* 客户端秘钥
*/
@ExcelProperty(value = "客户端秘钥")
private String clientSecret;
/**
* 授权类型
*/
private List<String> grantTypeList;
/**
* 授权类型
*/
@ExcelProperty(value = "授权类型")
private String grantType;
/**
* 设备类型
*/
private String deviceType;
/**
* 允许访问路径
*/
@ExcelProperty(value = "允许访问路径")
private String accessPath;
/**
* 允许访问路径列表
*/
private List<String> accessPathList;
/**
* IP白名单
*/
@ExcelProperty(value = "IP白名单")
private String ipWhitelist;
/**
* IP白名单列表
*/
private List<String> ipWhitelistList;
/**
* token活跃超时时间
*/
@ExcelProperty(value = "token活跃超时时间")
private Long activeTimeout;
/**
* token固定超时时间
*/
@ExcelProperty(value = "token固定超时时间")
private Long timeout;
/**
* 状态(0正常 1停用)
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
private String status;
}
@@ -0,0 +1,71 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.domain.SysConfig;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 参数配置视图对象 sys_config
*
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysConfig.class)
public class SysConfigVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 参数主键
*/
@ExcelProperty(value = "参数主键")
private Long configId;
/**
* 参数名称
*/
@ExcelProperty(value = "参数名称")
private String configName;
/**
* 参数键名
*/
@ExcelProperty(value = "参数键名")
private String configKey;
/**
* 参数键值
*/
@ExcelProperty(value = "参数键值")
private String configValue;
/**
* 系统内置(Y是 N否)
*/
@ExcelProperty(value = "系统内置", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_yes_no")
private String configType;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
}
@@ -0,0 +1,108 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.domain.SysDept;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 部门视图对象 sys_dept
*
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysDept.class)
public class SysDeptVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 部门id
*/
@ExcelProperty(value = "部门id")
private Long deptId;
/**
* 父部门id
*/
private Long parentId;
/**
* 父部门名称
*/
private String parentName;
/**
* 祖级列表
*/
private String ancestors;
/**
* 部门名称
*/
@ExcelProperty(value = "部门名称")
private String deptName;
/**
* 部门类别编码
*/
@ExcelProperty(value = "部门类别编码")
private String deptCategory;
/**
* 显示顺序
*/
private Integer orderNum;
/**
* 负责人ID
*/
private Long leader;
/**
* 负责人
*/
@ExcelProperty(value = "负责人")
private String leaderName;
/**
* 联系电话
*/
@ExcelProperty(value = "联系电话")
private String phone;
/**
* 邮箱
*/
@ExcelProperty(value = "邮箱")
private String email;
/**
* 部门状态(0正常 1停用)
*/
@ExcelProperty(value = "部门状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
/**
* 子菜单
*/
private List<SysDeptVo> children = new ArrayList<>();
}
@@ -0,0 +1,87 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.domain.SysDictData;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 字典数据视图对象 sys_dict_data
*
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysDictData.class)
public class SysDictDataVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 字典编码
*/
@ExcelProperty(value = "字典编码")
private Long dictCode;
/**
* 字典排序
*/
@ExcelProperty(value = "字典排序")
private Integer dictSort;
/**
* 字典标签
*/
@ExcelProperty(value = "字典标签")
private String dictLabel;
/**
* 字典键值
*/
@ExcelProperty(value = "字典键值")
private String dictValue;
/**
* 字典类型
*/
@ExcelProperty(value = "字典类型")
private String dictType;
/**
* 样式属性(其他样式扩展)
*/
private String cssClass;
/**
* 表格回显样式
*/
private String listClass;
/**
* 是否默认(Y是 N否)
*/
@ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_yes_no")
private String isDefault;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
}
@@ -0,0 +1,56 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.system.domain.SysDictType;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 字典类型视图对象 sys_dict_type
*
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysDictType.class)
public class SysDictTypeVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 字典主键
*/
@ExcelProperty(value = "字典主键")
private Long dictId;
/**
* 字典名称
*/
@ExcelProperty(value = "字典名称")
private String dictName;
/**
* 字典类型
*/
@ExcelProperty(value = "字典类型")
private String dictType;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
}
@@ -0,0 +1,99 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.domain.SysLoginInfo;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 系统访问记录视图对象 sys_login_info
*
* @date 2023-02-07
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysLoginInfo.class)
public class SysLoginInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 访问ID
*/
@ExcelProperty(value = "序号")
private Long infoId;
/**
* 用户账号
*/
@ExcelProperty(value = "用户账号")
private String userName;
/**
* 客户端
*/
@ExcelProperty(value = "客户端")
private String clientKey;
/**
* 设备类型
*/
@ExcelProperty(value = "设备类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_device_type")
private String deviceType;
/**
* 登录状态(0成功 1失败)
*/
@ExcelProperty(value = "登录状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private String status;
/**
* 登录IP地址
*/
@ExcelProperty(value = "登录地址")
private String ipaddr;
/**
* 登录地点
*/
@ExcelProperty(value = "登录地点")
private String loginLocation;
/**
* 浏览器类型
*/
@ExcelProperty(value = "浏览器")
private String browser;
/**
* 操作系统
*/
@ExcelProperty(value = "操作系统")
private String os;
/**
* 提示消息
*/
@ExcelProperty(value = "提示消息")
private String msg;
/**
* 访问时间
*/
@ExcelProperty(value = "访问时间")
private LocalDateTime loginTime;
}
@@ -0,0 +1,125 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import cn.aixunkeji.system.domain.SysMenu;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 菜单权限视图对象 sys_menu
*
*/
@Data
@AutoMapper(target = SysMenu.class)
public class SysMenuVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 菜单ID
*/
private Long menuId;
/**
* 菜单名称
*/
private String menuName;
/**
* 父菜单ID
*/
private Long parentId;
/**
* 显示顺序
*/
private Integer orderNum;
/**
* 路由地址
*/
private String path;
/**
* 组件路径
*/
private String component;
/**
* 路由参数
*/
private String queryParam;
/**
* 是否为外链(Y是 N否)
*/
private String isFrame;
/**
* 是否缓存(Y缓存 N不缓存)
*/
private String isCache;
/**
* 菜单类型(M目录 C菜单 F按钮)
*/
private String menuType;
/**
* 显示状态(0显示 1隐藏)
*/
private String visible;
/**
* 菜单状态(0正常 1停用)
*/
private String status;
/**
* 权限标识
*/
private String perms;
/**
* 菜单图标
*/
private String icon;
/**
* 激活菜单路径
*/
private String activeMenu;
/**
* 扩展字段
*/
private String ext;
/**
* 创建部门
*/
private Long createDept;
/**
* 备注
*/
private String remark;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 子菜单
*/
private List<SysMenuVo> children = new ArrayList<>();
}
@@ -0,0 +1,71 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import cn.aixunkeji.common.translation.annotation.Translation;
import cn.aixunkeji.common.translation.constant.TransConstant;
import cn.aixunkeji.system.domain.SysNotice;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 通知公告视图对象 sys_notice
*
*/
@Data
@AutoMapper(target = SysNotice.class)
public class SysNoticeVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 公告ID
*/
private Long noticeId;
/**
* 公告标题
*/
private String noticeTitle;
/**
* 公告类型(1通知 2公告)
*/
private String noticeType;
/**
* 公告内容
*/
private String noticeContent;
/**
* 公告状态(0正常 1关闭)
*/
private String status;
/**
* 备注
*/
private String remark;
/**
* 创建者
*/
private Long createBy;
/**
* 创建人名称
*/
@Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "createBy")
private String createByName;
/**
* 创建时间
*/
private LocalDateTime createTime;
}
@@ -0,0 +1,175 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.domain.SysOperLog;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 操作日志记录视图对象 sys_oper_log
*
* @date 2023-02-07
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysOperLog.class)
public class SysOperLogVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 日志主键
*/
@ExcelProperty(value = "日志主键")
private Long operId;
/**
* 模块标题
*/
@ExcelProperty(value = "操作模块")
private String title;
/**
* 业务类型(0其它 1新增 2修改 3删除)
*/
@ExcelProperty(value = "业务类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_oper_type")
private Integer businessType;
/**
* 业务类型数组
*/
private Integer[] businessTypes;
/**
* 方法名称
*/
@ExcelProperty(value = "请求方法")
private String method;
/**
* 请求方式
*/
@ExcelProperty(value = "请求方式")
private String requestMethod;
/**
* 操作类别(0其它 1后台用户 2手机端用户)
*/
@ExcelProperty(value = "操作类别", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=其它,1=后台用户,2=手机端用户")
private Integer operatorType;
/**
* 操作人员
*/
@ExcelProperty(value = "操作人员")
private String operName;
/**
* 操作用户ID
*/
@ExcelProperty(value = "操作用户ID")
private Long userId;
/**
* 操作部门ID
*/
@ExcelProperty(value = "操作部门ID")
private Long deptId;
/**
* 部门名称
*/
@ExcelProperty(value = "部门名称")
private String deptName;
/**
* 客户端
*/
@ExcelProperty(value = "客户端")
private String clientKey;
/**
* 设备类型
*/
@ExcelProperty(value = "设备类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_device_type")
private String deviceType;
/**
* 浏览器类型
*/
@ExcelProperty(value = "浏览器")
private String browser;
/**
* 操作系统
*/
@ExcelProperty(value = "操作系统")
private String os;
/**
* 请求URL
*/
@ExcelProperty(value = "请求地址")
private String operUrl;
/**
* 主机地址
*/
@ExcelProperty(value = "操作地址")
private String operIp;
/**
* 操作地点
*/
@ExcelProperty(value = "操作地点")
private String operLocation;
/**
* 请求参数
*/
@ExcelProperty(value = "请求参数")
private String operParam;
/**
* 返回参数
*/
@ExcelProperty(value = "返回参数")
private String jsonResult;
/**
* 操作状态(0正常 1异常)
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private Integer status;
/**
* 错误消息
*/
@ExcelProperty(value = "错误消息")
private String errorMsg;
/**
* 操作时间
*/
@ExcelProperty(value = "操作时间")
private LocalDateTime operTime;
/**
* 消耗时间
*/
@ExcelProperty(value = "消耗时间")
private Long costTime;
}
@@ -0,0 +1,91 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.common.translation.annotation.Translation;
import cn.aixunkeji.common.translation.constant.TransConstant;
import cn.aixunkeji.system.domain.SysPost;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 岗位信息视图对象 sys_post
*
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysPost.class)
public class SysPostVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 岗位ID
*/
@ExcelProperty(value = "岗位序号")
private Long postId;
/**
* 部门id
*/
@ExcelProperty(value = "部门id")
private Long deptId;
/**
* 岗位编码
*/
@ExcelProperty(value = "岗位编码")
private String postCode;
/**
* 岗位名称
*/
@ExcelProperty(value = "岗位名称")
private String postName;
/**
* 岗位类别编码
*/
@ExcelProperty(value = "类别编码")
private String postCategory;
/**
* 显示顺序
*/
@ExcelProperty(value = "岗位排序")
private Integer postSort;
/**
* 状态(0正常 1停用)
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
/**
* 部门名
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
private String deptName;
}
@@ -0,0 +1,26 @@
package cn.aixunkeji.system.domain.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 角色菜单权限视图
*/
@Data
public class SysRoleMenuPermVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
private Long roleId;
/**
* 权限字符串
*/
private String perms;
}
@@ -0,0 +1,104 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.apache.fesod.sheet.annotation.ExcelIgnoreUnannotated;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.core.constant.SystemConstants;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.domain.SysRole;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 角色信息视图对象 sys_role
*
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysRole.class)
public class SysRoleVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
@ExcelProperty(value = "角色序号")
private Long roleId;
/**
* 角色名称
*/
@ExcelProperty(value = "角色名称")
private String roleName;
/**
* 角色权限字符串
*/
@ExcelProperty(value = "角色权限")
private String roleKey;
/**
* 显示顺序
*/
@ExcelProperty(value = "角色排序")
private Integer roleSort;
/**
* 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:部门及以下或本人数据权限)
*/
@ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=全部数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限,6=部门及以下或本人数据权限")
private String dataScope;
/**
* 菜单树选择项是否关联显示
*/
@ExcelProperty(value = "菜单树选择项是否关联显示")
private Boolean menuCheckStrictly;
/**
* 部门树选择项是否关联显示
*/
@ExcelProperty(value = "部门树选择项是否关联显示")
private Boolean deptCheckStrictly;
/**
* 角色状态(0正常 1停用)
*/
@ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
/**
* 用户是否存在此角色标识 默认不存在
*/
private boolean flag = false;
/**
* 判断当前角色是否为超级管理员角色。
*
* @return true 是超级管理员角色 false 不是超级管理员角色
*/
public boolean isSuperAdmin() {
return SystemConstants.SUPER_ADMIN_ROLE_ID.equals(this.roleId);
}
}
@@ -0,0 +1,138 @@
package cn.aixunkeji.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import cn.aixunkeji.system.domain.SysSocial;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 社会化关系视图对象 sys_social
*
*/
@Data
@AutoMapper(target = SysSocial.class)
public class SysSocialVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 用户ID
*/
private Long userId;
/**
* 认证唯一ID
*/
private String authId;
/**
* 用户来源
*/
private String source;
/**
* 用户的授权令牌
*/
private String accessToken;
/**
* 用户的授权令牌的有效期,部分平台可能没有
*/
private int expireIn;
/**
* 刷新令牌,部分平台可能没有
*/
private String refreshToken;
/**
* 用户的 open id
*/
private String openId;
/**
* 授权的第三方账号
*/
private String userName;
/**
* 授权的第三方昵称
*/
private String nickName;
/**
* 授权的第三方邮箱
*/
private String email;
/**
* 授权的第三方头像地址
*/
private String avatar;
/**
* 平台的授权信息,部分平台可能没有
*/
private String accessCode;
/**
* 用户的 unionid
*/
private String unionId;
/**
* 授予的权限,部分平台可能没有
*/
private String scope;
/**
* 个别平台的授权信息,部分平台可能没有
*/
private String tokenType;
/**
* id token,部分平台可能没有
*/
private String idToken;
/**
* 小米平台用户的附带属性,部分平台可能没有
*/
private String macAlgorithm;
/**
* 小米平台用户的附带属性,部分平台可能没有
*/
private String macKey;
/**
* 用户的授权code,部分平台可能没有
*/
private String code;
/**
* Twitter平台用户的附带属性,部分平台可能没有
*/
private String oauthToken;
/**
* Twitter平台用户的附带属性,部分平台可能没有
*/
private String oauthTokenSecret;
/**
* 显示绑定时间
*/
private LocalDateTime createTime;
}
@@ -0,0 +1,94 @@
package cn.aixunkeji.system.domain.vo;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.listener.DeptExcelConverter;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 用户对象导出VO
*
*/
@Data
@NoArgsConstructor
public class SysUserExportVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
@ExcelProperty(value = "用户序号")
private Long userId;
/**
* 用户账号
*/
@ExcelProperty(value = "用户账号")
private String userName;
/**
* 部门ID
*/
@ExcelProperty(value = "部门名称", converter = DeptExcelConverter.class)
private Long deptId;
/**
* 用户昵称
*/
@ExcelProperty(value = "用户昵称")
private String nickName;
/**
* 用户邮箱
*/
@ExcelProperty(value = "用户邮箱")
private String email;
/**
* 手机号码
*/
@ExcelProperty(value = "手机号码")
private String phoneNumber;
/**
* 用户性别(0男 1女 2未知)
*/
@ExcelProperty(value = "用户性别", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_user_gender")
private String gender;
/**
* 账号状态(0正常 1停用)
*/
@ExcelProperty(value = "账号状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;
/**
* 最后登录IP
*/
@ExcelProperty(value = "最后登录IP")
private String loginIp;
/**
* 最后登录时间
*/
@ExcelProperty(value = "最后登录时间")
private LocalDateTime loginDate;
/**
* 负责人
*/
@ExcelProperty(value = "部门负责人")
private String leaderName;
}
@@ -0,0 +1,80 @@
package cn.aixunkeji.system.domain.vo;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.fesod.sheet.annotation.ExcelProperty;
import cn.aixunkeji.common.excel.annotation.ExcelDictFormat;
import cn.aixunkeji.common.excel.annotation.ExcelDynamicOptions;
import cn.aixunkeji.common.excel.convert.ExcelDictConvert;
import cn.aixunkeji.system.listener.DeptExcelConverter;
import cn.aixunkeji.system.listener.DeptExcelOptions;
import java.io.Serial;
import java.io.Serializable;
/**
* 用户对象导入VO
*
*/
@Data
@NoArgsConstructor
// @Accessors(chain = true) // 导入不允许使用 会找不到set方法
public class SysUserImportVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
@ExcelProperty(value = "用户序号")
private Long userId;
/**
* 部门ID
*/
@ExcelProperty(value = "部门名称", converter = DeptExcelConverter.class)
@ExcelDynamicOptions(providerClass = DeptExcelOptions.class)
private Long deptId;
/**
* 用户账号
*/
@ExcelProperty(value = "用户账号")
private String userName;
/**
* 用户昵称
*/
@ExcelProperty(value = "用户昵称")
private String nickName;
/**
* 用户邮箱
*/
@ExcelProperty(value = "用户邮箱")
private String email;
/**
* 手机号码
*/
@ExcelProperty(value = "手机号码")
private String phoneNumber;
/**
* 用户性别(0男 1女 2未知)
*/
@ExcelProperty(value = "用户性别", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_user_gender")
private String gender;
/**
* 账号状态(0正常 1停用)
*/
@ExcelProperty(value = "账号状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;
}
@@ -0,0 +1,44 @@
package cn.aixunkeji.system.domain.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* 用户信息
*
*/
@Data
public class SysUserInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户信息
*/
private SysUserVo user;
/**
* 角色ID列表
*/
private List<Long> roleIds;
/**
* 角色列表
*/
private List<SysRoleVo> roles;
/**
* 岗位ID列表
*/
private List<Long> postIds;
/**
* 岗位列表
*/
private List<SysPostVo> posts;
}
@@ -0,0 +1,146 @@
package cn.aixunkeji.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import cn.aixunkeji.common.sensitive.annotation.Sensitive;
import cn.aixunkeji.common.sensitive.core.SensitiveStrategy;
import cn.aixunkeji.common.translation.annotation.Translation;
import cn.aixunkeji.common.translation.constant.TransConstant;
import cn.aixunkeji.system.domain.SysUser;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* 用户信息视图对象 sys_user
*
*/
@Data
@AutoMapper(target = SysUser.class)
public class SysUserVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private Long userId;
/**
* 部门ID
*/
private Long deptId;
/**
* 用户账号
*/
private String userName;
/**
* 用户昵称
*/
private String nickName;
/**
* 用户类型(sys_user系统用户)
*/
private String userType;
/**
* 用户邮箱
*/
@Sensitive(strategy = SensitiveStrategy.EMAIL, perms = "system:user:edit")
private String email;
/**
* 手机号码
*/
@Sensitive(strategy = SensitiveStrategy.PHONE, perms = "system:user:edit")
private String phoneNumber;
/**
* 用户性别(0男 1女 2未知)
*/
private String gender;
/**
* 头像 OSS ID
*/
private Long avatar;
/**
* 头像地址
*/
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "avatar")
private String avatarUrl;
/**
* 密码
*/
@JsonIgnore
@JsonProperty
private String password;
/**
* 账号状态(0正常 1停用)
*/
private String status;
/**
* 最后登录IP
*/
private String loginIp;
/**
* 最后登录时间
*/
private LocalDateTime loginDate;
/**
* 备注
*/
private String remark;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 部门名
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
private String deptName;
/**
* 角色对象
*/
private List<SysRoleVo> roles;
/**
* 角色组
*/
private Long[] roleIds;
/**
* 岗位组
*/
private Long[] postIds;
/**
* 数据权限 当前角色ID
*/
private Long roleId;
}
@@ -0,0 +1,34 @@
package cn.aixunkeji.system.domain.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Set;
/**
* 登录用户信息
*
*/
@Data
public class UserInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户基本信息
*/
private SysUserVo user;
/**
* 菜单权限
*/
private Set<String> permissions;
/**
* 角色权限
*/
private Set<String> roles;
}
@@ -0,0 +1,18 @@
package cn.aixunkeji.system.dubbo;
import java.util.*;
final class BusinessActionPermissions {
private BusinessActionPermissions() { }
private static final Map<String,String> PERMISSIONS;
static {
var values=new HashMap<String,String>();
add(values,"dataset-publication","view","version","schema","create","update","publish","status");
add(values,"metric-self-service","view","history","share","create","update","copy","export");
add(values,"data-exchange","view","history","create","update","ready","execute","reconcile");
PERMISSIONS=Map.copyOf(values);
}
private static void add(Map<String,String> values,String module,String... actions){for(String action:actions)
values.put("NATIVE_ACTION_"+module.replace('-','_').toUpperCase(Locale.ROOT)+"_"+action.toUpperCase(Locale.ROOT),"aixun:dataproduct:"+module+":"+action);}
static String permission(String purpose){return PERMISSIONS.get(purpose);}
}
@@ -0,0 +1,9 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
final class ChainStagePermissions {
private ChainStagePermissions() { }
static List<String> required(String purpose){return switch(purpose){
case "CHAIN_STAGE_VIEW"->List.of("aixun:dataops:chain-metric:view","aixun:dataops:golden-chain:view","aixun:dataops:task-log:view");
case "CHAIN_STAGE_AI"->List.of("aixun:dataops:chain-metric:view","aixun:dataops:golden-chain:view","aixun:dataops:task-log:view","aixun:ai:workbench:generate");
default->List.of();};}
}
@@ -0,0 +1,10 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
final class ComponentObservationPermissions {
private ComponentObservationPermissions() { }
static List<String> required(String purpose){return switch(purpose){
case "EXTERNAL_COMPONENT_OBSERVATION_VIEW" -> List.of("aixun:integration:external-entry:view","aixun:integration:collection-node:view");
case "EXTERNAL_COMPONENT_OBSERVATION_AI" -> List.of("aixun:integration:external-entry:view","aixun:integration:collection-node:view","aixun:ai:workbench:generate");
default -> List.of();
};}
}
@@ -0,0 +1,16 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
import java.util.Set;
final class DatasetAnnotationReviewPermissions {
private DatasetAnnotationReviewPermissions() { }
static boolean supports(String purpose) {
return purpose != null && Set.of("ANNOTATION_REVIEW_ASSIST_VIEW", "ANNOTATION_REVIEW_ASSIST_AI").contains(purpose);
}
static List<String> required(String purpose) {
if (!supports(purpose)) return List.of();
String view = "aixun:dataproduct:dataset-annotation:view", review = "aixun:dataproduct:dataset-annotation:review";
return purpose.equals("ANNOTATION_REVIEW_ASSIST_AI") ? List.of(view, review, "aixun:ai:workbench:generate") : List.of(view, review);
}
}
@@ -0,0 +1,8 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
import java.util.Set;
final class DatasetSchemaAssistPermissions {
private DatasetSchemaAssistPermissions() { }
static boolean supports(String purpose){return purpose!=null&&Set.of("DATASET_SOURCE_VIEW","DATASET_SOURCE_SCHEMA","DATASET_SOURCE_CREATE","DATASET_SOURCE_UPDATE","DATASET_SOURCE_AI").contains(purpose);}
static List<String> required(String purpose){if(!supports(purpose))return List.of();String view="aixun:dataproduct:dataset-publication:view",source="aixun:governance:asset-catalog:view";if(purpose.equals("DATASET_SOURCE_VIEW"))return List.of(view,source);if(purpose.equals("DATASET_SOURCE_AI"))return List.of(view,source,"aixun:ai:workbench:generate");return List.of(view,source,"aixun:dataproduct:dataset-publication:"+purpose.substring("DATASET_SOURCE_".length()).toLowerCase(java.util.Locale.ROOT));}
}
@@ -0,0 +1,16 @@
package cn.aixunkeji.system.dubbo;
import java.util.Map;
final class EngineeringAssistPermissions {
private static final Map<String,String> TYPES=Map.ofEntries(
Map.entry("UNIFIED_INGESTION","batch-ingestion"),Map.entry("BATCH_INGESTION","batch-ingestion"),
Map.entry("FILE_INGESTION","file-ingestion"),Map.entry("TRANSFORMATION","transformation-cleaning"),
Map.entry("TABLE_STRUCTURE","table-file"),Map.entry("LAKEHOUSE_LAYER","lakehouse-layer"),
Map.entry("VISUAL_DEVELOPMENT","visual-development"),Map.entry("DATA_TEST","data-test"),Map.entry("SCHEDULE","schedule"));
static String permission(String purpose) {
String page=purpose!=null&&purpose.startsWith("ENGINEERING_AI_")?TYPES.get(purpose.substring(15)):null;
return page==null?null:"aixun:dataops:"+page+":view";
}
private EngineeringAssistPermissions() { }
}
@@ -0,0 +1,36 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
import java.util.Map;
final class EngineeringContextPermissions {
private EngineeringContextPermissions() { }
private static final Map<String,List<String>> PURPOSES=Map.ofEntries(
Map.entry("ENGINEERING_CONTEXT_DATA_TEST",List.of("aixun:dataops:data-test:view")),
Map.entry("ENGINEERING_CONTEXT_SCHEDULE",List.of("aixun:dataops:schedule:view")),
Map.entry("ENGINEERING_CONTEXT_UNIFIED_INGESTION",List.of("aixun:dataops:batch-ingestion:view")),
Map.entry("ENGINEERING_CONTEXT_BATCH_INGESTION",List.of("aixun:dataops:batch-ingestion:view","aixun:dataops:table-file:view","aixun:integration:data-source:browse")),
Map.entry("ENGINEERING_CONTEXT_LAKEHOUSE_LAYER",List.of("aixun:dataops:lakehouse-layer:view")),
Map.entry("ENGINEERING_CONTEXT_TABLE_STRUCTURE",List.of("aixun:dataops:table-file:view")),
Map.entry("ENGINEERING_CONTEXT_TRANSFORMATION",List.of("aixun:dataops:transformation-cleaning:view","aixun:dataops:table-file:view")),
Map.entry("ENGINEERING_REFERENCE_PUBLICATION",List.of("aixun:governance:reference-data:view")),
Map.entry("ENGINEERING_CONTEXT_VISUAL_DEVELOPMENT",List.of("aixun:dataops:visual-development:view","aixun:dataops:table-file:view","aixun:integration:data-source:browse","aixun:integration:data-source:preview")),
Map.entry("ENGINEERING_REFERENCE_LAYER",List.of("aixun:dataops:lakehouse-layer:view")),
Map.entry("ENGINEERING_REFERENCE_CODE_OBJECT",List.of("aixun:dataops:code-development:view")),
Map.entry("ENGINEERING_REFERENCE_BATCH_JOB",List.of("aixun:dataops:batch-job:view")),
Map.entry("ENGINEERING_REFERENCE_TRANSFORMATION",List.of("aixun:dataops:transformation-cleaning:view")),
Map.entry("ENGINEERING_REFERENCE_SCHEDULE",List.of("aixun:dataops:schedule:view")),
Map.entry("ENGINEERING_REFERENCE_QUALITY_RULE",List.of("aixun:governance:quality-rule:view")),
Map.entry("ENGINEERING_REFERENCE_METADATA_SCAN",List.of("aixun:governance:metadata-ingestion:view")),
Map.entry("ENGINEERING_REFERENCE_STANDARD_VALIDATE",List.of("aixun:governance:standard-adoption:view")),
Map.entry("ENGINEERING_REFERENCE_CLASSIFICATION_IDENTIFY",List.of("aixun:governance:security-classification:view","aixun:governance:metadata-catalog:view","aixun:integration:data-source:preview")),
Map.entry("ENGINEERING_REFERENCE_REMEDIATION_CREATE",List.of("aixun:governance:quality-remediation:view","aixun:governance:quality-remediation:create")),
Map.entry("ENGINEERING_REFERENCE_ASSET_REGISTER",List.of("aixun:governance:asset-catalog:view","aixun:governance:asset-inventory:view")),
Map.entry("ENGINEERING_REFERENCE_ASSET_UPDATE",List.of("aixun:governance:asset-detail:view","aixun:governance:metadata-catalog:view","aixun:governance:metadata-lineage:view","aixun:integration:data-source:preview")),
Map.entry("ENGINEERING_REFERENCE_LIFECYCLE_ACTION",List.of("aixun:governance:asset-lifecycle:view")),
Map.entry("ENGINEERING_REFERENCE_MASKING",List.of("aixun:governance:data-protection:view","aixun:dataops:transformation-cleaning:view","aixun:dataops:table-file:view","aixun:governance:metadata-catalog:view","aixun:integration:data-source:preview")),
Map.entry("ENGINEERING_REFERENCE_ALERT_NOTIFY",List.of("aixun:dataops:alert-event:view")),
Map.entry("ENGINEERING_REFERENCE_TABLE_FILE",List.of("aixun:dataops:table-file:view")),
Map.entry("ENGINEERING_REFERENCE_SOURCE",List.of("aixun:integration:data-source:preview")),
Map.entry("ENGINEERING_REFERENCE_STORAGE",List.of("aixun:dataops:storage-resource:view"))
);
static List<String> required(String purpose){return PURPOSES.getOrDefault(purpose,List.of());}
}
@@ -0,0 +1,19 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
import java.util.Map;
final class EngineeringDraftPermissions {
private static final Map<String,List<String>> ACTIONS=Map.ofEntries(
Map.entry("ENGINEERING_DRAFT_UNIFIED_INGESTION_VIEW",List.of("batch-ingestion:view")),
Map.entry("ENGINEERING_DRAFT_UNIFIED_INGESTION_CREATE",List.of("batch-ingestion:create")),
Map.entry("ENGINEERING_DRAFT_UNIFIED_INGESTION_UPDATE",List.of("batch-ingestion:update")),
Map.entry("ENGINEERING_DRAFT_UNIFIED_INGESTION_ACTIVATE",List.of("batch-ingestion:view","batch-ingestion:create","batch-ingestion:update","batch-ingestion:submit")),
Map.entry("ENGINEERING_DRAFT_TABLE_STRUCTURE_VIEW",List.of("table-file:view")),
Map.entry("ENGINEERING_DRAFT_TABLE_STRUCTURE_CREATE",List.of("table-file:create")),
Map.entry("ENGINEERING_DRAFT_TABLE_STRUCTURE_UPDATE",List.of("table-file:update")),
Map.entry("ENGINEERING_DRAFT_TABLE_STRUCTURE_ACTIVATE",List.of("table-file:view","table-file:create")));
static List<String> required(String purpose) { return ACTIONS.getOrDefault(purpose,List.of()).stream().map(p->"aixun:dataops:"+p).toList(); }
static String permission(String purpose) { var values=required(purpose);return values.isEmpty()?null:values.getFirst(); }
private EngineeringDraftPermissions() { }
}
@@ -0,0 +1,17 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
final class FilePreviewPermissions {
private FilePreviewPermissions() { }
static boolean supports(String purpose) { return purpose != null && purpose.startsWith("FILE_PREVIEW_"); }
static List<String> required(String purpose) {
return switch (purpose) {
case "FILE_PREVIEW_VIEW" -> List.of("aixun:dataops:file-ingestion:view", "aixun:dataops:file-ingestion:preview");
case "FILE_PREVIEW_TARGET" -> List.of("aixun:dataops:file-ingestion:view", "aixun:dataops:file-ingestion:preview",
"aixun:dataops:table-file:view", "aixun:dataops:storage-resource:view");
case "FILE_PREVIEW_AI" -> List.of("aixun:dataops:file-ingestion:view", "aixun:dataops:file-ingestion:preview", "aixun:ai:workbench:generate");
default -> List.of();
};
}
}
@@ -0,0 +1,18 @@
package cn.aixunkeji.system.dubbo;
import java.util.Map;
final class FormAssistPermissions {
private static final Map<String,String> PAGES=Map.ofEntries(
Map.entry("P26","aixun:governance:meta-model:view"),Map.entry("P32","aixun:governance:asset-catalog:view"),
Map.entry("P36","aixun:governance:standard-system:view"),Map.entry("P37","aixun:governance:business-term:view"),
Map.entry("P38","aixun:governance:data-element:view"),Map.entry("P39","aixun:governance:reference-data:view"),
Map.entry("P43","aixun:governance:master-data-model:view"),Map.entry("P49","aixun:governance:model-repository:view"),
Map.entry("P50","aixun:governance:model-design:view"),Map.entry("P53","aixun:governance:quality-model:view"),
Map.entry("P65","aixun:dataproduct:metric-system:view"),Map.entry("P67","aixun:dataproduct:semantic-model:view"),
Map.entry("P73","aixun:dataproduct:dataset-publication:view"),Map.entry("P74","aixun:dataproduct:api-development:view"));
static String permission(String purpose) {
return purpose!=null&&purpose.startsWith("FORM_AI_")?PAGES.get(purpose.substring(8)):null;
}
private FormAssistPermissions() { }
}
@@ -0,0 +1,12 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
import java.util.Set;
final class GatewayPolicyDiffPermissions {
private GatewayPolicyDiffPermissions() { }
static boolean supports(String purpose){return purpose!=null&&Set.of("GATEWAY_DIFF_VIEW","GATEWAY_DIFF_HISTORY","GATEWAY_DIFF_AI").contains(purpose);}
static List<String> required(String purpose){
if(!supports(purpose))return List.of();
String view="aixun:dataproduct:service-gateway:view",api="aixun:dataproduct:api-development:view";
return switch(purpose){case "GATEWAY_DIFF_HISTORY"->List.of(view,api,"aixun:dataproduct:service-gateway:history");case "GATEWAY_DIFF_AI"->List.of(view,api,"aixun:ai:workbench:generate");default->List.of(view,api);};
}
}
@@ -0,0 +1,12 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
final class MasterSourceAuthorityPermissions {
private MasterSourceAuthorityPermissions() { }
static boolean supports(String purpose) { return "MASTER_SOURCE_AUTHORITY_VIEW".equals(purpose) || "MASTER_SOURCE_AUTHORITY_AI".equals(purpose); }
static List<String> required(String purpose) {
if (!supports(purpose)) return List.of();
var base = new java.util.ArrayList<>(List.of("aixun:governance:master-data-source:view", "aixun:governance:master-data-source:authority", "aixun:governance:master-data-model:view"));
if ("MASTER_SOURCE_AUTHORITY_AI".equals(purpose)) base.add("aixun:ai:workbench:generate");
return List.copyOf(base);
}
}
@@ -0,0 +1,25 @@
package cn.aixunkeji.system.dubbo;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
final class MetadataRelationDeclarationPermissions {
private static final Set<String> PURPOSES = Set.of("RELATION_DECLARATION_VIEW", "RELATION_DECLARATION_CREATE",
"RELATION_DECLARATION_EDIT", "RELATION_DECLARATION_REMOVE", "RELATION_DECLARATION_AI");
private MetadataRelationDeclarationPermissions() { }
static boolean supports(String purpose) { return purpose != null && PURPOSES.contains(purpose); }
static List<String> required(String purpose) {
if (!supports(purpose)) return List.of();
var permissions = new ArrayList<>(List.of("aixun:governance:metadata-relation:view",
"aixun:governance:metadata-catalog:view", "aixun:integration:data-source:preview"));
switch (purpose) {
case "RELATION_DECLARATION_CREATE" -> permissions.add("aixun:governance:metadata-relation:create");
case "RELATION_DECLARATION_EDIT" -> permissions.add("aixun:governance:metadata-relation:edit");
case "RELATION_DECLARATION_REMOVE" -> permissions.add("aixun:governance:metadata-relation:remove");
case "RELATION_DECLARATION_AI" -> permissions.add("aixun:ai:workbench:generate");
default -> { }
}
return List.copyOf(permissions);
}
}
@@ -0,0 +1,14 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
import java.util.Set;
final class MetricBusinessAlertAssistPermissions {
private MetricBusinessAlertAssistPermissions() { }
static boolean supports(String purpose){return purpose!=null&&(purpose.startsWith("METRIC_ALERT_")||purpose.equals("METRIC_HISTORY_ALERT_READ"));}
static List<String> required(String purpose){
if("METRIC_HISTORY_ALERT_READ".equals(purpose))return List.of("aixun:dataproduct:metric-business-alert:view","aixun:dataproduct:metric-calculation:view","aixun:dataproduct:metric-system:view","aixun:integration:data-source:preview","aixun:governance:metadata-catalog:view");
if("METRIC_ALERT_ASSIST_VIEW".equals(purpose))return List.of("aixun:dataproduct:metric-business-alert:view","aixun:dataproduct:metric-calculation:view","aixun:dataproduct:metric-system:view");
if(purpose!=null&&purpose.startsWith("METRIC_ALERT_")&&Set.of("CREATE","UPDATE","ACTIVATE","DELETE","DETECT","HANDLE","VIEW").contains(purpose.substring(13)))
return List.of("aixun:dataproduct:metric-business-alert:"+purpose.substring(13).toLowerCase(java.util.Locale.ROOT));
return List.of();
}
}
@@ -0,0 +1,6 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
final class MetricDeclaredLineagePermissions {
private MetricDeclaredLineagePermissions() { }
static List<String> required(String purpose){return "METRIC_DECLARED_LINEAGE_VIEW".equals(purpose)?List.of("aixun:dataproduct:metric-lineage:view","aixun:dataproduct:metric-system:view"):List.of();}
}
@@ -0,0 +1,20 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
import java.util.Map;
final class MetricFormulaPermissions {
private MetricFormulaPermissions() { }
private static final String BASE="aixun:dataproduct:metric-system:";
private static final Map<String,String> ACTIONS=Map.of("CREATE","create","UPDATE","update","RELATION","relation",
"PUBLISH","publish","STATUS","status","DELETE","delete");
static List<String> required(String purpose){
if("METRIC_REFERENCE_VIEW".equals(purpose)||"METRIC_FORMULA_VIEW".equals(purpose))return List.of(BASE+"view");
if("METRIC_FORMULA_DIMENSION".equals(purpose))return List.of(BASE+"view","aixun:dataproduct:semantic-model:view");
if("METRIC_FORMULA_SOURCE".equals(purpose))return List.of(BASE+"view","aixun:integration:data-source:preview","aixun:governance:metadata-catalog:view");
if("SEMANTIC_MODEL_SOURCE".equals(purpose))return List.of("aixun:dataproduct:semantic-model:view","aixun:integration:data-source:preview","aixun:governance:metadata-catalog:view");
if(purpose==null||!purpose.startsWith("METRIC_FORMULA_"))return List.of();
String action=ACTIONS.get(purpose.substring("METRIC_FORMULA_".length()));
return action==null?List.of():List.of(BASE+action);
}
}
@@ -0,0 +1,18 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
final class MetricHistoryPermissions {
private MetricHistoryPermissions() { }
static List<String> required(String purpose) {
if("METRIC_SELF_SERVICE_VIEW".equals(purpose))return List.of("aixun:dataproduct:metric-self-service:view");
if("METRIC_SELF_SERVICE_EXPORT".equals(purpose))return List.of("aixun:dataproduct:metric-self-service:view","aixun:dataproduct:metric-self-service:export");
if(!List.of("METRIC_HISTORY_READ","METRIC_HISTORY_EXPORT").contains(purpose))return List.of();
var permissions=new java.util.ArrayList<>(List.of("aixun:dataproduct:metric-self-service:view",
"aixun:dataproduct:metric-calculation:view","aixun:integration:data-source:preview",
"aixun:governance:metadata-catalog:view"));
if("METRIC_HISTORY_EXPORT".equals(purpose))permissions.add("aixun:dataproduct:metric-self-service:export");
return List.copyOf(permissions);
}
static String permission(String purpose) {var values=required(purpose);return values.isEmpty()?null:values.getFirst();}
}
@@ -0,0 +1,33 @@
package cn.aixunkeji.system.dubbo;
import java.util.List;
import java.util.Set;
final class ModelDesignAssistPermissions {
private ModelDesignAssistPermissions() { }
static boolean supports(String purpose) {
return purpose != null && Set.of("MODEL_REPOSITORY_ASSIST_VIEW", "MODEL_REPOSITORY_ASSIST_AI",
"MODEL_REPOSITORY_CREATE", "MODEL_REPOSITORY_UPDATE", "MODEL_REPOSITORY_STATUS", "MODEL_REPOSITORY_ACTIVATE", "MODEL_REPOSITORY_VERSION", "MODEL_DESIGN_ASSIST_VIEW",
"MODEL_DESIGN_ASSIST_AI", "MODEL_DESIGN_SOURCE", "MODEL_DESIGN_CREATE", "MODEL_DESIGN_UPDATE",
"MODEL_DESIGN_REFERENCE","MODEL_DESIGN_OWNER","MODEL_DESIGN_STATUS","MODEL_DESIGN_CONCEPTUAL","MODEL_DESIGN_LOGICAL","MODEL_DESIGN_PHYSICAL").contains(purpose);
}
static List<String> required(String purpose) {
if (!supports(purpose)) return List.of();
String repository = "aixun:governance:model-repository:view", design = "aixun:governance:model-design:view";
if(purpose.equals("MODEL_REPOSITORY_STATUS")) return List.of(repository,"aixun:governance:model-repository:status");
if(purpose.equals("MODEL_REPOSITORY_ACTIVATE")) return List.of(repository,"aixun:governance:model-repository:status","aixun:governance:subject-layer:view");
if(purpose.equals("MODEL_REPOSITORY_VERSION")) return List.of(repository,"aixun:governance:model-repository:version","aixun:governance:subject-layer:view");
if (purpose.equals("MODEL_DESIGN_SOURCE")) return List.of(design, "aixun:governance:metadata-catalog:view", "aixun:integration:data-source:preview");
if (purpose.equals("MODEL_DESIGN_REFERENCE")) return List.of(design, repository);
if(Set.of("MODEL_DESIGN_STATUS","MODEL_DESIGN_CONCEPTUAL","MODEL_DESIGN_LOGICAL","MODEL_DESIGN_PHYSICAL").contains(purpose))
return List.of(design,"aixun:governance:model-design:"+purpose.substring("MODEL_DESIGN_".length()).toLowerCase(java.util.Locale.ROOT));
boolean repo = purpose.startsWith("MODEL_REPOSITORY_");
String view = repo ? repository : design;
if (purpose.endsWith("_AI")) return repo?List.of(view,"aixun:governance:subject-layer:view", "aixun:ai:workbench:generate"):List.of(view, "aixun:ai:workbench:generate");
if (purpose.endsWith("_CREATE") || purpose.endsWith("_UPDATE")) {
String action="aixun:governance:" + (repo ? "model-repository:" : "model-design:") + (purpose.endsWith("_CREATE") ? "create" : "update");
return repo?List.of(view,action,"aixun:governance:subject-layer:view"):List.of(view,action);
}
return repo?List.of(view,"aixun:governance:subject-layer:view"):List.of(view);
}
}
@@ -0,0 +1,43 @@
package cn.aixunkeji.system.dubbo;
import java.util.Map;
/** Fixed purposes only; caller-supplied permission strings never authorize a model request. */
final class PageAssistPermissions {
private static final Map<String, String> PAGES = Map.ofEntries(
Map.entry("PAGE_AI_P01", "aixun:integration:data-source:view"),
Map.entry("PAGE_AI_P02", "aixun:integration:collection-node:view"),
Map.entry("PAGE_AI_P03", "aixun:integration:external-entry:view"),
Map.entry("PAGE_AI_P04", "aixun:ai:provider:query"),
Map.entry("PAGE_AI_P06", "aixun:dataops:golden-chain:view"),
Map.entry("PAGE_AI_P09", "aixun:dataops:batch-job:view"),
Map.entry("PAGE_AI_P13", "aixun:dataops:storage-resource:view"),
Map.entry("PAGE_AI_P20", "aixun:dataops:task-log:view"),
Map.entry("PAGE_AI_P21", "aixun:dataops:operations-dashboard:view"),
Map.entry("PAGE_AI_P22", "aixun:dataops:alert-event:view"),
Map.entry("PAGE_AI_P23", "aixun:dataops:chain-metric:view"),
Map.entry("PAGE_AI_P25", "aixun:governance:metadata-ingestion:view"),
Map.entry("PAGE_AI_P27", "aixun:governance:metadata-relation:view"),
Map.entry("PAGE_AI_P28", "aixun:governance:metadata-lineage:view"),
Map.entry("PAGE_AI_P29", "aixun:governance:metadata-quality:view"),
Map.entry("PAGE_AI_P30", "aixun:governance:data-profile:view"),
Map.entry("PAGE_AI_P31", "aixun:governance:asset-inventory:view"),
Map.entry("PAGE_AI_P33", "aixun:governance:asset-detail:view"),
Map.entry("PAGE_AI_P34", "aixun:governance:asset-lifecycle:view"),
Map.entry("PAGE_AI_P35", "aixun:governance:asset-compliance:view"),
Map.entry("PAGE_AI_P42", "aixun:governance:standard-operation:view"),
Map.entry("PAGE_AI_P52", "aixun:governance:architecture-governance:view"),
Map.entry("PAGE_AI_P55", "aixun:governance:quality-issue:view"),
Map.entry("PAGE_AI_P56", "aixun:governance:quality-remediation:view"),
Map.entry("PAGE_AI_P57", "aixun:governance:anomaly-detection:view"),
Map.entry("PAGE_AI_P58", "aixun:governance:root-cause:view"),
Map.entry("PAGE_AI_P62", "aixun:governance:security-incident:view"),
Map.entry("PAGE_AI_P63", "aixun:governance:my-work:view"),
Map.entry("PAGE_AI_P64", "aixun:governance:work-overview:view"),
Map.entry("PAGE_AI_P69", "aixun:dataproduct:metric-business-alert:view"),
Map.entry("PAGE_AI_P70", "aixun:dataproduct:metric-lineage:view"),
Map.entry("PAGE_AI_P75", "aixun:dataproduct:api-management:view"),
Map.entry("PAGE_AI_P76", "aixun:dataproduct:service-gateway:view")
);
static String permission(String purpose) { return PAGES.get(purpose); }
}
@@ -0,0 +1,34 @@
package cn.aixunkeji.system.dubbo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import cn.aixunkeji.common.core.utils.MapstructUtils;
import cn.aixunkeji.system.api.RemoteClientService;
import cn.aixunkeji.system.api.domain.vo.RemoteClientVo;
import cn.aixunkeji.system.domain.vo.SysClientVo;
import cn.aixunkeji.system.service.ISysClientService;
import org.springframework.stereotype.Service;
/**
* 客户端服务
*
*/
@RequiredArgsConstructor
@Service
@DubboService
public class RemoteClientServiceImpl implements RemoteClientService {
private final ISysClientService sysClientService;
/**
* 根据客户端id获取客户端详情
*
* @see cn.aixunkeji.system.domain.convert.SysClientVoConvert
*/
@Override
public RemoteClientVo queryByClientId(String clientId) {
SysClientVo vo = sysClientService.queryByClientId(clientId);
return MapstructUtils.convert(vo, RemoteClientVo.class);
}
}
@@ -0,0 +1,88 @@
package cn.aixunkeji.system.dubbo;
import cn.hutool.core.lang.Dict;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import cn.aixunkeji.common.json.utils.JsonUtils;
import cn.aixunkeji.system.api.RemoteConfigService;
import cn.aixunkeji.system.service.ISysConfigService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 配置服务
*
*/
@RequiredArgsConstructor
@Service
@DubboService
public class RemoteConfigServiceImpl implements RemoteConfigService {
private final ISysConfigService configService;
/**
* 获取注册开关
*/
@Override
public boolean selectRegisterEnabled() {
return configService.selectRegisterEnabled();
}
@Override
public String getConfigValue(String configKey) {
return configService.selectConfigByKey(configKey);
}
/**
* 根据参数 key 获取 Map 类型的配置
*
* @param configKey 参数 key
* @return Dict 对象,如果配置为空或无法解析,返回空 Dict
*/
@Override
public Dict getConfigMap(String configKey) {
String configValue = getConfigValue(configKey);
return JsonUtils.parseMap(configValue);
}
/**
* 根据参数 key 获取 Map 类型的配置列表
*
* @param configKey 参数 key
* @return Dict 列表,如果配置为空或无法解析,返回空列表
*/
@Override
public List<Dict> getConfigArrayMap(String configKey) {
String configValue = getConfigValue(configKey);
return JsonUtils.parseArrayMap(configValue);
}
/**
* 根据参数 key 获取指定类型的配置对象
*
* @param configKey 参数 key
* @param clazz 目标对象类型
* @return 对象实例,如果配置为空或无法解析,返回 null
*/
@Override
public <T> T getConfigObject(String configKey, Class<T> clazz) {
String configValue = getConfigValue(configKey);
return JsonUtils.parseObject(configValue, clazz);
}
/**
* 根据参数 key 获取指定类型的配置列表=
*
* @param configKey 参数 key
* @param clazz 目标元素类型
* @return 指定类型列表,如果配置为空或无法解析,返回空列表
*/
@Override
public <T> List<T> getConfigArray(String configKey, Class<T> clazz) {
String configValue = getConfigValue(configKey);
return JsonUtils.parseArray(configValue, clazz);
}
}

某些文件未显示,因为此 diff 中更改的文件太多 显示更多