82 Commits

Author SHA1 Message Date
zhuoda
97df843072 v3.24.0【优化】SM4依赖优化;【优化】前端样式 2025-07-10 23:30:00 +08:00
1024创新实验室
12bd821770 !83 fix:修复代码生成功能中非空字段取值问题(取值取反了)
Merge pull request !83 from hchvhg/dev
2025-07-10 15:05:51 +00:00
hchvhg
2b6ead23bd fix:修复代码生成功能中非空字段取值问题(取值取反了) 2025-06-23 16:16:06 +08:00
hchvhg
b2aa70ce9e 暂时恢复代码 2025-06-23 16:14:02 +08:00
hchvhg
143a500c44 fix:修复代码生成功能非空字段取值问题(取值取反了) 2025-06-23 16:04:53 +08:00
hchvhg
8302ba4c2c 处理DictDataVO类报错问题 2025-06-23 15:42:48 +08:00
zhuoda
7ae4e898ad v3.23.0 【新增】TS代码生成和优化;【优化】log日志格式;【优化】数据字典缓存;【优化】职位表结构 2025-06-19 20:36:30 +08:00
1024创新实验室
245f8c7856 !77 处理商品管理导出功能:导出失败报错问题
Merge pull request !77 from hchvhg/master
2025-06-19 12:07:56 +00:00
1024创新实验室
43a9f53c0a !78 FIX:#ICBNYK 点击代码配置,会发送多次获取字典请求
Merge pull request !78 from 一点点/master
2025-06-19 12:07:46 +00:00
1024创新实验室
551c9c9086 !79 feat(sa-admin): 优化日志格式及颜色
Merge pull request !79 from CoderKK/master
2025-06-19 12:07:36 +00:00
1024创新实验室
28d188251b !81 优化通知公告表单 选择部门 部门名称不显示
Merge pull request !81 from Cool7Smile/N/A
2025-06-19 12:07:26 +00:00
1024创新实验室
87210fad28 !80 优化通知公告表单 选择员工部门名称不显示
Merge pull request !80 from Cool7Smile/N/A
2025-06-19 12:07:16 +00:00
Cool7Smile
4f0296ce23 优化通知公告表单 选择部门 部门名称不显示
Signed-off-by: Cool7Smile <331636030@qq.com>
2025-06-13 07:55:43 +00:00
Cool7Smile
563b20206b 优化通知公告表单 选择员工部门名称不显示
Signed-off-by: Cool7Smile <331636030@qq.com>
2025-06-13 07:51:43 +00:00
CoderKK
c1373ed21d feat(sa-admin): 优化日志格式及颜色
- 在 Console Appender 中添加了新的 PatternLayout 设置
- 使用蓝色显示时间戳,高亮显示日志级别,青色显示类名
- 保留 ANSI 颜色代码,提高日志可读性
2025-06-11 18:29:44 +08:00
一点点
8f6852673a FIX:#ICBNYK 点击代码配置,会发送多次获取字典请求
bug: 点击代码配置,会发送多次获取字典请求
https://gitee.com/lab1024/smart-admin/issues/ICBNYK
2025-05-30 17:45:26 +08:00
hchvhg
336bdc4895 处理商品管理导出功能:导出失败报错问题
报错信息:org.springframework.data.redis.serializer.SerializationException: Cannot deserialize
处理方式:DictDataVO实现了Serializable接口
2025-05-30 17:20:59 +08:00
zhuoda
922e49b27e v3.22.0 【新增】优化代码生成;【新增】优化角色列宽 2025-05-27 20:00:22 +08:00
1024创新实验室
3adb7376dd !75 角色列表名字过长
Merge pull request !75 from wdy/master
2025-05-23 08:22:00 +00:00
1024创新实验室
40880b87c1 !76 build: 移除未使用的依赖项
Merge pull request !76 from CoderKK/master
2025-05-23 08:21:51 +00:00
CoderKK
a260368d0c build: 移除未使用的依赖项
- 从 sa-base/pom.xml 中移除了 commons-pool2、jjwt 和 jwks-rsa 依赖
- 从根 pom.xml 中移除了 jjwt 和 jwks-rsa 的版本定义
2025-05-20 11:33:00 +08:00
wdy
e7d29c68ae !1 角色列表名字过长
Merge pull request !1 from wdy/N/A
2025-05-20 02:08:20 +00:00
wdy
c0dea0c3c6 角色列表名字过长,导致右边页面换行显示
Signed-off-by: wdy <350456985@163.com>
2025-05-20 02:07:48 +00:00
zhuoda
4d2be37e0e v3.21.0 【新增】修改部门名称字段;【新增】修改系统版本version字段;【新增】优化代码生成前端代码;【优化】SQL 2025-05-13 20:06:41 +08:00
zhuoda
d5abf42014 Merge branch 'master' of https://gitee.com/lab1024/smart-admin 2025-05-13 20:04:29 +08:00
zhuoda
8d2d8f2846 v3.21.0 【新增】修改部门名称字段;【新增】修改系统版本version字段;【新增】优化代码生成前端代码;【优化】SQL 2025-05-13 20:04:12 +08:00
1024创新实验室
0e06f36787 !74 【修复】数据变更记录getChangeContent解析列表返回空
Merge pull request !74 from 憨涛子/master
2025-05-10 15:28:19 +00:00
SillyBoy
012096a3ee 【修复】数据变更记录getChangeContent解析列表返回空 2025-05-10 10:43:33 +08:00
zhuoda
3fb4dfad09 v3.20.0 【新增】优化登录使用spring cache;【新增】优化部门cache;【新增】代码生成枚举;【优化】三级等保Label显示宽度 2025-05-03 21:31:28 +08:00
1024创新实验室
f198a949c9 !71 Fix: 修复三级等保配置页面部分Label被遮盖问题,优化 OA 模块代码结构
Merge pull request !71 from Engineer/master
2025-05-01 15:30:37 +00:00
钟家兴
41fad5b831 feat(sa-base): 实现主从数据源动态切换
- 新增 DataSource 注解用于切换数据源
- 实现 DynamicDataSourceHandler 动态数据源处理器
- 添加 DruidConfig 配置多数据源
- 更新 sa-base.yaml 配置文件,支持主从数据源
2025-05-01 23:26:22 +08:00
钟家兴
696db3835a fix(smart-admin-web-typescript): 三级等保配置页面部分Label被遮盖问题 2025-05-01 01:18:19 +08:00
钟家兴
40edf452ac fix(smart-admin-web-javascript): 三级等保配置页面部分Label被遮盖问题 2025-05-01 01:15:03 +08:00
钟家兴
c93616bec2 refactor(oa): 优化 OA 模块代码结构 Java8版本
- 银行相关代码:将 BankController、BankDao、BankService移至合适的包结构
- 数据范围控制器:将 DataScopeController移至 controller 包
- 企业相关代码:将 EnterpriseController、EnterpriseEmployeeManager、EnterpriseService 移至合适的包结构
- 发票相关代码:将 InvoiceController、InvoiceDao、InvoiceService 移至合适的包结构
- 更新相关 XML映射文件的命名空间
2025-05-01 00:20:05 +08:00
钟家兴
61c49b5798 refactor(oa): 优化 OA 模块代码结构
- 银行管理:将 BankController、BankDao、BankService 移至各自独立的包中
- 数据范围:将 DataScopeController移至独立包中
- 企业信息:将 EnterpriseController、EnterpriseEmployeeManager、EnterpriseService 移至各自独立的包中
- 发票管理:将 InvoiceController、InvoiceDao、InvoiceService 移至各自独立的包中
- 更新相关 XML 文件中的命名空间
2025-05-01 00:17:08 +08:00
1024创新实验室
54ad0e5893 !68 refactor(sa-base): 修正邮件服务类中的注释
Merge pull request !68 from Engineer/master
2025-04-27 07:29:55 +00:00
1024创新实验室
fa5b5c7def !67 优化代码生成模块的前端枚举
Merge pull request !67 from 大熊/code-generator
2025-04-27 07:29:28 +00:00
1024创新实验室
57270a7130 !66 在goods-list.vue页面销毁时移除 resize 事件监听器
Merge pull request !66 from luoyangxin/master
2025-04-27 07:29:12 +00:00
zhuoda
6c4cf9cc34 v3.19.1 ts引入错误 2025-04-27 15:13:20 +08:00
钟家兴
c49c1bbbfe refactor(sa-base): 修正邮件服务类中的注释
- 将"发生邮件"修改为"发送邮件",纠正了拼写错误
- 优化了代码注释的准确性,提高了代码可读性
2025-04-26 23:54:49 +08:00
钟家兴
47d41f0379 refactor(sa-base): 修正邮件服务类文档错别字
- 将"发生邮件"修改为"发送邮件",纠正了文档中的错别字
- 优化了代码注释,提高了代码可读性
2025-04-26 23:53:19 +08:00
zhoumingfa
3c3e3b4e32 优化代码生成模块的前端枚举 2025-04-18 16:49:14 +08:00
luoyangxin
7bad13fc23 在goods-list.vue页面销毁时移除 resize 事件监听器
Signed-off-by: luoyangxin <835168276@qq.com>
2025-04-14 02:23:17 +00:00
zhuoda
51caeb1ad1 v3.19.0 【新增】启动时邮箱测试连接关闭;【新增】默认菜单打开互斥;【新增】默认不显示帮助文档 2025-04-14 09:45:09 +08:00
zhuoda
f127f02c96 v3.18.0 【新增】新增消息管理;【新增】完善企业demo;【新增】完善相关数据权限;【新增】菜单管理下级功能 2025-04-10 21:30:13 +08:00
zhuoda
6583f5f90d v3.18.0 【新增】新增消息管理;【新增】完善企业demo;【新增】完善相关数据权限;【新增】菜单管理下级功能 2025-04-10 21:27:09 +08:00
1024创新实验室
d6a53f03b7 v3.18.0 【新增】新增消息管理;【新增】完善企业demo;【新增】完善相关数据权限;【新增】菜单管理下级功能 2025-04-10 13:22:28 +00:00
zhuoda
caf8e3aa25 v3.18.0 【新增】新增消息管理;【新增】完善企业demo;【新增】完善相关数据权限;【新增】菜单管理下级功能 2025-04-10 21:21:37 +08:00
zhoumingfa
97cfdf1f57 完善企业管理demo 2025-04-08 22:00:30 +08:00
zhoumingfa
8bb9f173eb 完善数据字典管理,更新相应的权限字符串 2025-04-08 20:28:59 +08:00
zhuoda
7ea97f8433 v3.17.0 【新增】新增菜单展开1个配置;【新增】移除表格固定高度;【新增】App登录token模式 2025-04-08 20:19:41 +08:00
zhoumingfa
e7927bb948 更正前端权限插件的判断 2025-04-08 19:52:47 +08:00
zhoumingfa
79fc04d8cb 菜单管理新增添加下级功能 2025-04-08 19:52:07 +08:00
zhoumingfa
393cb325c7 解决代码生成的查询条件列表拖拽报错问题 2025-04-08 17:30:20 +08:00
1024创新实验室
33c93ae365 v3.16.0 【新增】优化代码生成 字典和文件预览;【新增】代码生成 菜单SQL;【新增】登录页面GIF炫酷图片;
Signed-off-by: 1024创新实验室 <1024lab@sina.com>
2025-04-06 14:15:37 +00:00
1024创新实验室
3c2c3cf81b v3.16.0 【新增】优化代码生成 字典和文件预览;【新增】代码生成 菜单SQL;【新增】登录页面GIF炫酷图片;
Signed-off-by: 1024创新实验室 <1024lab@sina.com>
2025-04-06 13:01:35 +00:00
zhuoda
ec8fb1d69d v3.16.0 【新增】优化代码生成 字典和文件预览;【新增】代码生成 菜单SQL;【新增】登录页面GIF炫酷图片 2025-04-06 20:59:16 +08:00
zhuoda
d4f1806491 v3.16.0 【新增】优化代码生成 字典和文件预览;【新增】代码生成 菜单SQL;【新增】登录页面GIF炫酷图片; 2025-04-06 20:28:10 +08:00
zhuoda
ce0551696a v3.16.0 【新增】优化代码生成 字典和文件预览;【新增】代码生成 菜单SQL;【新增】登录页面GIF炫酷图片; 2025-04-06 20:25:06 +08:00
1024创新实验室
1abe2ee05e !64 优化代码生成模块,使其适配当前版本
Merge pull request !64 from 大熊/master
2025-04-05 08:41:51 +00:00
zhuoda
cead60b406 v3.15.0【新增】升级SaToken到最新版本;【新增】重磅优化 数据字典;【新增】升级wangEditor-next;【新增】优化缓存 2025-04-03 22:30:18 +08:00
1024创新实验室
9445ad3cf6 v3.15.0【新增】升级SaToken到最新版本;【新增】重磅优化 数据字典;【新增】升级wangEditor-next;
Signed-off-by: 1024创新实验室 <1024lab@sina.com>
2025-04-03 14:19:45 +00:00
1024创新实验室
dd31f3e8a5 v3.15.0【新增】升级SaToken到最新版本;【新增】重磅优化 数据字典;【新增】升级wangEditor-next;
Signed-off-by: 1024创新实验室 <1024lab@sina.com>
2025-04-03 14:19:17 +00:00
zhoumingfa
486aa13cfd 更新代码生成的菜单SQL模板 2025-04-03 18:29:30 +08:00
zhoumingfa
ade82f8aa2 修改前端页面部分细节 2025-04-01 20:08:10 +08:00
zhoumingfa
66aac47a43 优化代码生成模块,使其适配当前版本 2025-04-01 17:44:29 +08:00
zhoumingfa
23c4889723 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	smart-admin-web-javascript/src/views/business/erp/goods/goods-list.vue
#	smart-admin-web-typescript/src/views/business/erp/goods/goods-list.vue
2025-03-31 23:37:57 +08:00
zhoumingfa
4062d5a4bb 优化代码生成,添加字典预览与文件预览,使其适配当前版本 2025-03-31 23:29:58 +08:00
zhuoda
fc2f3f2e23 v3.15.0【新增】升级SaToken到最新版本;【新增】重磅优化 数据字典;【新增】升级wangEditor-next;【新增】优化缓存实现redis与caffeine 2025-03-31 23:24:07 +08:00
zhuoda
4683e31290 v3.15.0【新增】升级SaToken到最新版本;【新增】重磅优化 数据字典;【新增】升级wangEditor-next;【新增】优化缓存实现redis与caffeine 2025-03-31 23:19:41 +08:00
zhoumingfa
5136148ce1 解决:java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "tables" "TABLES" 2025-03-31 23:15:16 +08:00
1024创新实验室
558d5c86ff !62 Bug修复及细节优化
Merge pull request !62 from 大熊/master
2025-03-29 15:49:56 +00:00
zhoumingfa
45b5ba6795 优化前端字典预览组件 2025-03-28 21:21:02 +08:00
zhoumingfa
b72f58a0bb 1、若干个细节修改;2、更新SQL脚本,t_dict_key 的 key_code 值错误 2025-03-28 21:19:27 +08:00
zhoumingfa
5fb1456080 接口解密中的 fastjson 解析对象统一改为使用 jackson 2025-03-28 21:12:59 +08:00
zhoumingfa
a6607c063b 修复缓存实现配置为 redis 时抛异常的问题 2025-03-28 20:57:48 +08:00
1024创新实验室
580a783d25 !61 refactor(smart-admin): 统一使用“登录”替代“登陆”,确保术语准确性
Merge pull request !61 from CoderKK/master
2025-03-24 11:56:37 +00:00
1024创新实验室
a66d97a408 update README.md.
Signed-off-by: 1024创新实验室 <1024lab@sina.com>
2025-03-24 11:54:02 +00:00
CoderKK
684cb3f71c refactor(smart-admin): 统一使用“登录”替代“登陆”,确保术语准确性 2025-03-20 11:42:23 +08:00
1024创新实验室
109689be69 update README.md.
Signed-off-by: 1024创新实验室 <1024lab@sina.com>
2025-03-19 06:18:36 +00:00
1024创新实验室
30901ed00f !60 refactor(smart-admin-api-java17-springboot3): 移除 Dao 接口中的冗余注解
Merge pull request !60 from CoderKK/master
2025-03-15 02:11:05 +00:00
CoderKK
92fd908619 refactor(smart-admin-api-java17-springboot3): 移除 Dao 接口中的冗余注解
- 删除了 Dao.java.vm 文件中的 @Component 注解- 优化了代码结构,减少了不必要的导入
2025-03-11 16:37:15 +08:00
604 changed files with 9148 additions and 5405 deletions

View File

@@ -11,9 +11,9 @@
- 前端JavaScript/TypeScript + Vue3 + Vite5 + Pinia + Ant Design Vue 4.X
- 移动端uniapp (vue3版本) + uni-ui + 同时支持APP、小程序、H5
- 后端Java8/17 + SpringBoot2/3 + Sa Token + Mybatis-plus + 多种数据库
- 电脑在线预览:[https://preview.smartadmin.vip](https://preview.smartadmin.vip)
- 后端Java8/17 + SpringBoot2/3 + Sa Token + Mybatis-plus + 主流数据库/国产数据库
- 官方文档:[https://smartadmin.vip](https://smartadmin.vip)
- 电脑在线预览:[https://preview.smartadmin.vip](https://preview.smartadmin.vip)
- 移动端在线预览:[https://app.smartadmin.vip](https://app.smartadmin.vip/#/pages/login/login)
### **理念与思想**

View File

@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<packaging>pom</packaging>
@@ -29,7 +29,6 @@
<druid.version>1.2.23</druid.version>
<google-linkedhashmap.version>1.4.2</google-linkedhashmap.version>
<google-guava.version>20.0</google-guava.version>
<user-agent-utils.version>1.21</user-agent-utils.version>
<reflections.version>0.9.11</reflections.version>
<commons-io.version>2.15.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
@@ -45,10 +44,8 @@
<log4j-spring-boot.version>2.23.1</log4j-spring-boot.version>
<hutool.version>5.8.29</hutool.version>
<velocity-engine-core.version>2.3</velocity-engine-core.version>
<jjwt.version>0.9.1</jjwt.version>
<jwks-rsa.version>0.9.0</jwks-rsa.version>
<velocity-tools.version>3.1</velocity-tools.version>
<sa-token.version>1.37.0</sa-token.version>
<sa-token.version>1.41.0</sa-token.version>
<ip2region.version>2.7.0</ip2region.version>
<bcprov.version>1.80</bcprov.version>
<jackson-datatype-jsr310.version>2.13.4</jackson-datatype-jsr310.version>
@@ -129,12 +126,6 @@
<version>${google-guava.version}</version>
</dependency>
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>${user-agent-utils.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
@@ -200,19 +191,6 @@
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>jwks-rsa</artifactId>
<version>${jwks-rsa.version}</version>
</dependency>
<!--velocity begin-->
<dependency>
<groupId>org.apache.velocity</groupId>
@@ -263,6 +241,10 @@
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>

View File

@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>
@@ -18,7 +18,7 @@
<dependencies>
<dependency>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-base</artifactId>
<version>3.0.0</version>
</dependency>

View File

@@ -20,11 +20,6 @@ public class AdminCacheConst extends CacheKeyConst {
*/
public static final String DEPARTMENT_LIST_CACHE = "department_list_cache";
/**
* 部门map
*/
public static final String DEPARTMENT_MAP_CACHE = "department_map_cache";
/**
* 部门树
*/
@@ -54,4 +49,20 @@ public class AdminCacheConst extends CacheKeyConst {
public static final String CATEGORY_TREE = "category_tree_cache";
}
/**
* 登录相关
*/
public static class Login {
/**
* 请求用户信息
*/
public static final String REQUEST_EMPLOYEE = "login_request_employee";
/**
* 请求用户信息权限
*/
public static final String USER_PERMISSION = "login_user_permission";
}
}

View File

@@ -51,6 +51,8 @@ public class AdminSwaggerTagConst extends SwaggerTagConst {
public static final String SYSTEM_POSITION = "系统-职务管理";
public static final String SYSTEM_MESSAGE = "系统-消息";
}

View File

@@ -2,9 +2,8 @@ package net.lab1024.sa.admin.interceptor;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.exception.SaTokenException;
import cn.dev33.satoken.strategy.SaStrategy;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import cn.dev33.satoken.strategy.SaAnnotationStrategy;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@@ -84,7 +83,7 @@ public class AdminInterceptor implements HandlerInterceptor {
// --------------- 第三步: 校验 权限 ---------------
SmartRequestUtil.setRequestUser(requestEmployee);
if (SaStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class)) {
if (SaAnnotationStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class)) {
return true;
}
@@ -93,7 +92,7 @@ public class AdminInterceptor implements HandlerInterceptor {
return true;
}
SaStrategy.instance.checkMethodAnnotation.accept(method);
SaAnnotationStrategy.instance.checkMethodAnnotation.accept(method);
} catch (SaTokenException e) {
/*
@@ -126,7 +125,6 @@ public class AdminInterceptor implements HandlerInterceptor {
* 检测token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结
*/
private void checkActiveTimeout(RequestEmployee requestEmployee) {
// 用户不在线,也不用检测
if (requestEmployee == null) {
return;
@@ -137,12 +135,9 @@ public class AdminInterceptor implements HandlerInterceptor {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// 清除上下文
SmartRequestUtil.remove();
}
}

View File

@@ -1,24 +0,0 @@
package net.lab1024.sa.admin.listener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
/**
* admin 应用启动加载
*
* @Author 1024创新实验室-主任:卓大
* @Date 2021-08-26 18:46:32
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Slf4j
@Component
public class AdminStartupRunner implements CommandLineRunner {
@Override
public void run(String... args) {
}
}

View File

@@ -18,7 +18,6 @@ import java.util.List;
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Component
@Mapper
public interface CategoryDao extends BaseMapper<CategoryEntity> {

View File

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import net.lab1024.sa.admin.module.business.category.constant.CategoryTypeEnum;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
@@ -19,7 +20,9 @@ import java.time.LocalDateTime;
*/
@Data
@TableName("t_category")
public class CategoryEntity {
public class CategoryEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long categoryId;

View File

@@ -3,6 +3,7 @@ package net.lab1024.sa.admin.module.business.category.domain.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
@@ -15,7 +16,9 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Data
public class CategoryTreeVO {
public class CategoryTreeVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "类目id")
private Long categoryId;

View File

@@ -21,7 +21,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface GoodsDao extends BaseMapper<GoodsEntity> {
/**

View File

@@ -7,7 +7,7 @@ import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
import net.lab1024.sa.base.common.json.deserializer.DictValueVoDeserializer;
import net.lab1024.sa.base.common.json.deserializer.DictDataDeserializer;
import net.lab1024.sa.base.common.swagger.SchemaEnum;
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
@@ -39,7 +39,7 @@ public class GoodsAddForm {
@Schema(description = "产地")
@NotBlank(message = "产地 不能为空 ")
@JsonDeserialize(using = DictValueVoDeserializer.class)
@JsonDeserialize(using = DictDataDeserializer.class)
private String place;
@Schema(description = "商品价格")

View File

@@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
import net.lab1024.sa.base.common.domain.PageParam;
import net.lab1024.sa.base.common.json.deserializer.DictValueVoDeserializer;
import net.lab1024.sa.base.common.json.deserializer.DictDataDeserializer;
import net.lab1024.sa.base.common.swagger.SchemaEnum;
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
import org.hibernate.validator.constraints.Length;
@@ -34,7 +34,7 @@ public class GoodsQueryForm extends PageParam {
private Integer goodsStatus;
@Schema(description = "产地")
@JsonDeserialize(using = DictValueVoDeserializer.class)
@JsonDeserialize(using = DictDataDeserializer.class)
private String place;
@Schema(description = "上架状态")

View File

@@ -1,6 +1,5 @@
package net.lab1024.sa.admin.module.business.goods.domain.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;

View File

@@ -26,7 +26,6 @@ import net.lab1024.sa.base.common.util.SmartEnumUtil;
import net.lab1024.sa.base.common.util.SmartPageUtil;
import net.lab1024.sa.base.module.support.datatracer.constant.DataTracerTypeEnum;
import net.lab1024.sa.base.module.support.datatracer.service.DataTracerService;
import net.lab1024.sa.base.module.support.dict.service.DictCacheService;
import net.lab1024.sa.base.module.support.dict.service.DictService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
@@ -60,7 +59,7 @@ public class GoodsService {
private DataTracerService dataTracerService;
@Resource
private DictCacheService dictCacheService;
private DictService dictService;
/**
* 添加商品
@@ -194,13 +193,13 @@ public class GoodsService {
*/
public List<GoodsExcelVO> getAllGoods() {
List<GoodsEntity> goodsEntityList = goodsDao.selectList(null);
String keyCode="GODOS_PLACE";
String dictCode = "GOODS_PLACE";
return goodsEntityList.stream()
.map(e ->
GoodsExcelVO.builder()
.goodsStatus(SmartEnumUtil.getEnumDescByValue(e.getGoodsStatus(), GoodsStatusEnum.class))
.categoryName(categoryQueryService.queryCategoryName(e.getCategoryId()))
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(keyCode,code)).collect(Collectors.joining(",")))
.place(Arrays.stream(e.getPlace().split(",")).map(code -> dictService.getDictDataLabel(dictCode, code)).collect(Collectors.joining(",")))
.price(e.getPrice())
.goodsName(e.getGoodsName())
.remark(e.getRemark())

View File

@@ -1,10 +1,12 @@
package net.lab1024.sa.admin.module.business.oa.bank;
package net.lab1024.sa.admin.module.business.oa.bank.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.admin.module.business.oa.bank.service.BankService;
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankCreateForm;
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankQueryForm;
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankUpdateForm;
@@ -35,24 +37,28 @@ public class BankController {
@Operation(summary = "分页查询银行信息 @author 善逸")
@PostMapping("/oa/bank/page/query")
@SaCheckPermission("oa:bank:query")
public ResponseDTO<PageResult<BankVO>> queryByPage(@RequestBody @Valid BankQueryForm queryForm) {
return bankService.queryByPage(queryForm);
}
@Operation(summary = "根据企业ID查询银行信息列表 @author 善逸")
@GetMapping("/oa/bank/query/list/{enterpriseId}")
@SaCheckPermission("oa:bank:query")
public ResponseDTO<List<BankVO>> queryList(@PathVariable Long enterpriseId) {
return bankService.queryList(enterpriseId);
}
@Operation(summary = "查询银行信息详情 @author 善逸")
@GetMapping("/oa/bank/get/{bankId}")
@SaCheckPermission("oa:bank:query")
public ResponseDTO<BankVO> getDetail(@PathVariable Long bankId) {
return bankService.getDetail(bankId);
}
@Operation(summary = "新建银行信息 @author 善逸")
@PostMapping("/oa/bank/create")
@SaCheckPermission("oa:bank:add")
public ResponseDTO<String> createBank(@RequestBody @Valid BankCreateForm createVO) {
RequestUser requestUser = SmartRequestUtil.getRequestUser();
createVO.setCreateUserId(requestUser.getUserId());
@@ -62,12 +68,14 @@ public class BankController {
@Operation(summary = "编辑银行信息 @author 善逸")
@PostMapping("/oa/bank/update")
@SaCheckPermission("oa:bank:update")
public ResponseDTO<String> updateBank(@RequestBody @Valid BankUpdateForm updateVO) {
return bankService.updateBank(updateVO);
}
@Operation(summary = "删除银行信息 @author 善逸")
@GetMapping("/oa/bank/delete/{bankId}")
@SaCheckPermission("oa:bank:delete")
public ResponseDTO<String> deleteBank(@PathVariable Long bankId) {
return bankService.deleteBank(bankId);
}

View File

@@ -1,4 +1,4 @@
package net.lab1024.sa.admin.module.business.oa.bank;
package net.lab1024.sa.admin.module.business.oa.bank.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -7,7 +7,6 @@ import net.lab1024.sa.admin.module.business.oa.bank.domain.BankQueryForm;
import net.lab1024.sa.admin.module.business.oa.bank.domain.BankVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@@ -21,7 +20,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface BankDao extends BaseMapper<BankEntity> {
/**

View File

@@ -1,8 +1,9 @@
package net.lab1024.sa.admin.module.business.oa.bank;
package net.lab1024.sa.admin.module.business.oa.bank.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.admin.module.business.oa.bank.dao.BankDao;
import net.lab1024.sa.admin.module.business.oa.bank.domain.*;
import net.lab1024.sa.admin.module.business.oa.enterprise.dao.EnterpriseDao;
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.entity.EnterpriseEntity;

View File

@@ -1,4 +1,4 @@
package net.lab1024.sa.admin.module.business.oa.enterprise;
package net.lab1024.sa.admin.module.business.oa.enterprise.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
@@ -8,6 +8,7 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.admin.module.business.oa.enterprise.service.EnterpriseService;
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.form.*;
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseEmployeeVO;
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseExcelVO;
@@ -100,6 +101,7 @@ public class EnterpriseController {
@Operation(summary = "按照类型查询企业 @author 开云")
@GetMapping("/oa/enterprise/query/list")
@SaCheckPermission("oa:enterprise:query")
public ResponseDTO<List<EnterpriseListVO>> queryList(@RequestParam(value = "type", required = false) Integer type) {
return enterpriseService.queryList(type);
}
@@ -114,12 +116,14 @@ public class EnterpriseController {
@Operation(summary = "查询企业全部员工 @author 罗伊")
@PostMapping("/oa/enterprise/employee/list")
@SaCheckPermission("oa:enterprise:queryEmployee")
public ResponseDTO<List<EnterpriseEmployeeVO>> employeeList(@RequestBody @Valid List<Long> enterpriseIdList) {
return ResponseDTO.ok(enterpriseService.employeeList(enterpriseIdList));
}
@Operation(summary = "分页查询企业员工 @author 卓大")
@PostMapping("/oa/enterprise/employee/queryPage")
@SaCheckPermission("oa:enterprise:queryEmployee")
public ResponseDTO<PageResult<EnterpriseEmployeeVO>> queryPageEmployeeList(@RequestBody @Valid EnterpriseEmployeeQueryForm queryForm) {
return ResponseDTO.ok(enterpriseService.queryPageEmployeeList(queryForm));
}

View File

@@ -23,7 +23,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface EnterpriseDao extends BaseMapper<EnterpriseEntity> {
/**

View File

@@ -22,7 +22,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface EnterpriseEmployeeDao extends BaseMapper<EnterpriseEmployeeEntity> {

View File

@@ -1,4 +1,4 @@
package net.lab1024.sa.admin.module.business.oa.enterprise;
package net.lab1024.sa.admin.module.business.oa.enterprise.manager;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.lab1024.sa.admin.module.business.oa.enterprise.dao.EnterpriseEmployeeDao;

View File

@@ -1,4 +1,4 @@
package net.lab1024.sa.admin.module.business.oa.enterprise;
package net.lab1024.sa.admin.module.business.oa.enterprise.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
@@ -13,6 +13,7 @@ import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseEm
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseExcelVO;
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseListVO;
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseVO;
import net.lab1024.sa.admin.module.business.oa.enterprise.manager.EnterpriseEmployeeManager;
import net.lab1024.sa.admin.module.system.department.service.DepartmentService;
import net.lab1024.sa.base.common.code.UserErrorCode;
import net.lab1024.sa.base.common.domain.PageResult;

View File

@@ -1,11 +1,13 @@
package net.lab1024.sa.admin.module.business.oa.invoice;
package net.lab1024.sa.admin.module.business.oa.invoice.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.admin.module.business.oa.invoice.service.InvoiceService;
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceAddForm;
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceQueryForm;
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceUpdateForm;
@@ -38,18 +40,21 @@ public class InvoiceController {
@Operation(summary = "分页查询发票信息 @author 善逸")
@PostMapping("/oa/invoice/page/query")
@SaCheckPermission("oa:invoice:query")
public ResponseDTO<PageResult<InvoiceVO>> queryByPage(@RequestBody @Valid InvoiceQueryForm queryForm) {
return invoiceService.queryByPage(queryForm);
}
@Operation(summary = "查询发票信息详情 @author 善逸")
@GetMapping("/oa/invoice/get/{invoiceId}")
@SaCheckPermission("oa:invoice:query")
public ResponseDTO<InvoiceVO> getDetail(@PathVariable Long invoiceId) {
return invoiceService.getDetail(invoiceId);
}
@Operation(summary = "新建发票信息 @author 善逸")
@PostMapping("/oa/invoice/create")
@SaCheckPermission("oa:invoice:add")
public ResponseDTO<String> createInvoice(@RequestBody @Valid InvoiceAddForm createVO) {
RequestUser requestUser = SmartRequestUtil.getRequestUser();
createVO.setCreateUserId(requestUser.getUserId());
@@ -57,21 +62,24 @@ public class InvoiceController {
return invoiceService.createInvoice(createVO);
}
@OperateLog
@Operation(summary = "编辑发票信息 @author 善逸")
@PostMapping("/oa/invoice/update")
@OperateLog
@SaCheckPermission("oa:invoice:update")
public ResponseDTO<String> updateInvoice(@RequestBody @Valid InvoiceUpdateForm updateVO) {
return invoiceService.updateInvoice(updateVO);
}
@Operation(summary = "删除发票信息 @author 善逸")
@GetMapping("/invoice/delete/{invoiceId}")
@SaCheckPermission("oa:invoice:delete")
public ResponseDTO<String> deleteInvoice(@PathVariable Long invoiceId) {
return invoiceService.deleteInvoice(invoiceId);
}
@Operation(summary = "查询列表 @author lidoudou")
@GetMapping("/oa/invoice/query/list/{enterpriseId}")
@SaCheckPermission("oa:invoice:query")
public ResponseDTO<List<InvoiceVO>> queryList(@PathVariable Long enterpriseId) {
return invoiceService.queryList(enterpriseId);
}

View File

@@ -1,4 +1,4 @@
package net.lab1024.sa.admin.module.business.oa.invoice;
package net.lab1024.sa.admin.module.business.oa.invoice.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -7,7 +7,6 @@ import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceQueryForm;
import net.lab1024.sa.admin.module.business.oa.invoice.domain.InvoiceVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@@ -21,7 +20,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface InvoiceDao extends BaseMapper<InvoiceEntity> {
/**

View File

@@ -1,10 +1,11 @@
package net.lab1024.sa.admin.module.business.oa.invoice;
package net.lab1024.sa.admin.module.business.oa.invoice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.admin.module.business.oa.enterprise.EnterpriseService;
import net.lab1024.sa.admin.module.business.oa.enterprise.service.EnterpriseService;
import net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseVO;
import net.lab1024.sa.admin.module.business.oa.invoice.dao.InvoiceDao;
import net.lab1024.sa.admin.module.business.oa.invoice.domain.*;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;

View File

@@ -27,7 +27,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface NoticeDao extends BaseMapper<NoticeEntity> {
// ================================= 数据范围相关 【子表】 =================================

View File

@@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface NoticeTypeDao extends BaseMapper<NoticeTypeEntity> {
}

View File

@@ -230,7 +230,7 @@ public class NoticeService {
noticeVisibleRange.setDataName(employeeEntity == null ? StringConst.EMPTY : employeeEntity.getActualName());
} else {
DepartmentVO departmentVO = departmentService.getDepartmentById(noticeVisibleRange.getDataId());
noticeVisibleRange.setDataName(departmentVO == null ? StringConst.EMPTY : departmentVO.getName());
noticeVisibleRange.setDataName(departmentVO == null ? StringConst.EMPTY : departmentVO.getDepartmentName());
}
}
updateFormVO.setVisibleRangeList(noticeVisibleRangeList);

View File

@@ -89,7 +89,6 @@ public class DataScopeSqlConfigService {
/**
* 根据调用的方法获取,此方法的配置信息
*
*/
public DataScopeSqlConfig getSqlConfig(String method) {
return this.dataScopeMethodMap.get(method);
@@ -125,7 +124,7 @@ public class DataScopeSqlConfigService {
log.warn("data scope custom strategy class{} ,bean is null", sqlConfigDTO.getJoinSqlImplClazz());
return "";
}
return powerStrategy.getCondition(viewTypeEnum,paramMap, sqlConfigDTO);
return powerStrategy.getCondition(viewTypeEnum, paramMap, sqlConfigDTO);
}
if (DataScopeWhereInTypeEnum.EMPLOYEE == sqlConfigDTO.getDataScopeWhereInType()) {
List<Long> canViewEmployeeIds = dataScopeViewService.getCanViewEmployeeId(viewTypeEnum, employeeId);

View File

@@ -56,6 +56,7 @@ public class DataScopeViewService {
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
return this.getDepartmentAndSubEmployeeIdList(employeeId);
}
// 可以查看所有员工数据
return Lists.newArrayList();
}

View File

@@ -5,7 +5,6 @@ import net.lab1024.sa.admin.module.system.department.domain.entity.DepartmentEnt
import net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@@ -18,7 +17,6 @@ import java.util.List;
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Component
@Mapper
public interface DepartmentDao extends BaseMapper<DepartmentEntity> {
@@ -33,4 +31,5 @@ public interface DepartmentDao extends BaseMapper<DepartmentEntity> {
*/
List<DepartmentVO> listAll();
DepartmentVO selectDepartmentVO(@Param("departmentId")Long departmentId);
}

View File

@@ -31,12 +31,12 @@ public class DepartmentEntity {
/**
* 部门名称
*/
private String name;
private String departmentName;
/**
* 负责人员工 id
*/
@TableField(updateStrategy = FieldStrategy.ALWAYS)
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long managerId;
/**

View File

@@ -20,7 +20,7 @@ public class DepartmentAddForm {
@Schema(description = "部门名称")
@Length(min = 1, max = 50, message = "请输入正确的部门名称(1-50个字符)")
@NotNull(message = "请输入正确的部门名称(1-50个字符)")
private String name;
private String departmentName;
@Schema(description = "排序")
@NotNull(message = "排序值")

View File

@@ -3,6 +3,7 @@ package net.lab1024.sa.admin.module.system.department.domain.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
@@ -15,13 +16,15 @@ import java.time.LocalDateTime;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Data
public class DepartmentVO {
public class DepartmentVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "部门id")
private Long departmentId;
@Schema(description = "部门名称")
private String name;
private String departmentName;
@Schema(description = "部门负责人姓名")
private String managerName;

View File

@@ -42,7 +42,7 @@ public class DepartmentCacheManager {
log.info("clear " + cache);
}
@CacheEvict(value = {AdminCacheConst.Department.DEPARTMENT_LIST_CACHE, AdminCacheConst.Department.DEPARTMENT_MAP_CACHE, AdminCacheConst.Department.DEPARTMENT_SELF_CHILDREN_CACHE, AdminCacheConst.Department.DEPARTMENT_TREE_CACHE, AdminCacheConst.Department.DEPARTMENT_PATH_CACHE,}, allEntries = true)
@CacheEvict(value = {AdminCacheConst.Department.DEPARTMENT_LIST_CACHE, AdminCacheConst.Department.DEPARTMENT_SELF_CHILDREN_CACHE, AdminCacheConst.Department.DEPARTMENT_TREE_CACHE, AdminCacheConst.Department.DEPARTMENT_PATH_CACHE,}, allEntries = true)
public void clearCache() {
logClearInfo(AdminCacheConst.Department.DEPARTMENT_LIST_CACHE);
}
@@ -56,19 +56,8 @@ public class DepartmentCacheManager {
return departmentDao.listAll();
}
/**
* 部门map
*
*/
@Cacheable(AdminCacheConst.Department.DEPARTMENT_MAP_CACHE)
public Map<Long, DepartmentVO> getDepartmentMap() {
return departmentDao.listAll().stream().collect(Collectors.toMap(DepartmentVO::getDepartmentId, Function.identity()));
}
/**
* 缓存部门树结构
*
*/
@Cacheable(AdminCacheConst.Department.DEPARTMENT_TREE_CACHE)
public List<DepartmentTreeVO> getDepartmentTree() {
@@ -78,7 +67,6 @@ public class DepartmentCacheManager {
/**
* 缓存某个部门的下级id列表
*
*/
@Cacheable(AdminCacheConst.Department.DEPARTMENT_SELF_CHILDREN_CACHE)
public List<Long> getDepartmentSelfAndChildren(Long departmentId) {
@@ -89,7 +77,6 @@ public class DepartmentCacheManager {
/**
* 部门的路径名称
*
*/
@Cacheable(AdminCacheConst.Department.DEPARTMENT_PATH_CACHE)
public Map<Long, String> getDepartmentPathMap() {
@@ -110,22 +97,21 @@ public class DepartmentCacheManager {
*/
private String buildDepartmentPath(DepartmentVO departmentVO, Map<Long, DepartmentVO> departmentMap) {
if (Objects.equals(departmentVO.getParentId(), NumberUtils.LONG_ZERO)) {
return departmentVO.getName();
return departmentVO.getDepartmentName();
}
//父节点
DepartmentVO parentDepartment = departmentMap.get(departmentVO.getParentId());
if (parentDepartment == null) {
return departmentVO.getName();
return departmentVO.getDepartmentName();
}
String pathName = buildDepartmentPath(parentDepartment, departmentMap);
return pathName + "/" + departmentVO.getName();
return pathName + "/" + departmentVO.getDepartmentName();
}
// ---------------------- 构造树的一些方法 ------------------------------
/**
* 构建部门树结构
*
*/
public List<DepartmentTreeVO> buildTree(List<DepartmentVO> voList) {
if (CollectionUtils.isEmpty(voList)) {
@@ -148,7 +134,7 @@ public class DepartmentCacheManager {
private List<Long> recursiveBuildTree(List<DepartmentTreeVO> nodeList, List<DepartmentVO> allDepartmentList) {
int nodeSize = nodeList.size();
List<Long> childIdList = new ArrayList<>();
for(int i = 0; i < nodeSize; i++) {
for (int i = 0; i < nodeSize; i++) {
int preIndex = i - 1;
int nextIndex = i + 1;
DepartmentTreeVO node = nodeList.get(i);
@@ -167,14 +153,14 @@ public class DepartmentCacheManager {
tempChildIdList = this.recursiveBuildTree(children, allDepartmentList);
}
if(CollectionUtils.isEmpty(node.getSelfAndAllChildrenIdList())) {
if (CollectionUtils.isEmpty(node.getSelfAndAllChildrenIdList())) {
node.setSelfAndAllChildrenIdList(
new ArrayList<>()
);
}
node.getSelfAndAllChildrenIdList().add(node.getDepartmentId());
if(CollectionUtils.isNotEmpty(tempChildIdList)) {
if (CollectionUtils.isNotEmpty(tempChildIdList)) {
node.getSelfAndAllChildrenIdList().addAll(tempChildIdList);
childIdList.addAll(tempChildIdList);
}
@@ -182,7 +168,7 @@ public class DepartmentCacheManager {
}
// 保证本层遍历顺序
for(int i = nodeSize - 1; i >= 0; i--) {
for (int i = nodeSize - 1; i >= 0; i--) {
childIdList.add(0, nodeList.get(i).getDepartmentId());
}
@@ -192,7 +178,6 @@ public class DepartmentCacheManager {
/**
* 获取子元素
*
*/
private List<DepartmentTreeVO> getChildren(Long departmentId, List<DepartmentVO> voList) {
List<DepartmentVO> childrenEntityList = voList.stream().filter(e -> departmentId.equals(e.getParentId())).collect(Collectors.toList());
@@ -205,7 +190,6 @@ public class DepartmentCacheManager {
/**
* 通过部门id,获取当前以及下属部门
*
*/
public List<Long> selfAndChildrenIdList(Long departmentId, List<DepartmentVO> voList) {
List<Long> selfAndChildrenIdList = Lists.newArrayList();

View File

@@ -14,10 +14,7 @@ import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.util.SmartBeanUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 部门 service
@@ -44,7 +41,6 @@ public class DepartmentService {
/**
* 新增添加部门
*
*/
public ResponseDTO<String> addDepartment(DepartmentAddForm departmentAddForm) {
@@ -57,7 +53,6 @@ public class DepartmentService {
/**
* 更新部门信息
*
*/
public ResponseDTO<String> updateDepartment(DepartmentUpdateForm updateDTO) {
if (updateDTO.getParentId() == null) {
@@ -78,7 +73,6 @@ public class DepartmentService {
* 根据id删除部门
* 1、需要判断当前部门是否有子部门,有子部门则不允许删除
* 2、需要判断当前部门是否有员工有员工则不能删除
*
*/
public ResponseDTO<String> deleteDepartment(Long departmentId) {
DepartmentEntity departmentEntity = departmentDao.selectById(departmentId);
@@ -122,7 +116,6 @@ public class DepartmentService {
/**
* 自身以及所有下级的部门id列表
*
*/
public List<Long> selfAndChildrenIdList(Long departmentId) {
return departmentCacheManager.getDepartmentSelfAndChildren(departmentId);
@@ -131,7 +124,6 @@ public class DepartmentService {
/**
* 获取所有部门
*
*/
public List<DepartmentVO> listAll() {
return departmentCacheManager.getDepartmentList();
@@ -140,10 +132,9 @@ public class DepartmentService {
/**
* 获取部门
*
*/
public DepartmentVO getDepartmentById(Long departmentId) {
return departmentCacheManager.getDepartmentMap().get(departmentId);
return departmentDao.selectDepartmentVO(departmentId);
}
/**
@@ -153,38 +144,4 @@ public class DepartmentService {
return departmentCacheManager.getDepartmentPathMap().get(departmentId);
}
/**
* 查询全部父级部门(不包含自己)
*
*/
public List<DepartmentVO> queryAllParentDepartment(Long departmentId) {
List<DepartmentVO> list = new ArrayList<>();
Map<Long, DepartmentVO> departmentMap = departmentCacheManager.getDepartmentMap();
DepartmentVO departmentVO = departmentMap.get(departmentId);
while (departmentVO != null) {
list.add(departmentVO);
departmentVO = departmentMap.get(departmentVO.getParentId());
}
Collections.reverse(list);
return list;
}
/**
* 查询全部父级部门(不包含自己)
*
*/
public List<Long> queryAllParentDepartmentIdList(Long departmentId) {
List<Long> list = new ArrayList<>();
Map<Long, DepartmentVO> departmentMap = departmentCacheManager.getDepartmentMap();
DepartmentVO departmentVO = departmentMap.get(departmentId);
while (departmentVO != null) {
list.add(departmentVO.getDepartmentId());
departmentVO = departmentMap.get(departmentVO.getParentId());
}
Collections.reverse(list);
return list;
}
}

View File

@@ -117,7 +117,7 @@ public class EmployeeController {
@Operation(summary = "查询员工-根据部门id @author 卓大")
@GetMapping("/employee/getAllEmployeeByDepartmentId/{departmentId}")
public ResponseDTO<List<EmployeeVO>> getAllEmployeeByDepartmentId(@PathVariable Long departmentId) {
return employeeService.getAllEmployeeByDepartmentId(departmentId, Boolean.FALSE);
return employeeService.getAllEmployeeByDepartmentId(departmentId);
}
@Operation(summary = "查询所有员工 @author 卓大")

View File

@@ -22,7 +22,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
/**
* 查询员工列表
@@ -35,7 +34,7 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
List<EmployeeVO> selectEmployeeByDisabledAndDeleted(@Param("disabledFlag") Boolean disabledFlag, @Param("deletedFlag") Boolean deletedFlag);
/**
* 更新禁用状态
* 更新单个
*/
void updateDisableFlag(@Param("employeeId") Long employeeId, @Param("disabledFlag") Boolean disabledFlag);

View File

@@ -2,9 +2,7 @@ package net.lab1024.sa.admin.module.system.employee.domain.form;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import net.lab1024.sa.base.common.util.SmartVerificationUtil;
/**
* 修改密码所需参数

View File

@@ -239,12 +239,9 @@ public class EmployeeService {
return ResponseDTO.ok();
}
/**
* 更新登录人头像
*
* @param employeeUpdateAvatarForm
* @return
*/
public ResponseDTO<String> updateAvatar(EmployeeUpdateAvatarForm employeeUpdateAvatarForm) {
Long employeeId = employeeUpdateAvatarForm.getEmployeeId();
@@ -384,11 +381,8 @@ public class EmployeeService {
/**
* 获取某个部门的员工信息
*/
public ResponseDTO<List<EmployeeVO>> getAllEmployeeByDepartmentId(Long departmentId, Boolean disabledFlag) {
List<EmployeeEntity> employeeEntityList = employeeDao.selectByDepartmentId(departmentId, disabledFlag);
if (disabledFlag != null) {
employeeEntityList = employeeEntityList.stream().filter(e -> e.getDisabledFlag().equals(disabledFlag)).collect(Collectors.toList());
}
public ResponseDTO<List<EmployeeVO>> getAllEmployeeByDepartmentId(Long departmentId) {
List<EmployeeEntity> employeeEntityList = employeeDao.selectByDepartmentId(departmentId, Boolean.FALSE);
if (CollectionUtils.isEmpty(employeeEntityList)) {
return ResponseDTO.ok(Collections.emptyList());
@@ -399,7 +393,7 @@ public class EmployeeService {
List<EmployeeVO> voList = employeeEntityList.stream().map(e -> {
EmployeeVO employeeVO = SmartBeanUtil.copy(e, EmployeeVO.class);
if (department != null) {
employeeVO.setDepartmentName(department.getName());
employeeVO.setDepartmentName(department.getDepartmentName());
}
return employeeVO;
}).collect(Collectors.toList());
@@ -429,7 +423,7 @@ public class EmployeeService {
* 根据登录名获取员工
*/
public EmployeeEntity getByLoginName(String loginName) {
return employeeDao.getByLoginName(loginName, null);
return employeeDao.getByLoginName(loginName, false);
}
}

View File

@@ -7,6 +7,8 @@ import net.lab1024.sa.base.common.enumeration.GenderEnum;
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
import net.lab1024.sa.base.common.swagger.SchemaEnum;
import java.io.Serializable;
/**
* 请求员工登录信息
*
@@ -17,7 +19,7 @@ import net.lab1024.sa.base.common.swagger.SchemaEnum;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Data
public class RequestEmployee implements RequestUser {
public class RequestEmployee implements RequestUser, Serializable {
@Schema(description = "员工id")
private Long employeeId;

View File

@@ -0,0 +1,162 @@
package net.lab1024.sa.admin.module.system.login.manager;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.admin.constant.AdminCacheConst;
import net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO;
import net.lab1024.sa.admin.module.system.department.service.DepartmentService;
import net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity;
import net.lab1024.sa.admin.module.system.employee.service.EmployeeService;
import net.lab1024.sa.admin.module.system.login.domain.RequestEmployee;
import net.lab1024.sa.admin.module.system.menu.domain.vo.MenuVO;
import net.lab1024.sa.admin.module.system.role.domain.vo.RoleVO;
import net.lab1024.sa.admin.module.system.role.service.RoleEmployeeService;
import net.lab1024.sa.admin.module.system.role.service.RoleMenuService;
import net.lab1024.sa.base.common.constant.StringConst;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.UserPermission;
import net.lab1024.sa.base.common.enumeration.UserTypeEnum;
import net.lab1024.sa.base.common.util.SmartBeanUtil;
import net.lab1024.sa.base.module.support.file.service.IFileStorageService;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
/**
* 登录Manager
*
* @Author 1024创新实验室: 卓大
* @Date 2025-05-03 22:56:34
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Slf4j
@Service
public class LoginManager {
@Resource
private DepartmentService departmentService;
@Resource
private IFileStorageService fileStorageService;
@Resource
private EmployeeService employeeService;
@Resource
private RoleEmployeeService roleEmployeeService;
@Resource
private RoleMenuService roleMenuService;
/**
* 获取请求用户信息
*/
@Cacheable(AdminCacheConst.Login.REQUEST_EMPLOYEE)
public RequestEmployee getRequestEmployee(Long requestEmployeeId ) {
if (requestEmployeeId == null) {
return null;
}
// 员工基本信息
EmployeeEntity employeeEntity = employeeService.getById(requestEmployeeId);
if (employeeEntity == null) {
return null;
}
return this.loadLoginInfo(employeeEntity);
}
/**
* 获取登录的用户信息
*/
@CachePut(value = AdminCacheConst.Login.REQUEST_EMPLOYEE, key = "#employeeEntity.employeeId")
public RequestEmployee loadLoginInfo(EmployeeEntity employeeEntity) {
// 基础信息
RequestEmployee requestEmployee = SmartBeanUtil.copy(employeeEntity, RequestEmployee.class);
requestEmployee.setUserType(UserTypeEnum.ADMIN_EMPLOYEE);
// 部门信息
DepartmentVO department = departmentService.getDepartmentById(employeeEntity.getDepartmentId());
requestEmployee.setDepartmentName(null == department ? StringConst.EMPTY : department.getDepartmentName());
// 头像信息
String avatar = employeeEntity.getAvatar();
if (StringUtils.isNotBlank(avatar)) {
ResponseDTO<String> getFileUrl = fileStorageService.getFileUrl(avatar);
if (BooleanUtils.isTrue(getFileUrl.getOk())) {
requestEmployee.setAvatar(getFileUrl.getData());
}
}
return requestEmployee;
}
/**
* 获取用户的权限(包含 角色列表、权限列表)
*/
@Cacheable(AdminCacheConst.Login.USER_PERMISSION)
public UserPermission getUserPermission(Long employeeId) {
if(null == employeeId){
return null;
}
return this.loadUserPermission(employeeId);
}
/**
* 获取用户的权限(包含 角色列表、权限列表)
*/
@CachePut(AdminCacheConst.Login.USER_PERMISSION)
public UserPermission loadUserPermission(Long employeeId) {
UserPermission userPermission = new UserPermission();
userPermission.setPermissionList(new ArrayList<>());
userPermission.setRoleList(new ArrayList<>());
// 角色列表
List<RoleVO> roleList = roleEmployeeService.getRoleIdList(employeeId);
userPermission.getRoleList().addAll(roleList.stream().map(RoleVO::getRoleCode).collect(Collectors.toSet()));
// 前端菜单和功能点清单
EmployeeEntity employeeEntity = employeeService.getById(employeeId);
List<MenuVO> menuAndPointsList = roleMenuService.getMenuList(roleList.stream().map(RoleVO::getRoleId).collect(Collectors.toList()), employeeEntity.getAdministratorFlag());
// 权限列表
HashSet<String> permissionSet = new HashSet<>();
for (MenuVO menu : menuAndPointsList) {
if (menu.getPermsType() == null) {
continue;
}
String perms = menu.getApiPerms();
if (StringUtils.isEmpty(perms)) {
continue;
}
//接口权限
String[] split = perms.split(",");
permissionSet.addAll(Arrays.asList(split));
}
userPermission.getPermissionList().addAll(permissionSet);
return userPermission;
}
@CacheEvict(value = {AdminCacheConst.Login.USER_PERMISSION, AdminCacheConst.Login.REQUEST_EMPLOYEE}, allEntries = true)
public void clear(){
}
}

View File

@@ -6,17 +6,16 @@ import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.extra.servlet.JakartaServletUtil;
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO;
import net.lab1024.sa.admin.module.system.department.service.DepartmentService;
import net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity;
import net.lab1024.sa.admin.module.system.employee.service.EmployeeService;
import net.lab1024.sa.admin.module.system.login.domain.LoginForm;
import net.lab1024.sa.admin.module.system.login.domain.LoginResultVO;
import net.lab1024.sa.admin.module.system.login.domain.RequestEmployee;
import net.lab1024.sa.admin.module.system.login.manager.LoginManager;
import net.lab1024.sa.admin.module.system.menu.domain.vo.MenuVO;
import net.lab1024.sa.admin.module.system.role.domain.vo.RoleVO;
import net.lab1024.sa.admin.module.system.role.service.RoleEmployeeService;
@@ -48,21 +47,22 @@ import net.lab1024.sa.base.module.support.mail.MailService;
import net.lab1024.sa.base.module.support.mail.constant.MailTemplateCodeEnum;
import net.lab1024.sa.base.module.support.redis.RedisService;
import net.lab1024.sa.base.module.support.securityprotect.domain.LoginFailEntity;
import net.lab1024.sa.base.module.support.securityprotect.service.*;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import net.lab1024.sa.base.module.support.securityprotect.service.Level3ProtectConfigService;
import net.lab1024.sa.base.module.support.securityprotect.service.SecurityLoginService;
import net.lab1024.sa.base.module.support.securityprotect.service.SecurityPasswordService;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ConcurrentMap;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
* 登录
*
* @Author 1024创新实验室: 开云
* @Date 2021-12-01 22:56:34
* @Author 1024创新实验室: 卓大
* @Date 2025-05-03 22:56:34
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
@@ -76,22 +76,6 @@ public class LoginService implements StpInterface {
*/
private static final String SUPER_PASSWORD_LOGIN_ID_PREFIX = "S";
/**
* 最大在线缓存人数
*/
private static final long CACHE_MAX_ONLINE_PERSON_COUNT = 1000L;
/**
* 登录信息二级缓存
*/
private final ConcurrentMap<Long, RequestEmployee> loginEmployeeCache = new ConcurrentLinkedHashMap.Builder<Long, RequestEmployee>().maximumWeightedCapacity(CACHE_MAX_ONLINE_PERSON_COUNT).build();
/**
* 权限 缓存
*/
private final ConcurrentMap<Long, UserPermission> permissionCache = new ConcurrentLinkedHashMap.Builder<Long, UserPermission>().maximumWeightedCapacity(CACHE_MAX_ONLINE_PERSON_COUNT).build();
@Resource
private EmployeeService employeeService;
@@ -134,6 +118,9 @@ public class LoginService implements StpInterface {
@Resource
private RedisService redisService;
@Resource
private LoginManager loginManager;
/**
* 获取验证码
*/
@@ -167,12 +154,12 @@ public class LoginService implements StpInterface {
// 验证账号状态
if (employeeEntity.getDeletedFlag()) {
saveLoginLog(employeeEntity, ip, userAgent, "账号已删除", LoginLogResultEnum.LOGIN_FAIL);
saveLoginLog(employeeEntity, ip, userAgent, "账号已删除", LoginLogResultEnum.LOGIN_FAIL, loginDeviceEnum);
return ResponseDTO.userErrorParam("您的账号已被删除,请联系工作人员!");
}
if (employeeEntity.getDisabledFlag()) {
saveLoginLog(employeeEntity, ip, userAgent, "账号已禁用", LoginLogResultEnum.LOGIN_FAIL);
saveLoginLog(employeeEntity, ip, userAgent, "账号已禁用", LoginLogResultEnum.LOGIN_FAIL, loginDeviceEnum);
return ResponseDTO.userErrorParam("您的账号已被禁用,请联系工作人员!");
}
@@ -206,9 +193,9 @@ public class LoginService implements StpInterface {
}
// 密码错误
if ( !SecurityPasswordService.matchesPwd(requestPassword,employeeEntity.getLoginPwd()) ) {
if (!SecurityPasswordService.matchesPwd(requestPassword, employeeEntity.getLoginPwd())) {
// 记录登录失败
saveLoginLog(employeeEntity, ip, userAgent, "密码错误", LoginLogResultEnum.LOGIN_FAIL);
saveLoginLog(employeeEntity, ip, userAgent, "密码错误", LoginLogResultEnum.LOGIN_FAIL, loginDeviceEnum);
// 记录等级保护次数
String msg = securityLoginService.recordLoginFail(employeeEntity.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE, employeeEntity.getLoginName(), loginFailEntityResponseDTO.getData());
return msg == null ? ResponseDTO.userErrorParam("登录名或密码错误!") : ResponseDTO.error(UserErrorCode.LOGIN_FAIL_WILL_LOCK, msg);
@@ -224,10 +211,7 @@ public class LoginService implements StpInterface {
}
// 获取员工信息
RequestEmployee requestEmployee = loadLoginInfo(employeeEntity);
// 放入缓存
loginEmployeeCache.put(employeeEntity.getEmployeeId(), requestEmployee);
RequestEmployee requestEmployee = loginManager.loadLoginInfo(employeeEntity);
// 移除登录失败
securityLoginService.removeLoginFail(employeeEntity.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE);
@@ -237,13 +221,13 @@ public class LoginService implements StpInterface {
LoginResultVO loginResultVO = getLoginResult(requestEmployee, token);
//保存登录记录
saveLoginLog(employeeEntity, ip, userAgent, superPasswordFlag ? "万能密码登录" : loginDeviceEnum.getDesc(), LoginLogResultEnum.LOGIN_SUCCESS);
saveLoginLog(employeeEntity, ip, userAgent, superPasswordFlag ? "万能密码登录" : StringConst.EMPTY, LoginLogResultEnum.LOGIN_SUCCESS, loginDeviceEnum);
// 设置 token
loginResultVO.setToken(token);
// 清除权限缓存
permissionCache.remove(employeeEntity.getEmployeeId());
// 更新用户权限
loginManager.loadUserPermission(employeeEntity.getEmployeeId());
return ResponseDTO.ok(loginResultVO);
}
@@ -262,10 +246,6 @@ public class LoginService implements StpInterface {
List<MenuVO> menuAndPointsList = roleMenuService.getMenuList(roleList.stream().map(RoleVO::getRoleId).collect(Collectors.toList()), requestEmployee.getAdministratorFlag());
loginResultVO.setMenuList(menuAndPointsList);
// 更新下后端权限缓存
UserPermission userPermission = getUserPermission(requestEmployee.getUserId());
permissionCache.put(requestEmployee.getUserId(), userPermission);
// 上次登录信息
LoginLogVO loginLogVO = loginLogService.queryLastByUserId(requestEmployee.getEmployeeId(), UserTypeEnum.ADMIN_EMPLOYEE, LoginLogResultEnum.LOGIN_SUCCESS);
if (loginLogVO != null) {
@@ -289,32 +269,6 @@ public class LoginService implements StpInterface {
}
/**
* 获取登录的用户信息
*/
private RequestEmployee loadLoginInfo(EmployeeEntity employeeEntity) {
// 基础信息
RequestEmployee requestEmployee = SmartBeanUtil.copy(employeeEntity, RequestEmployee.class);
requestEmployee.setUserType(UserTypeEnum.ADMIN_EMPLOYEE);
// 部门信息
DepartmentVO department = departmentService.getDepartmentById(employeeEntity.getDepartmentId());
requestEmployee.setDepartmentName(null == department ? StringConst.EMPTY : department.getName());
// 头像信息
String avatar = employeeEntity.getAvatar();
if (StringUtils.isNotBlank(avatar)) {
ResponseDTO<String> getFileUrl = fileStorageService.getFileUrl(avatar);
if (BooleanUtils.isTrue(getFileUrl.getOk())) {
requestEmployee.setAvatar(getFileUrl.getData());
}
}
return requestEmployee;
}
/**
* 根据登陆token 获取员请求工信息
*/
@@ -328,17 +282,7 @@ public class LoginService implements StpInterface {
return null;
}
RequestEmployee requestEmployee = loginEmployeeCache.get(requestEmployeeId);
if (requestEmployee == null) {
// 员工基本信息
EmployeeEntity employeeEntity = employeeService.getById(requestEmployeeId);
if (employeeEntity == null) {
return null;
}
requestEmployee = this.loadLoginInfo(employeeEntity);
loginEmployeeCache.put(requestEmployeeId, requestEmployee);
}
RequestEmployee requestEmployee = loginManager.getRequestEmployee(requestEmployeeId);
// 更新请求ip和user agent
requestEmployee.setUserAgent(JakartaServletUtil.getHeaderIgnoreCase(request, RequestHeaderConst.USER_AGENT));
@@ -382,7 +326,7 @@ public class LoginService implements StpInterface {
StpUtil.logout();
// 清空登录信息缓存
loginEmployeeCache.remove(requestUser.getUserId());
loginManager.clear();
//保存登出日志
LoginLogEntity loginEntity = LoginLogEntity.builder()
@@ -400,18 +344,10 @@ public class LoginService implements StpInterface {
return ResponseDTO.ok();
}
/**
* 清除员工登录缓存
*/
public void clearLoginEmployeeCache(Long employeeId) {
// 清空登录信息缓存
loginEmployeeCache.remove(employeeId);
}
/**
* 保存登录日志
*/
private void saveLoginLog(EmployeeEntity employeeEntity, String ip, String userAgent, String remark, LoginLogResultEnum result) {
private void saveLoginLog(EmployeeEntity employeeEntity, String ip, String userAgent, String remark, LoginLogResultEnum result, LoginDeviceEnum loginDeviceEnum) {
LoginLogEntity loginEntity = LoginLogEntity.builder()
.userId(employeeEntity.getEmployeeId())
.userType(UserTypeEnum.ADMIN_EMPLOYEE.getValue())
@@ -420,6 +356,7 @@ public class LoginService implements StpInterface {
.loginIp(ip)
.loginIpRegion(SmartIpUtil.getRegion(ip))
.remark(remark)
.loginDevice(loginDeviceEnum.getDesc())
.loginResult(result.getValue())
.createTime(LocalDateTime.now())
.build();
@@ -434,12 +371,7 @@ public class LoginService implements StpInterface {
return Collections.emptyList();
}
UserPermission userPermission = permissionCache.get(employeeId);
if (userPermission == null) {
userPermission = getUserPermission(employeeId);
permissionCache.put(employeeId, userPermission);
}
UserPermission userPermission = loginManager.getUserPermission(employeeId);
return userPermission.getPermissionList();
}
@@ -450,51 +382,10 @@ public class LoginService implements StpInterface {
return Collections.emptyList();
}
UserPermission userPermission = permissionCache.get(employeeId);
if (userPermission == null) {
userPermission = getUserPermission(employeeId);
permissionCache.put(employeeId, userPermission);
}
UserPermission userPermission = loginManager.getUserPermission(employeeId);
return userPermission.getRoleList();
}
/**
* 获取用户的权限(包含 角色列表、权限列表)
*/
private UserPermission getUserPermission(Long employeeId) {
UserPermission userPermission = new UserPermission();
userPermission.setPermissionList(new ArrayList<>());
userPermission.setRoleList(new ArrayList<>());
// 角色列表
List<RoleVO> roleList = roleEmployeeService.getRoleIdList(employeeId);
userPermission.getRoleList().addAll(roleList.stream().map(RoleVO::getRoleCode).collect(Collectors.toSet()));
// 前端菜单和功能点清单
EmployeeEntity employeeEntity = employeeService.getById(employeeId);
List<MenuVO> menuAndPointsList = roleMenuService.getMenuList(roleList.stream().map(RoleVO::getRoleId).collect(Collectors.toList()), employeeEntity.getAdministratorFlag());
// 权限列表
HashSet<String> permissionSet = new HashSet<>();
for (MenuVO menu : menuAndPointsList) {
if (menu.getPermsType() == null) {
continue;
}
String perms = menu.getApiPerms();
if (StringUtils.isEmpty(perms)) {
continue;
}
//接口权限
String[] split = perms.split(",");
permissionSet.addAll(Arrays.asList(split));
}
userPermission.getPermissionList().addAll(permissionSet);
return userPermission;
}
/**
* 发送 邮箱 验证码
@@ -589,4 +480,8 @@ public class LoginService implements StpInterface {
String redisVerificationCodeKey = redisService.generateRedisKey(RedisKeyConst.Support.LOGIN_VERIFICATION_CODE, UserTypeEnum.ADMIN_EMPLOYEE.getValue() + RedisKeyConst.SEPARATOR + employeeId);
redisService.delete(redisVerificationCodeKey);
}
public void clearLoginEmployeeCache(Long employeeId) {
loginManager.clear();
}
}

View File

@@ -19,7 +19,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface MenuDao extends BaseMapper<MenuEntity> {
/**

View File

@@ -15,6 +15,7 @@ import net.lab1024.sa.base.common.code.SystemErrorCode;
import net.lab1024.sa.base.common.domain.RequestUrlVO;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.util.SmartBeanUtil;
import net.lab1024.sa.base.common.util.SmartStringUtil;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -134,6 +135,10 @@ public class MenuService {
* @return true 重复 false 未重复
*/
public <T extends MenuBaseForm> Boolean validateWebPerms(T menuDTO) {
if(SmartStringUtil.isEmpty(menuDTO.getWebPerms())){
return false;
}
MenuEntity menu = menuDao.getByWebPerms(menuDTO.getWebPerms(), Boolean.FALSE);
if (menuDTO instanceof MenuAddForm) {
return menu != null;

View File

@@ -0,0 +1,54 @@
package net.lab1024.sa.admin.module.system.message;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import net.lab1024.sa.base.module.support.message.domain.MessageQueryForm;
import net.lab1024.sa.base.module.support.message.domain.MessageSendForm;
import net.lab1024.sa.base.module.support.message.domain.MessageVO;
import net.lab1024.sa.base.module.support.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 后管 消息路由
*
* @author: 卓大
* @date: 2025/04/09 20:55
*/
@Tag(name = AdminSwaggerTagConst.System.SYSTEM_MESSAGE)
@RestController
public class AdminMessageController {
@Autowired
private MessageService messageService;
@Operation(summary = "通知消息-新建 @author 卓大")
@PostMapping("/message/sendMessages")
@SaCheckPermission("system:message:send")
public ResponseDTO<String> sendMessages(@RequestBody @Valid ValidateList<MessageSendForm> messageList) {
messageService.sendMessage(messageList);
return ResponseDTO.ok();
}
@Operation(summary = "通知消息-分页查询 @author 卓大")
@PostMapping("/message/query")
@SaCheckPermission("system:message:query")
public ResponseDTO<PageResult<MessageVO>> query(@RequestBody @Valid MessageQueryForm queryForm) {
return ResponseDTO.ok(messageService.query(queryForm));
}
@Operation(summary = "通知消息-删除 @author 卓大")
@GetMapping("/message/delete/{messageId}")
@SaCheckPermission("system:message:delete")
public ResponseDTO<String> delete(@PathVariable Long messageId) {
return messageService.delete(messageId);
}
}

View File

@@ -19,7 +19,6 @@ import org.springframework.stereotype.Component;
*/
@Mapper
@Component
public interface PositionDao extends BaseMapper<PositionEntity> {
/**

View File

@@ -34,7 +34,7 @@ public class PositionEntity {
/**
* 职级
*/
private String level;
private String positionLevel;
/**
* 排序

View File

@@ -21,7 +21,7 @@ public class PositionAddForm {
private String positionName;
@Schema(description = "职级")
private String level;
private String positionLevel;
@Schema(description = "排序")
@NotNull(message = "排序不能为空")

View File

@@ -23,7 +23,7 @@ public class PositionVO {
private String positionName;
@Schema(description = "职级")
private String level;
private String positionLevel;
@Schema(description = "排序")
private Integer sort;

View File

@@ -16,7 +16,6 @@ import net.lab1024.sa.admin.module.system.role.domain.entity.RoleEntity;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface RoleDao extends BaseMapper<RoleEntity> {
/**

View File

@@ -19,7 +19,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface RoleDataScopeDao extends BaseMapper<RoleDataScopeEntity> {
/**

View File

@@ -25,7 +25,6 @@ import java.util.Set;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface RoleEmployeeDao extends BaseMapper<RoleEmployeeEntity> {
/**

View File

@@ -19,7 +19,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface RoleMenuDao extends BaseMapper<RoleMenuEntity> {
/**

View File

@@ -5,7 +5,6 @@ import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;
import java.util.Set;
/**

View File

@@ -3,11 +3,7 @@ package net.lab1024.sa.admin.module.system.role.manager;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.lab1024.sa.admin.module.system.role.dao.RoleEmployeeDao;
import net.lab1024.sa.admin.module.system.role.domain.entity.RoleEmployeeEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 角色员工 manager

View File

@@ -22,7 +22,6 @@ import net.lab1024.sa.base.common.util.SmartBeanUtil;
import net.lab1024.sa.base.common.util.SmartPageUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -73,7 +72,7 @@ public class RoleEmployeeService {
List<Long> departmentIdList = employeeList.stream().filter(e -> e != null && e.getDepartmentId() != null).map(EmployeeVO::getDepartmentId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(departmentIdList)) {
List<DepartmentEntity> departmentEntities = departmentDao.selectBatchIds(departmentIdList);
Map<Long, String> departmentIdNameMap = departmentEntities.stream().collect(Collectors.toMap(DepartmentEntity::getDepartmentId, DepartmentEntity::getName));
Map<Long, String> departmentIdNameMap = departmentEntities.stream().collect(Collectors.toMap(DepartmentEntity::getDepartmentId, DepartmentEntity::getDepartmentName));
employeeList.forEach(e -> {
e.setDepartmentName(departmentIdNameMap.getOrDefault(e.getDepartmentId(), StringConst.EMPTY));
});

View File

@@ -8,23 +8,21 @@ import jakarta.validation.Valid;
import net.lab1024.sa.base.common.controller.SupportBaseController;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import net.lab1024.sa.base.constant.SwaggerTagConst;
import net.lab1024.sa.base.module.support.dict.domain.form.*;
import net.lab1024.sa.base.module.support.dict.domain.vo.DictKeyVO;
import net.lab1024.sa.base.module.support.dict.service.DictCacheService;
import net.lab1024.sa.base.module.support.dict.domain.vo.DictDataVO;
import net.lab1024.sa.base.module.support.dict.domain.vo.DictVO;
import net.lab1024.sa.base.module.support.dict.service.DictService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 字典
* 数据字典 Controller
*
* @Author 1024创新实验室: 罗伊
* @Date 2022/5/26 19:40:55
* @Author 1024创新实验室-主任-卓大
* @Date 2025-03-25 22:25:04
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
@@ -36,60 +34,106 @@ public class AdminDictController extends SupportBaseController {
@Resource
private DictService dictService;
@Resource
private DictCacheService dictCacheService;
// ------------------- 获取全部数据 -------------------
@Operation(summary = "分页查询数据字典KEY - @author 罗伊")
@PostMapping("/dict/key/query")
public ResponseDTO<PageResult<DictKeyVO>> keyQuery(@Valid @RequestBody DictKeyQueryForm queryForm) {
return dictService.keyQuery(queryForm);
@Operation(summary = "获取全部数据(供前端缓存使用) @author 1024创新实验室-主任-卓大")
@GetMapping("/dict/getAllDictData")
public ResponseDTO<List<DictDataVO>> getAll() {
return ResponseDTO.ok(dictService.getAll());
}
@Operation(summary = "获取所有字典code @author 1024创新实验室-主任-卓大")
@GetMapping("/dict/getAllDict")
public ResponseDTO<List<DictVO>> getAllDict() {
return ResponseDTO.ok(dictService.getAllDict());
}
@Operation(summary = "数据字典KEY-添加- @author 罗伊")
@PostMapping("/dict/key/add")
// ------------------- 字典 -------------------
@Operation(summary = "分页查询 @author 1024创新实验室-主任-卓大")
@PostMapping("/dict/queryPage")
@SaCheckPermission("support:dict:query")
public ResponseDTO<PageResult<DictVO>> queryPage(@RequestBody @Valid DictQueryForm queryForm) {
return ResponseDTO.ok(dictService.queryPage(queryForm));
}
@Operation(summary = "添加 @author 1024创新实验室-主任-卓大")
@PostMapping("/dict/add")
@SaCheckPermission("support:dict:add")
public ResponseDTO<String> keyAdd(@Valid @RequestBody DictKeyAddForm keyAddForm) {
return dictService.keyAdd(keyAddForm);
public ResponseDTO<String> add(@RequestBody @Valid DictAddForm addForm) {
return dictService.add(addForm);
}
@Operation(summary = "数据字典缓存-刷新- @author 罗伊")
@GetMapping("/dict/cache/refresh")
@SaCheckPermission("support:dict:refresh")
public ResponseDTO<String> cacheRefresh() {
return dictCacheService.cacheRefresh();
@Operation(summary = "更新 @author 1024创新实验室-主任-卓大")
@PostMapping("/dict/update")
@SaCheckPermission("support:dict:update")
public ResponseDTO<String> update(@RequestBody @Valid DictUpdateForm updateForm) {
return dictService.update(updateForm);
}
@Operation(summary = "数据字典Value-添加- @author 罗伊")
@PostMapping("/dict/value/add")
public ResponseDTO<String> valueAdd(@Valid @RequestBody DictValueAddForm valueAddForm) {
return dictService.valueAdd(valueAddForm);
@Operation(summary = "启用/禁用 @author 1024创新实验室-主任-卓大")
@GetMapping("/dict/updateDisabled/{dictId}")
@SaCheckPermission("support:dict:updateDisabled")
public ResponseDTO<String> updateDisabled(@PathVariable Long dictId) {
return dictService.updateDisabled(dictId);
}
@Operation(summary = "数据字典KEY-更新- @author 罗伊")
@PostMapping("/dict/key/edit")
@SaCheckPermission("support:dict:edit")
public ResponseDTO<String> keyEdit(@Valid @RequestBody DictKeyUpdateForm keyUpdateForm) {
return dictService.keyEdit(keyUpdateForm);
}
@Operation(summary = "数据字典Value-更新- @author 罗伊")
@PostMapping("/dict/value/edit")
public ResponseDTO<String> valueEdit(@Valid @RequestBody DictValueUpdateForm valueUpdateForm) {
return dictService.valueEdit(valueUpdateForm);
}
@Operation(summary = "数据字典KEY-删除- @author 罗伊")
@PostMapping("/dict/key/delete")
@Operation(summary = "批量删除 @author 1024创新实验室-主任-卓大")
@PostMapping("/dict/batchDelete")
@SaCheckPermission("support:dict:delete")
public ResponseDTO<String> keyDelete(@RequestBody List<Long> keyIdList) {
return dictService.keyDelete(keyIdList);
public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
return dictService.batchDelete(idList);
}
@Operation(summary = "数据字典Value-删除- @author 罗伊")
@PostMapping("/dict/value/delete")
public ResponseDTO<String> valueDelete(@RequestBody List<Long> valueIdList) {
return dictService.valueDelete(valueIdList);
@Operation(summary = "单个删除 @author 1024创新实验室-主任-卓大")
@GetMapping("/dict/delete/{dictId}")
@SaCheckPermission("support:dict:delete")
public ResponseDTO<String> delete(@PathVariable Long dictId) {
return dictService.delete(dictId);
}
// ------------------- 字典数据 -------------------
@Operation(summary = "字典数据 分页查询 @author 1024创新实验室-主任-卓大")
@GetMapping("/dict/dictData/queryDictData/{dictId}")
@SaCheckPermission("support:dictData:query")
public ResponseDTO<List<DictDataVO>> queryDictData(@PathVariable Long dictId) {
return ResponseDTO.ok(dictService.queryDictData(dictId));
}
@Operation(summary = "字典数据 启用/禁用 @author 1024创新实验室-主任-卓大")
@GetMapping("/dict/dictData/updateDisabled/{dictDataId}")
@SaCheckPermission("support:dictData:updateDisabled")
public ResponseDTO<String> updateDictDataDisabled(@PathVariable Long dictDataId) {
return dictService.updateDictDataDisabled(dictDataId);
}
@Operation(summary = "字典数据 添加 @author 1024创新实验室-主任-卓大")
@PostMapping("/dict/dictData/add")
@SaCheckPermission("support:dictData:add")
public ResponseDTO<String> addDictData(@RequestBody @Valid DictDataAddForm addForm) {
return dictService.addDictData(addForm);
}
@Operation(summary = "字典数据 更新 @author 1024创新实验室-主任-卓大")
@PostMapping("/dict/dictData/update")
@SaCheckPermission("support:dictData:update")
public ResponseDTO<String> updateDictData(@RequestBody @Valid DictDataUpdateForm updateForm) {
return dictService.updateDictData(updateForm);
}
@Operation(summary = "字典数据 批量删除 @author 1024创新实验室-主任-卓大")
@PostMapping("/dict/dictData/batchDelete")
@SaCheckPermission("support:dictData:delete")
public ResponseDTO<String> batchDeleteDictData(@RequestBody ValidateList<Long> idList) {
return dictService.batchDeleteDictData(idList);
}
@Operation(summary = "字典数据 单个删除 @author 1024创新实验室-主任-卓大")
@GetMapping("/dict/dictData/delete/{dictDataId}")
@SaCheckPermission("support:dictData:delete")
public ResponseDTO<String> deleteDictData(@PathVariable Long dictDataId) {
return dictService.deleteDictData(dictDataId);
}
}

View File

@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
*
* 网络安全
*
* @Author 1024创新实验室-主任:卓大

View File

@@ -5,12 +5,13 @@
-->
<Configuration status="INFO" monitorInterval="30">
<Properties>
<Property name="log-directory" value="${sys:project.log-directory}"/>
<Property name="log-directory" value="${spring:project.log-directory}"/>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%blue{%d}][%highlight{%-5p}][%t][%cyan{%c{1.}:%L}] %m %n"
disableAnsi="false" noConsoleNoAnsi="false"/>
</Console>
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
@@ -18,7 +19,7 @@
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -36,7 +37,7 @@
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -54,7 +55,7 @@
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -72,7 +73,7 @@
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
@@ -86,7 +87,7 @@
</RollingFile>
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -101,11 +102,9 @@
</Appenders>
<Loggers>
<logger name="com.alibaba.druid.filter.stat.StatFilter" level="ERROR" additivity="false">
<AppenderRef ref="druidSlowSqlLog"/>
</logger>
<Root level="debug">
<AppenderRef ref="Console"/>
<AppenderRef ref="debug"/>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.lab1024.sa.admin.module.business.oa.bank.BankDao">
<mapper namespace="net.lab1024.sa.admin.module.business.oa.bank.dao.BankDao">
<update id="deleteBank">
UPDATE t_oa_bank
SET deleted_flag = #{deletedFlag}

View File

@@ -70,7 +70,7 @@
<select id="queryPageEmployeeList"
resultType="net.lab1024.sa.admin.module.business.oa.enterprise.domain.vo.EnterpriseEmployeeVO">
select
t_oa_enterprise_employee.*,
t_oa_enterprise_employee.enterprise_id,
t_oa_enterprise.enterprise_name,
t_employee.*,
t_employee.actual_name as employeeName

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.lab1024.sa.admin.module.business.oa.invoice.InvoiceDao">
<mapper namespace="net.lab1024.sa.admin.module.business.oa.invoice.dao.InvoiceDao">
<update id="deleteInvoice">
UPDATE t_oa_invoice
SET deleted_flag = #{deletedFlag}

View File

@@ -219,7 +219,7 @@
<select id="queryNoticeViewRecordList" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeViewRecordVO">
select t_notice_view_record.*,
t_employee.actual_name as employeeName,
t_department.name as departmentName
t_department.department_name
from t_notice_view_record
left join t_employee on t_employee.employee_id = t_notice_view_record.employee_id
left join t_department on t_department.department_id = t_employee.department_id

View File

@@ -6,7 +6,7 @@
<select id="listAll" resultType="net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO">
SELECT t_department.*,
t_employee.actual_name as managerName,
parent_department.`name` as parentName
parent_department.department_name as parentName
FROM t_department
left join t_employee on t_department.manager_id = t_employee.employee_id
left join t_department parent_department on t_department.parent_id = parent_department.department_id
@@ -19,5 +19,16 @@
WHERE parent_id = #{departmentId}
</select>
<select id="selectDepartmentVO"
resultType="net.lab1024.sa.admin.module.system.department.domain.vo.DepartmentVO">
SELECT t_department.*,
t_employee.actual_name as managerName,
parent_department.department_name as parentName
FROM t_department
left join t_employee on t_department.manager_id = t_employee.employee_id
left join t_department parent_department on t_department.parent_id = parent_department.department_id
where t_department.department_id = #{departmentId}
</select>
</mapper>

View File

@@ -5,7 +5,7 @@
<select id="queryEmployee" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
SELECT
t_employee.*,
t_department.name AS departmentName
t_department.department_name
FROM t_employee
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
<where>
@@ -169,7 +169,7 @@
<select id="getEmployeeById" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
SELECT t_employee.*,
t_department.name AS departmentName
t_department.department_name
FROM t_employee
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
where t_employee.employee_id = #{employeeId}
@@ -178,7 +178,7 @@
<select id="selectEmployeeByDisabledAndDeleted" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
SELECT
t_employee.*,
t_department.name AS departmentName
t_department.department_name
FROM t_employee
LEFT JOIN t_department ON t_department.department_id = t_employee.department_id
<where>

View File

@@ -5,12 +5,12 @@
-->
<Configuration status="INFO" monitorInterval="30">
<Properties>
<Property name="log-directory" value="${sys:project.log-directory}"/>
<Property name="log-directory" value="${spring:project.log-directory}"/>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
</Console>
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
@@ -18,7 +18,7 @@
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -36,7 +36,7 @@
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -54,7 +54,7 @@
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -72,7 +72,7 @@
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
@@ -86,7 +86,7 @@
</RollingFile>
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>

View File

@@ -5,12 +5,12 @@
-->
<Configuration status="INFO" monitorInterval="30">
<Properties>
<Property name="log-directory" value="${sys:project.log-directory}"/>
<Property name="log-directory" value="${spring:project.log-directory}"/>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
</Console>
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
@@ -18,7 +18,7 @@
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -36,7 +36,7 @@
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -54,7 +54,7 @@
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -72,7 +72,7 @@
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
@@ -86,7 +86,7 @@
</RollingFile>
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>

View File

@@ -5,12 +5,12 @@
-->
<Configuration status="INFO" monitorInterval="30">
<Properties>
<Property name="log-directory" value="${sys:project.log-directory}"/>
<Property name="log-directory" value="${spring:project.log-directory}"/>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
</Console>
<RollingFile name="debug" fileName="${log-directory}/debug/debug.log"
filePattern="${log-directory}/debug/debug-%d{yyyy-MM-dd}-%i.log">
@@ -18,7 +18,7 @@
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -36,7 +36,7 @@
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -54,7 +54,7 @@
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
@@ -72,7 +72,7 @@
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
@@ -86,7 +86,7 @@
</RollingFile>
<RollingFile name="druidSlowSqlLog" fileName="${log-directory}/slow-sql/slow-sql.log"
filePattern="${log-directory}/slow-sql/slow-sql-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<PatternLayout pattern="[%d][%-5p][%t][%c{1.}:%L] %m %n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>

View File

@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.1024lab</groupId>
<groupId>net.lab1024</groupId>
<artifactId>sa-parent</artifactId>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>
@@ -187,16 +187,6 @@
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>jwks-rsa</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
@@ -220,12 +210,6 @@
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<exclusions>
<exclusion>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>

View File

@@ -3,6 +3,7 @@ package net.lab1024.sa.base.common.controller;
import net.lab1024.sa.base.constant.SwaggerTagConst;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 支撑类业务路由基类
*

View File

@@ -2,6 +2,7 @@ package net.lab1024.sa.base.common.domain;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
@@ -15,7 +16,7 @@ import java.util.List;
*/
@Data
public class UserPermission {
public class UserPermission implements Serializable {
/**
* 权限列表

View File

@@ -1,18 +1,15 @@
package net.lab1024.sa.base.common.json.deserializer;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.base.module.support.dict.domain.vo.DictValueVO;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 字典反序列化
@@ -24,10 +21,10 @@ import java.util.stream.Collectors;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Slf4j
public class DictValueVoDeserializer extends JsonDeserializer<String> {
public class DictDataDeserializer extends JsonDeserializer<String> {
@Override
public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
List<String> list = new ArrayList<>();
ObjectCodec objectCodec = jsonParser.getCodec();
JsonNode listOrObjectNode = objectCodec.readTree(jsonParser);

View File

@@ -0,0 +1,52 @@
package net.lab1024.sa.base.config;
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.module.support.cache.CacheService;
import net.lab1024.sa.base.module.support.cache.CaffeineCacheServiceImpl;
import net.lab1024.sa.base.module.support.cache.RedisCacheServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.serializer.RedisSerializationContext;
/**
* 缓存配置
*
* @author zhoumingfa
* @date 2025/03/28
*/
@Configuration
public class CacheConfig {
private static final String REDIS_CACHE = "redis";
private static final String CAFFEINE_CACHE = "caffeine";
@Resource
private RedisConnectionFactory factory;
@Bean
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
public RedisCacheConfiguration redisCacheConfiguration() {
return RedisCacheConfiguration.defaultCacheConfig()
.disableCachingNullValues()
.computePrefixWith(name -> "cache:" + name + ":")
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericFastJsonRedisSerializer()));
}
@Bean
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
public CacheService redisCacheService() {
return new RedisCacheServiceImpl();
}
@Bean
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = CAFFEINE_CACHE)
public CacheService caffeineCacheService() {
return new CaffeineCacheServiceImpl();
}
}

View File

@@ -145,7 +145,7 @@ public class DataSourceConfig {
if (dataScopePlugin != null) {
pluginsList.add(dataScopePlugin);
}
factoryBean.setPlugins(pluginsList.toArray(new Interceptor[pluginsList.size()]));
factoryBean.setPlugins(pluginsList.toArray(new Interceptor[0]));
// 添加字段自动填充处理
factoryBean.setGlobalConfig(new GlobalConfig().setBanner(false).setMetaObjectHandler(new MybatisPlusFillHandler()));

View File

@@ -68,7 +68,7 @@ public class FileConfig implements WebMvcConfigurer {
* @return
*/
@Bean
@ConditionalOnProperty(prefix = "file.storage", name = {"mode"}, havingValue = "cloud")
@ConditionalOnProperty(prefix = "file.storage", name = {"mode"}, havingValue = MODE_CLOUD)
public AmazonS3 initAmazonS3() {
ClientConfiguration clientConfig = new ClientConfiguration();
clientConfig.setProtocol(Protocol.HTTPS);

View File

@@ -1,11 +1,13 @@
package net.lab1024.sa.base.config;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.common.constant.StringConst;
import net.lab1024.sa.base.common.util.SmartRequestUtil;
import net.lab1024.sa.base.module.support.repeatsubmit.RepeatSubmitAspect;
import net.lab1024.sa.base.module.support.repeatsubmit.ticket.RepeatSubmitCaffeineTicket;
import net.lab1024.sa.base.module.support.repeatsubmit.ticket.RepeatSubmitRedisTicket;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.ValueOperations;
/**
* 重复提交配置
@@ -19,9 +21,12 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class RepeatSubmitConfig {
@Resource
private ValueOperations<String, String> valueOperations;
@Bean
public RepeatSubmitAspect repeatSubmitAspect() {
RepeatSubmitCaffeineTicket caffeineTicket = new RepeatSubmitCaffeineTicket(this::ticket);
RepeatSubmitRedisTicket caffeineTicket = new RepeatSubmitRedisTicket(valueOperations, this::ticket);
return new RepeatSubmitAspect(caffeineTicket);
}

View File

@@ -11,4 +11,10 @@ package net.lab1024.sa.base.constant;
*/
public class CacheKeyConst {
public static class Dict {
public static final String DICT_DATA = "dict_data_cache";
}
}

View File

@@ -1,6 +1,6 @@
package net.lab1024.sa.base.module.support.apiencrypt.advice;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.base.common.util.SmartStringUtil;
@@ -37,6 +37,9 @@ public class DecryptRequestAdvice extends RequestBodyAdviceAdapter {
@Resource
private ApiEncryptService apiEncryptService;
@Resource
private ObjectMapper objectMapper;
@Override
public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) {
return methodParameter.hasMethodAnnotation(ApiDecrypt.class) || methodParameter.hasParameterAnnotation(ApiDecrypt.class) || methodParameter.getContainingClass().isAnnotationPresent(ApiDecrypt.class);
@@ -46,7 +49,7 @@ public class DecryptRequestAdvice extends RequestBodyAdviceAdapter {
public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) {
try {
String bodyStr = IOUtils.toString(inputMessage.getBody(), ENCODING);
ApiEncryptForm apiEncryptForm = JSONObject.parseObject(bodyStr, ApiEncryptForm.class);
ApiEncryptForm apiEncryptForm = objectMapper.readValue(bodyStr, ApiEncryptForm.class);
if (SmartStringUtil.isEmpty(apiEncryptForm.getEncryptData())) {
return inputMessage;
}

View File

@@ -30,7 +30,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
@Slf4j
@ControllerAdvice
public class EncryptResponseAdvice implements ResponseBodyAdvice<ResponseDTO> {
public class EncryptResponseAdvice implements ResponseBodyAdvice<ResponseDTO<Object>> {
@Resource
private ApiEncryptService apiEncryptService;
@@ -44,19 +44,18 @@ public class EncryptResponseAdvice implements ResponseBodyAdvice<ResponseDTO> {
}
@Override
public ResponseDTO beforeBodyWrite(ResponseDTO body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
if (body.getData() == null) {
public ResponseDTO<Object> beforeBodyWrite(ResponseDTO<Object> body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
if (body == null || body.getData() == null) {
return body;
}
String encrypt = null;
try {
encrypt = apiEncryptService.encrypt(objectMapper.writeValueAsString(body.getData()));
String encrypt = apiEncryptService.encrypt(objectMapper.writeValueAsString(body.getData()));
body.setData(encrypt);
body.setDataType(DataTypeEnum.ENCRYPT.getValue());
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
body.setData(encrypt);
body.setDataType(DataTypeEnum.ENCRYPT.getValue());
return body;
}
}

View File

@@ -1,20 +1,11 @@
package net.lab1024.sa.base.module.support.cache;
import com.google.common.collect.Lists;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.constant.ReloadConst;
import net.lab1024.sa.base.module.support.reload.core.annoation.SmartReload;
import org.springframework.cache.caffeine.CaffeineCache;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 缓存操作
* 缓存服务
*
* @Author 1024创新实验室: 罗伊
* @Date 2021/10/11 20:07
@@ -23,52 +14,21 @@ import java.util.stream.Collectors;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Service
public class CacheService {
@Resource
private CaffeineCacheManager caffeineCacheManager;
public interface CacheService {
/**
* 获取所有缓存名称
*
*/
public List<String> cacheNames() {
return Lists.newArrayList(caffeineCacheManager.getCacheNames());
}
List<String> cacheNames();
/**
* 某个缓存下的所有key
*
* 某个缓存下的所有 key
*/
public List<String> cacheKey(String cacheName) {
CaffeineCache cache = (CaffeineCache) caffeineCacheManager.getCache(cacheName);
if (cache == null) {
return Lists.newArrayList();
}
Set<Object> cacheKey = cache.getNativeCache().asMap().keySet();
return cacheKey.stream().map(e -> e.toString()).collect(Collectors.toList());
}
List<String> cacheKey(String cacheName);
/**
* 移除某个key
*
* 移除某个 key
*/
void removeCache(String cacheName);
public void removeCache(String cacheName) {
CaffeineCache cache = (CaffeineCache) caffeineCacheManager.getCache(cacheName);
if (cache != null) {
cache.clear();
}
}
@SmartReload(ReloadConst.CACHE_SERVICE)
public void clearAllCache() {
Collection<String> cacheNames = caffeineCacheManager.getCacheNames();
for (String name : cacheNames) {
CaffeineCache cache = (CaffeineCache) caffeineCacheManager.getCache(name);
if (cache != null) {
cache.clear();
}
}
}
}

View File

@@ -0,0 +1,71 @@
package net.lab1024.sa.base.module.support.cache;
import com.google.common.collect.Lists;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.constant.ReloadConst;
import net.lab1024.sa.base.module.support.reload.core.annoation.SmartReload;
import org.springframework.cache.caffeine.CaffeineCache;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* caffeine 缓存实现
*
* @Author 1024创新实验室: 罗伊
* @Date 2021/10/11 20:07
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
public class CaffeineCacheServiceImpl implements CacheService {
@Resource
private CaffeineCacheManager caffeineCacheManager;
/**
* 获取所有缓存名称
*/
@Override
public List<String> cacheNames() {
return Lists.newArrayList(caffeineCacheManager.getCacheNames());
}
/**
* 某个缓存下的所有 key
*/
@Override
public List<String> cacheKey(String cacheName) {
CaffeineCache cache = (CaffeineCache) caffeineCacheManager.getCache(cacheName);
if (cache == null) {
return Lists.newArrayList();
}
Set<Object> cacheKey = cache.getNativeCache().asMap().keySet();
return cacheKey.stream().map(e -> e.toString()).collect(Collectors.toList());
}
/**
* 移除某个 key
*/
@Override
public void removeCache(String cacheName) {
CaffeineCache cache = (CaffeineCache) caffeineCacheManager.getCache(cacheName);
if (cache != null) {
cache.clear();
}
}
@SmartReload(ReloadConst.CACHE_SERVICE)
public void clearAllCache() {
Collection<String> cacheNames = caffeineCacheManager.getCacheNames();
for (String name : cacheNames) {
CaffeineCache cache = (CaffeineCache) caffeineCacheManager.getCache(name);
if (cache != null) {
cache.clear();
}
}
}
}

View File

@@ -0,0 +1,86 @@
package net.lab1024.sa.base.module.support.cache;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.constant.ReloadConst;
import net.lab1024.sa.base.module.support.reload.core.annoation.SmartReload;
import org.springframework.data.redis.cache.RedisCache;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* redis 缓存实现
*
* @author zhoumingfa
* @date 2025/3/28
*/
public class RedisCacheServiceImpl implements CacheService {
@Resource
private RedisCacheManager redisCacheManager;
@Resource
private RedisConnectionFactory redisConnectionFactory;
/**
* 获取所有缓存名称
*/
@Override
public List<String> cacheNames() {
return Lists.newArrayList(redisCacheManager.getCacheNames());
}
/**
* 某个缓存下的所有 key
*/
@Override
public List<String> cacheKey(String cacheName) {
RedisCache cache = (RedisCache) redisCacheManager.getCache(cacheName);
if (cache == null) {
return Lists.newArrayList();
}
// 获取 Redis 连接
RedisConnection connection = redisConnectionFactory.getConnection();
// 根据指定的 key 模式获取所有匹配的键
Set<byte[]> keys = connection.keyCommands().keys((cacheName + ":*").getBytes());
if (keys != null) {
return keys.stream().map(key -> {
String redisKey = StrUtil.str(key, "utf-8");
// 从 Redis 键中提取出最后一个冒号后面的字符串作为真正的键
return redisKey.substring(redisKey.lastIndexOf(":") + 1);
}).collect(Collectors.toList());
}
connection.close();
return Lists.newArrayList(cacheName);
}
/**
* 移除某个 key
*/
@Override
public void removeCache(String cacheName) {
RedisCache cache = (RedisCache) redisCacheManager.getCache(cacheName);
if (cache != null) {
cache.clear();
}
}
@SmartReload(ReloadConst.CACHE_SERVICE)
public void clearAllCache() {
Collection<String> cacheNames = redisCacheManager.getCacheNames();
for (String name : cacheNames) {
RedisCache cache = (RedisCache) redisCacheManager.getCache(name);
if (cache != null) {
cache.clear();
}
}
}
}

View File

@@ -20,7 +20,6 @@ import org.springframework.stereotype.Component;
*/
@Mapper
@Component
public interface ChangeLogDao extends BaseMapper<ChangeLogEntity> {
/**

View File

@@ -28,7 +28,7 @@ public class ChangeLogEntity {
/**
* 版本
*/
private String version;
private String updateVersion;
/**
* 更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]

View File

@@ -23,7 +23,7 @@ public class ChangeLogAddForm {
@Schema(description = "版本", required = true)
@NotBlank(message = "版本 不能为空")
private String version;
private String updateVersion;
@SchemaEnum(value = ChangeLogTypeEnum.class, desc = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]")
@CheckEnum(value = ChangeLogTypeEnum.class, message = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复] 错误", required = true)

View File

@@ -27,7 +27,7 @@ public class ChangeLogUpdateForm {
@Schema(description = "版本", required = true)
@NotBlank(message = "版本 不能为空")
private String version;
private String updateVersion;
@SchemaEnum(value = ChangeLogTypeEnum.class, desc = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]")
@CheckEnum(value = ChangeLogTypeEnum.class, message = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复] 错误", required = true)

View File

@@ -23,7 +23,7 @@ public class ChangeLogVO {
private Long changeLogId;
@Schema(description = "版本")
private String version;
private String updateVersion;
@SchemaEnum(value = ChangeLogTypeEnum.class, desc = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]")
private Integer type;

View File

@@ -44,7 +44,7 @@ public class ChangeLogService {
* 添加
*/
public synchronized ResponseDTO<String> add(ChangeLogAddForm addForm) {
ChangeLogEntity existVersion = changeLogDao.selectByVersion(addForm.getVersion());
ChangeLogEntity existVersion = changeLogDao.selectByVersion(addForm.getUpdateVersion());
if (existVersion != null) {
return ResponseDTO.userErrorParam("此版本已经存在");
}
@@ -58,7 +58,7 @@ public class ChangeLogService {
* 更新
*/
public synchronized ResponseDTO<String> update(ChangeLogUpdateForm updateForm) {
ChangeLogEntity existVersion = changeLogDao.selectByVersion(updateForm.getVersion());
ChangeLogEntity existVersion = changeLogDao.selectByVersion(updateForm.getUpdateVersion());
if (existVersion != null && !updateForm.getChangeLogId().equals(existVersion.getChangeLogId())) {
return ResponseDTO.userErrorParam("此版本已经存在");
}

View File

@@ -11,16 +11,6 @@ package net.lab1024.sa.base.module.support.codegenerator.constant;
*/
public class CodeGeneratorConstant {
/**
* 主键
*/
public final static String PRIMARY_KEY = "PRI";
/**
* 自增
*/
public final static String AUTO_INCREMENT = "auto_increment";
/**
* 默认逻辑删除字段名称
*/

View File

@@ -14,7 +14,6 @@ import org.springframework.stereotype.Component;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface CodeGeneratorConfigDao extends BaseMapper<CodeGeneratorConfigEntity> {
}

View File

@@ -18,7 +18,6 @@ import java.util.List;
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Mapper
@Component
public interface CodeGeneratorDao {
/**

View File

@@ -23,20 +23,26 @@ public class TableColumnVO {
@Schema(description = "列描述")
private String columnComment;
@Schema(description = "columnKey")
private String columnKey;
@Schema(description = "extra")
private String extra;
@Schema(description = "是否为空")
private String isNullable;
@Schema(description = "数据类型varchar")
private String dataType;
@Schema(description = "列类型varchar(50)")
private String columnType;
@Schema(description = "是否为空")
private Boolean nullableFlag;
@Schema(description = "是否为主键")
private Boolean primaryKeyFlag;
@Schema(description = "是否递增")
private Boolean autoIncreaseFlag;
// --------------- 临时字段 -------------------
@Schema(hidden = true)
private String columnKey;
@Schema(hidden = true)
private String extra;
@Schema(hidden = true)
private String isNullable;
}

View File

@@ -25,12 +25,6 @@ public class TableVO {
@Schema(description = "表备注")
private String tableComment;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "更新时间")
private LocalDateTime updateTime;
@Schema(description = "配置时间")
private LocalDateTime configTime;

View File

@@ -40,6 +40,12 @@ import java.util.Optional;
@Service
public class CodeGeneratorService {
private static final String COLUMN_NULLABLE_IDENTIFY = "NO";
private static final String COLUMN_PRIMARY_KEY = "PRI";
private static final String COLUMN_AUTO_INCREASE = "auto_increment";
@Resource
private CodeGeneratorDao codeGeneratorDao;
@@ -57,7 +63,13 @@ public class CodeGeneratorService {
* @return
*/
public List<TableColumnVO> getTableColumns(String tableName) {
return codeGeneratorDao.selectTableColumn(tableName);
List<TableColumnVO> tableColumns = codeGeneratorDao.selectTableColumn(tableName);
for (TableColumnVO tableColumn : tableColumns) {
tableColumn.setNullableFlag(!COLUMN_NULLABLE_IDENTIFY.equalsIgnoreCase(tableColumn.getIsNullable()));
tableColumn.setPrimaryKeyFlag(COLUMN_PRIMARY_KEY.equalsIgnoreCase(tableColumn.getColumnKey()));
tableColumn.setAutoIncreaseFlag(SmartStringUtil.isNotEmpty(tableColumn.getExtra()) && COLUMN_AUTO_INCREASE.equalsIgnoreCase(tableColumn.getExtra()));
}
return tableColumns;
}
@@ -150,7 +162,7 @@ public class CodeGeneratorService {
}
// 校验表必须有主键
if(!tableColumns.stream().filter( e -> "PRI".equalsIgnoreCase(e.getColumnKey())).findAny().isPresent()){
if (tableColumns.stream().noneMatch(e -> COLUMN_PRIMARY_KEY.equalsIgnoreCase(e.getColumnKey()))) {
return ResponseDTO.userErrorParam("表必须有主键,请联系后端查看下数据库表结构");
}
@@ -199,6 +211,7 @@ public class CodeGeneratorService {
/**
* 下载代码
*
* @param tableName
* @return
*/

View File

@@ -33,7 +33,6 @@ import org.springframework.stereotype.Service;
import java.io.File;
import java.io.OutputStream;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
@@ -75,6 +74,11 @@ public class CodeGeneratorTemplateService {
map.put("js/const.js", new ConstVariableService());
map.put("js/list.vue", new ListVariableService());
map.put("js/form.vue", new FormVariableService());
// ts前端
map.put("ts/api.ts", new ApiVariableService());
map.put("ts/const.ts", new ConstVariableService());
map.put("ts/list.vue", new ListVariableService());
map.put("ts/form.vue", new FormVariableService());
}
public void zipGeneratedFiles(OutputStream outputStream, String tableName, CodeGeneratorConfigEntity codeGeneratorConfigEntity) {
@@ -159,7 +163,7 @@ public class CodeGeneratorTemplateService {
CodeDelete deleteInfo = JSON.parseObject(codeGeneratorConfigEntity.getDeleteInfo(), CodeDelete.class);
List<CodeQueryField> queryFields = JSONArray.parseArray(codeGeneratorConfigEntity.getQueryFields(), CodeQueryField.class);
List<CodeTableField> tableFields = JSONArray.parseArray(codeGeneratorConfigEntity.getTableFields(), CodeTableField.class);
tableFields.stream().forEach(e -> e.setWidth(e.getWidth() == null ? 0 : e.getWidth()));
tableFields.forEach(e -> e.setWidth(e.getWidth() == null ? 0 : e.getWidth()));
CodeGeneratorConfigForm form = CodeGeneratorConfigForm.builder().basic(basic).fields(fields).insertAndUpdate(insertAndUpdate).deleteInfo(deleteInfo).queryFields(queryFields).tableFields(tableFields).deleteInfo(deleteInfo).build();
form.setTableName(tableName);

View File

@@ -64,8 +64,7 @@ public abstract class CodeGenerateBaseVariableService {
return null;
}
return fields.stream().filter(e -> columnName.equals(e.getColumnName()))
.findFirst().get();
return fields.stream().filter(e -> SmartStringUtil.equals(columnName, e.getColumnName())).findFirst().orElse(null);
}
@@ -89,7 +88,7 @@ public abstract class CodeGenerateBaseVariableService {
}
CodeInsertAndUpdateField field = first.get();
return SmartStringUtil.equals(field.getFrontComponent(), CodeFrontComponentEnum.FILE_UPLOAD.getValue());
return CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(field.getFrontComponent());
}
/**
@@ -114,8 +113,7 @@ public abstract class CodeGenerateBaseVariableService {
return null;
}
Optional<CodeField> first = fields.stream().filter(e -> columnName.equals(e.getColumnName())).findFirst();
return first.orElse(null);
return fields.stream().filter(e -> columnName.equals(e.getColumnName())).findFirst().orElse(null);
}
/**

View File

@@ -103,9 +103,9 @@ public class AddFormVariableService extends CodeGenerateBaseVariableService {
//字典
if (SmartStringUtil.isNotEmpty(codeField.getDict())) {
finalFieldMap.put("dict", "\n @JsonDeserialize(using = DictValueVoDeserializer.class)");
finalFieldMap.put("dict", "\n @JsonDeserialize(using = DictDataDeserializer.class)");
packageList.add("import com.fasterxml.jackson.databind.annotation.JsonDeserialize;");
packageList.add("import net.lab1024.sa.base.common.json.deserializer.DictValueVoDeserializer;");
packageList.add("import net.lab1024.sa.base.common.json.deserializer.DictDataDeserializer;");
}
//文件上传

View File

@@ -3,12 +3,13 @@ package net.lab1024.sa.base.module.support.codegenerator.service.variable.backen
import cn.hutool.core.bean.BeanUtil;
import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum;
import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeInsertAndUpdateField;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeQueryField;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService;
import org.apache.commons.collections4.CollectionUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author 1024创新实验室-主任:卓大
@@ -39,7 +40,7 @@ public class MapperVariableService extends CodeGenerateBaseVariableService {
List<String> columnNameList = queryField.getColumnNameList();
if (columnNameList.size() == 1) {
// AND INSTR(t_notice.title,#{query.keywords})
stringBuilder.append(" AND INSTR(")
stringBuilder.append("AND INSTR(")
.append(form.getTableName()).append(".").append(queryField.getColumnNameList().get(0))
.append(",#{queryForm.")
.append(queryField.getFieldName())
@@ -47,7 +48,7 @@ public class MapperVariableService extends CodeGenerateBaseVariableService {
} else {
for (int i = 0; i < columnNameList.size(); i++) {
if (i == 0) {
stringBuilder.append("AND ( INSTR(")
stringBuilder.append("AND (\n INSTR(")
.append(form.getTableName()).append(".").append(queryField.getColumnNameList().get(i))
.append(",#{queryForm.")
.append(queryField.getFieldName())

Some files were not shown because too many files have changed in this diff Show More