Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
08e911f1
提交
08e911f1
authored
3月 03, 2023
作者:
方治民
浏览文件
操作
浏览文件
下载
差异文件
合并分支 '3.0' 到 'beta'
3.0 查看合并请求
!16
上级
b5325929
aae5a51d
流水线
#2013
已失败 于阶段
in 2 分 54 秒
变更
16
流水线
1
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
109 行增加
和
89 行删除
+109
-89
README.md
README.md
+7
-2
build.gradle
app/build.gradle
+1
-1
Application.java
app/src/main/java/com/yiring/app/Application.java
+2
-0
application-dev-postgresql.yml
app/src/main/resources/application-dev-postgresql.yml
+0
-2
InjectAuditorAware.java
.../main/java/com/yiring/auth/config/InjectAuditorAware.java
+39
-0
Permission.java
...in/java/com/yiring/auth/domain/permission/Permission.java
+2
-5
Role.java
...-auth/src/main/java/com/yiring/auth/domain/role/Role.java
+4
-6
User.java
...-auth/src/main/java/com/yiring/auth/domain/user/User.java
+7
-9
PermissionController.java
.../yiring/auth/web/sys/permission/PermissionController.java
+1
-0
RoleController.java
...ain/java/com/yiring/auth/web/sys/role/RoleController.java
+1
-0
EnvConfig.java
...ore/src/main/java/com/yiring/common/config/EnvConfig.java
+0
-23
BasicEntity.java
...e/src/main/java/com/yiring/common/domain/BasicEntity.java
+28
-14
Category.java
...c-dict/src/main/java/com/yiring/dict/domain/Category.java
+2
-5
Dict.java
basic-dict/src/main/java/com/yiring/dict/domain/Dict.java
+3
-7
DictItem.java
...c-dict/src/main/java/com/yiring/dict/domain/DictItem.java
+4
-7
build.gradle
build.gradle
+8
-8
没有找到文件。
README.md
浏览文件 @
08e911f1
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
## 开发环境
## 开发环境
<!-- prettier-ignore -->
<!-- prettier-ignore -->
-
JDK 17
[
版本管理工具
](
https://github.com/shyiko/jabba
)
-
JDK 17
[
版本管理工具
](
https://github.com/shyiko/jabba
)
-
NodeJS
[
下载
](
https://nodejs.org/zh-cn/
)
-
NodeJS
[
下载
](
https://nodejs.org/zh-cn/
)
-
IDEA
[
下载
](
https://www.jetbrains.com/idea/
)
-
IDEA
[
下载
](
https://www.jetbrains.com/idea/
)
...
@@ -14,6 +15,7 @@
...
@@ -14,6 +15,7 @@
## 开始
## 开始
<!-- prettier-ignore -->
<!-- prettier-ignore -->
-
[
开发规范说明
](
./doc/workflow.md
)
-
[
开发规范说明
](
./doc/workflow.md
)
-
[
技术栈说明
](
./doc/technique.md
)
-
[
技术栈说明
](
./doc/technique.md
)
-
👉
[
实用技巧
](
./doc/skill.md
)
-
👉
[
实用技巧
](
./doc/skill.md
)
...
@@ -23,10 +25,13 @@
...
@@ -23,10 +25,13 @@
## TODO
## TODO
<!-- prettier-ignore -->
<!-- prettier-ignore -->
-
[
x
]
完成项目构建,开发文档编写
-
[
x
]
完成项目构建,开发文档编写
-
[
x
]
[
conventional-changelog
]
(https://www.cnblogs.com/mengfangui/p/12634845.html)
-
[
x
]
[
conventional-changelog
]
(https://www.cnblogs.com/mengfangui/p/12634845.html)
-
[
x
]
用户及权限模块(目录/菜单/按钮),预览初始化权限配置
[
SQL 脚本
](
./basic-auth/src/main/resources/init-test-mysql.sql
)
-
[
x
]
用户及权限模块(目录/菜单/按钮),预览初始化权限配置
[
SQL 脚本
](
./basic-auth/src/main/resources/init-test-mysql.sql
)
-
[
x
]
通用文件上传模块,支持对图片/PDF/MP3/MP4 等文件进行预处理
-
[
x
]
WebSocket 模块
-
[
x
]
WebSocket 模块
-
[
]
通用字典管理模块
-
[
x
]
通用字典管理模块
-
[
x
]
通用文件上传模块,支持对图片/PDF/MP3/MP4 等文件进行预处理
-
[
]
大文件分片上传,扩展支持本地、MinIO、阿里云 OSS、腾讯云 COS 等
-
[
]
XXL-JOB 定时任务模块
-
[
]
XXL-JOB 定时任务模块
-
[
]
更合理的模块拆分,更好的模块解耦
app/build.gradle
浏览文件 @
08e911f1
...
@@ -18,7 +18,7 @@ dependencies {
...
@@ -18,7 +18,7 @@ dependencies {
// 💬 Mock/Test Env
// 💬 Mock/Test Env
runtimeOnly
'com.h2database:h2'
runtimeOnly
'com.h2database:h2'
// 💬 Prod/Dev Env
// 💬 Prod/Dev Env
runtimeOnly
'
mysql:mysql-connector-java
'
runtimeOnly
'
com.mysql:mysql-connector-j
'
runtimeOnly
'org.postgresql:postgresql'
runtimeOnly
'org.postgresql:postgresql'
// 本地依赖
// 本地依赖
...
...
app/src/main/java/com/yiring/app/Application.java
浏览文件 @
08e911f1
...
@@ -5,12 +5,14 @@ import org.springframework.boot.SpringApplication;
...
@@ -5,12 +5,14 @@ import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.domain.EntityScan
;
import
org.springframework.boot.autoconfigure.domain.EntityScan
;
import
org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters
;
import
org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
@EntityScan
(
@EntityScan
(
basePackageClasses
=
{
Application
.
class
,
Jsr310JpaConverters
.
class
},
basePackageClasses
=
{
Application
.
class
,
Jsr310JpaConverters
.
class
},
basePackages
=
Application
.
BASE_PACKAGES
basePackages
=
Application
.
BASE_PACKAGES
)
)
@EnableJpaAuditing
@EnableJpaRepositories
(
basePackages
=
Application
.
BASE_PACKAGES
)
@EnableJpaRepositories
(
basePackages
=
Application
.
BASE_PACKAGES
)
@SpringBootApplication
(
scanBasePackages
=
Application
.
BASE_PACKAGES
)
@SpringBootApplication
(
scanBasePackages
=
Application
.
BASE_PACKAGES
)
public
class
Application
{
public
class
Application
{
...
...
app/src/main/resources/application-dev-postgresql.yml
浏览文件 @
08e911f1
...
@@ -7,8 +7,6 @@ env:
...
@@ -7,8 +7,6 @@ env:
# username: admin
# username: admin
password
:
123456
password
:
123456
username
:
postgres
username
:
postgres
ffmpeg
:
path
:
D:\Environments\FFmpeg\bin
# ----------------------------------------------
# ----------------------------------------------
spring
:
spring
:
...
...
basic-auth/src/main/java/com/yiring/auth/config/InjectAuditorAware.java
0 → 100644
浏览文件 @
08e911f1
/* (C) 2023 YiRing, Inc. */
package
com
.
yiring
.
auth
.
config
;
import
cn.dev33.satoken.stp.StpUtil
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.auth.domain.user.UserRepository
;
import
java.util.Optional
;
import
lombok.NonNull
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Configurable
;
import
org.springframework.data.domain.AuditorAware
;
import
org.springframework.stereotype.Component
;
/**
* @author Jim
* @version 0.1
* 2023/3/3 11:43
*/
@Component
@Configurable
@RequiredArgsConstructor
public
class
InjectAuditorAware
implements
AuditorAware
<
String
>
{
final
UserRepository
userRepository
;
@Override
public
@NonNull
Optional
<
String
>
getCurrentAuditor
()
{
String
loginId
=
StpUtil
.
getLoginIdAsString
();
if
(
loginId
!=
null
)
{
Optional
<
User
>
optional
=
userRepository
.
findById
(
loginId
);
if
(
optional
.
isPresent
())
{
return
Optional
.
of
(
optional
.
get
().
getId
());
}
}
return
Optional
.
empty
();
}
}
basic-auth/src/main/java/com/yiring/auth/domain/permission/Permission.java
浏览文件 @
08e911f1
...
@@ -17,7 +17,6 @@ import lombok.experimental.SuperBuilder;
...
@@ -17,7 +17,6 @@ import lombok.experimental.SuperBuilder;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.Where
;
/**
/**
* 权限
* 权限
...
@@ -28,20 +27,18 @@ import org.hibernate.annotations.Where;
...
@@ -28,20 +27,18 @@ import org.hibernate.annotations.Where;
@Getter
@Getter
@Setter
@Setter
@EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@SQLDelete
(
sql
=
DELETE_SQL
)
@SQLDelete
(
sql
=
DELETE_SQL
+
BasicEntity
.
Where
.
WHERE_ID
)
@SQLDeleteAll
(
sql
=
DELETE_SQL
)
@SQLDeleteAll
(
sql
=
DELETE_SQL
)
@Where
(
clause
=
BasicEntity
.
Where
.
EXIST
)
@Entity
@Entity
@Table
(
@Table
(
name
=
TABLE_NAME
,
name
=
TABLE_NAME
,
indexes
=
{
indexes
=
{
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
Time
),
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
d
),
@Index
(
columnList
=
Permission
.
Fields
.
type
),
@Index
(
columnList
=
Permission
.
Fields
.
type
),
@Index
(
columnList
=
Permission
.
Fields
.
pid
),
@Index
(
columnList
=
Permission
.
Fields
.
pid
),
@Index
(
columnList
=
Permission
.
Fields
.
tree
),
@Index
(
columnList
=
Permission
.
Fields
.
tree
),
...
...
basic-auth/src/main/java/com/yiring/auth/domain/role/Role.java
浏览文件 @
08e911f1
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
auth
.
domain
.
role
;
package
com
.
yiring
.
auth
.
domain
.
role
;
import
static
com
.
yiring
.
auth
.
domain
.
role
.
Role
.
DELETE_SQL
;
import
static
com
.
yiring
.
auth
.
domain
.
role
.
Role
.
TABLE_NAME
;
import
static
com
.
yiring
.
auth
.
domain
.
role
.
Role
.
TABLE_NAME
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
@@ -31,20 +30,19 @@ import org.hibernate.annotations.Where;
...
@@ -31,20 +30,19 @@ import org.hibernate.annotations.Where;
@Getter
@Getter
@Setter
@Setter
@EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@SQLDelete
(
sql
=
DELETE_SQL
)
@SQLDelete
(
sql
=
Permission
.
DELETE_SQL
+
BasicEntity
.
Where
.
WHERE_ID
)
@SQLDeleteAll
(
sql
=
DELETE_SQL
)
@SQLDeleteAll
(
sql
=
Permission
.
DELETE_SQL
)
@Where
(
clause
=
BasicEntity
.
Where
.
EXIST
)
@Where
(
clause
=
BasicEntity
.
Where
.
EXIST
)
@Entity
@Entity
@Table
(
@Table
(
name
=
TABLE_NAME
,
name
=
TABLE_NAME
,
indexes
=
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
Time
),
indexes
=
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
d
),
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
Role
.
Fields
.
uid
,
BasicEntity
.
Fields
.
delete
Time
})
}
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
Role
.
Fields
.
uid
,
BasicEntity
.
Fields
.
delete
d
})
}
)
)
@Comment
(
"系统角色"
)
@Comment
(
"系统角色"
)
public
class
Role
extends
BasicEntity
implements
Serializable
{
public
class
Role
extends
BasicEntity
implements
Serializable
{
...
...
basic-auth/src/main/java/com/yiring/auth/domain/user/User.java
浏览文件 @
08e911f1
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
package
com
.
yiring
.
auth
.
domain
.
user
;
package
com
.
yiring
.
auth
.
domain
.
user
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.yiring.auth.domain.permission.Permission
;
import
com.yiring.auth.domain.role.Role
;
import
com.yiring.auth.domain.role.Role
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.domain.BasicEntity
;
import
jakarta.persistence.*
;
import
jakarta.persistence.*
;
...
@@ -17,7 +18,6 @@ import lombok.experimental.SuperBuilder;
...
@@ -17,7 +18,6 @@ import lombok.experimental.SuperBuilder;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.Where
;
/**
/**
* 用户
* 用户
...
@@ -28,23 +28,21 @@ import org.hibernate.annotations.Where;
...
@@ -28,23 +28,21 @@ import org.hibernate.annotations.Where;
@Getter
@Getter
@Setter
@Setter
@EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@SQLDelete
(
sql
=
User
.
DELETE_SQL
)
@SQLDelete
(
sql
=
Permission
.
DELETE_SQL
+
BasicEntity
.
Where
.
WHERE_ID
)
@SQLDeleteAll
(
sql
=
User
.
DELETE_SQL
)
@SQLDeleteAll
(
sql
=
Permission
.
DELETE_SQL
)
@Where
(
clause
=
User
.
Where
.
EXIST
)
@Entity
@Entity
@Table
(
@Table
(
name
=
User
.
TABLE_NAME
,
name
=
User
.
TABLE_NAME
,
indexes
=
{
@Index
(
columnList
=
User
.
Fields
.
enabled
),
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
Time
)
},
indexes
=
{
@Index
(
columnList
=
User
.
Fields
.
enabled
),
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
d
)
},
uniqueConstraints
=
{
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
User
.
Fields
.
username
,
BasicEntity
.
Fields
.
delete
Time
}),
@UniqueConstraint
(
columnNames
=
{
User
.
Fields
.
username
,
BasicEntity
.
Fields
.
delete
d
}),
@UniqueConstraint
(
columnNames
=
{
User
.
Fields
.
mobile
,
BasicEntity
.
Fields
.
delete
Time
}),
@UniqueConstraint
(
columnNames
=
{
User
.
Fields
.
mobile
,
BasicEntity
.
Fields
.
delete
d
}),
@UniqueConstraint
(
columnNames
=
{
User
.
Fields
.
email
,
BasicEntity
.
Fields
.
delete
Time
}),
@UniqueConstraint
(
columnNames
=
{
User
.
Fields
.
email
,
BasicEntity
.
Fields
.
delete
d
}),
}
}
)
)
@Comment
(
"系统用户"
)
@Comment
(
"系统用户"
)
...
...
basic-auth/src/main/java/com/yiring/auth/web/sys/permission/PermissionController.java
浏览文件 @
08e911f1
...
@@ -168,6 +168,7 @@ public class PermissionController {
...
@@ -168,6 +168,7 @@ public class PermissionController {
private
void
save
(
Permission
entity
,
PermissionParam
param
)
{
private
void
save
(
Permission
entity
,
PermissionParam
param
)
{
BeanUtils
.
copyProperties
(
param
,
entity
,
Permission
.
Fields
.
meta
);
BeanUtils
.
copyProperties
(
param
,
entity
,
Permission
.
Fields
.
meta
);
entity
.
setTree
(
getTreeNode
(
param
.
getPid
()));
entity
.
setTree
(
getTreeNode
(
param
.
getPid
()));
entity
.
setEnable
(
true
);
permissionRepository
.
saveAndFlush
(
entity
);
permissionRepository
.
saveAndFlush
(
entity
);
}
}
}
}
basic-auth/src/main/java/com/yiring/auth/web/sys/role/RoleController.java
浏览文件 @
08e911f1
...
@@ -65,6 +65,7 @@ public class RoleController {
...
@@ -65,6 +65,7 @@ public class RoleController {
}
}
Role
entity
=
new
Role
();
Role
entity
=
new
Role
();
entity
.
setEnable
(
true
);
BeanUtils
.
copyProperties
(
param
,
entity
);
BeanUtils
.
copyProperties
(
param
,
entity
);
roleRepository
.
saveAndFlush
(
entity
);
roleRepository
.
saveAndFlush
(
entity
);
return
Result
.
ok
();
return
Result
.
ok
();
...
...
basic-common/core/src/main/java/com/yiring/common/config/EnvConfig.java
浏览文件 @
08e911f1
...
@@ -37,34 +37,11 @@ public class EnvConfig implements Serializable {
...
@@ -37,34 +37,11 @@ public class EnvConfig implements Serializable {
boolean
prod
;
boolean
prod
;
/**
/**
* FFmpeg 配置
*/
FFmpeg
ffmpeg
;
/**
* 扩展配置
* 扩展配置
*/
*/
Extra
extra
;
Extra
extra
;
/**
/**
* FFmpeg 路径相关配置
*/
@Data
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Configuration
(
"env.config.ffmpeg"
)
@ConfigurationProperties
(
prefix
=
"env.ffmpeg"
)
public
static
class
FFmpeg
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
972365906869473179L
;
/**
* ffmpeg 路径
*/
String
path
;
}
/**
* 扩展环境配置变量
* 扩展环境配置变量
*/
*/
@Data
@Data
...
...
basic-common/core/src/main/java/com/yiring/common/domain/BasicEntity.java
浏览文件 @
08e911f1
...
@@ -2,16 +2,20 @@
...
@@ -2,16 +2,20 @@
package
com
.
yiring
.
common
.
domain
;
package
com
.
yiring
.
common
.
domain
;
import
com.yiring.common.snowflake.SnowflakeId
;
import
com.yiring.common.snowflake.SnowflakeId
;
import
jakarta.persistence.*
;
import
jakarta.persistence.EntityListeners
;
import
jakarta.persistence.GeneratedValue
;
import
jakarta.persistence.Id
;
import
jakarta.persistence.MappedSuperclass
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.SuperBuilder
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.*
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.springframework.data.annotation.CreatedBy
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
org.springframework.data.annotation.LastModifiedBy
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
/**
/**
...
@@ -27,11 +31,13 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...
@@ -27,11 +31,13 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@ToString
@ToString
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@SuperBuilder
(
toBuilder
=
true
)
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@
SuperBuilder
(
toBuilder
=
true
)
@
FilterDef
(
name
=
"deletedFilter"
,
parameters
=
@ParamDef
(
name
=
"isDeleted"
,
type
=
Boolean
.
class
)
)
@
MappedSuperclass
@
Filter
(
name
=
"deletedFilter"
,
condition
=
"deleted = :isDeleted"
)
@EntityListeners
(
AuditingEntityListener
.
class
)
@EntityListeners
(
AuditingEntityListener
.
class
)
@MappedSuperclass
public
abstract
class
BasicEntity
{
public
abstract
class
BasicEntity
{
@Comment
(
"主键"
)
@Comment
(
"主键"
)
...
@@ -40,22 +46,30 @@ public abstract class BasicEntity {
...
@@ -40,22 +46,30 @@ public abstract class BasicEntity {
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
STRING
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
STRING
)
String
id
;
String
id
;
@Comment
(
"创建人"
)
@CreatedBy
String
createBy
;
@Comment
(
"创建时间"
)
@Comment
(
"创建时间"
)
@Column
(
nullable
=
false
)
@CreatedDate
@CreationTimestamp
LocalDateTime
createTime
;
LocalDateTime
createTime
;
@Comment
(
"修改人"
)
@LastModifiedBy
String
updateBy
;
@Comment
(
"最后修改时间"
)
@Comment
(
"最后修改时间"
)
@Column
(
nullable
=
false
)
@LastModifiedDate
@UpdateTimestamp
LocalDateTime
updateTime
;
LocalDateTime
updateTime
;
@Comment
(
"删除时间"
)
@Comment
(
"删除时间"
)
LocalDateTime
deleteTime
;
Boolean
deleted
=
Boolean
.
FALSE
;
public
interface
Where
{
public
interface
Where
{
String
EXIST
=
" delete_time is null "
;
String
EXIST
=
" deleted = false "
;
String
DELETE_SET
=
" set deleted = true "
;
String
DELETE_SET
=
" set delete_time = now()
where id = ? "
;
String
WHERE_ID
=
"
where id = ? "
;
}
}
}
}
basic-dict/src/main/java/com/yiring/dict/domain/Category.java
浏览文件 @
08e911f1
...
@@ -18,7 +18,6 @@ import lombok.experimental.SuperBuilder;
...
@@ -18,7 +18,6 @@ import lombok.experimental.SuperBuilder;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.Where
;
/**
/**
* 分类字典
* 分类字典
...
@@ -30,20 +29,18 @@ import org.hibernate.annotations.Where;
...
@@ -30,20 +29,18 @@ import org.hibernate.annotations.Where;
@Getter
@Getter
@Setter
@Setter
@EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@SQLDelete
(
sql
=
DELETE_SQL
)
@SQLDelete
(
sql
=
DELETE_SQL
+
BasicEntity
.
Where
.
WHERE_ID
)
@SQLDeleteAll
(
sql
=
DELETE_SQL
)
@SQLDeleteAll
(
sql
=
DELETE_SQL
)
@Where
(
clause
=
BasicEntity
.
Where
.
EXIST
)
@Entity
@Entity
@Table
(
@Table
(
name
=
TABLE_NAME
,
name
=
TABLE_NAME
,
indexes
=
{
indexes
=
{
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
Time
),
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
d
),
@Index
(
columnList
=
Category
.
Fields
.
name
),
@Index
(
columnList
=
Category
.
Fields
.
name
),
@Index
(
columnList
=
Category
.
Fields
.
code
),
@Index
(
columnList
=
Category
.
Fields
.
code
),
}
}
...
...
basic-dict/src/main/java/com/yiring/dict/domain/Dict.java
浏览文件 @
08e911f1
/* (C) 2023 YiRing, Inc. */
/* (C) 2023 YiRing, Inc. */
package
com
.
yiring
.
dict
.
domain
;
package
com
.
yiring
.
dict
.
domain
;
import
static
com
.
yiring
.
dict
.
domain
.
Dict
.
DELETE_SQL
;
import
static
com
.
yiring
.
dict
.
domain
.
Dict
.
TABLE_NAME
;
import
static
com
.
yiring
.
dict
.
domain
.
Dict
.
TABLE_NAME
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
...
@@ -18,7 +17,6 @@ import lombok.experimental.SuperBuilder;
...
@@ -18,7 +17,6 @@ import lombok.experimental.SuperBuilder;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.Where
;
/**
/**
* 字典
* 字典
...
@@ -30,20 +28,18 @@ import org.hibernate.annotations.Where;
...
@@ -30,20 +28,18 @@ import org.hibernate.annotations.Where;
@Getter
@Getter
@Setter
@Setter
@EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@SQLDelete
(
sql
=
DELETE_SQL
)
@SQLDelete
(
sql
=
Category
.
DELETE_SQL
+
BasicEntity
.
Where
.
WHERE_ID
)
@SQLDeleteAll
(
sql
=
DELETE_SQL
)
@SQLDeleteAll
(
sql
=
Category
.
DELETE_SQL
)
@Where
(
clause
=
BasicEntity
.
Where
.
EXIST
)
@Entity
@Entity
@Table
(
@Table
(
name
=
TABLE_NAME
,
name
=
TABLE_NAME
,
indexes
=
{
indexes
=
{
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
Time
),
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
d
),
@Index
(
columnList
=
Dict
.
Fields
.
name
),
@Index
(
columnList
=
Dict
.
Fields
.
name
),
@Index
(
columnList
=
Dict
.
Fields
.
code
),
@Index
(
columnList
=
Dict
.
Fields
.
code
),
}
}
...
...
basic-dict/src/main/java/com/yiring/dict/domain/DictItem.java
浏览文件 @
08e911f1
/* (C) 2023 YiRing, Inc. */
/* (C) 2023 YiRing, Inc. */
package
com
.
yiring
.
dict
.
domain
;
package
com
.
yiring
.
dict
.
domain
;
import
static
com
.
yiring
.
dict
.
domain
.
DictItem
.
DELETE_SQL
;
import
static
com
.
yiring
.
common
.
domain
.
BasicEntity
.
Where
.
WHERE_ID
;
import
static
com
.
yiring
.
dict
.
domain
.
DictItem
.
TABLE_NAME
;
import
static
com
.
yiring
.
dict
.
domain
.
DictItem
.
TABLE_NAME
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.domain.BasicEntity
;
...
@@ -15,7 +15,6 @@ import lombok.experimental.SuperBuilder;
...
@@ -15,7 +15,6 @@ import lombok.experimental.SuperBuilder;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.SQLDeleteAll
;
import
org.hibernate.annotations.Where
;
/**
/**
* 字典选项
* 字典选项
...
@@ -27,20 +26,18 @@ import org.hibernate.annotations.Where;
...
@@ -27,20 +26,18 @@ import org.hibernate.annotations.Where;
@Getter
@Getter
@Setter
@Setter
@EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@SQLDelete
(
sql
=
DELETE_SQL
)
@SQLDelete
(
sql
=
Category
.
DELETE_SQL
+
WHERE_ID
)
@SQLDeleteAll
(
sql
=
DELETE_SQL
)
@SQLDeleteAll
(
sql
=
Category
.
DELETE_SQL
)
@Where
(
clause
=
BasicEntity
.
Where
.
EXIST
)
@Entity
@Entity
@Table
(
@Table
(
name
=
TABLE_NAME
,
name
=
TABLE_NAME
,
indexes
=
{
indexes
=
{
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
Time
),
@Index
(
columnList
=
BasicEntity
.
Fields
.
delete
d
),
@Index
(
columnList
=
DictItem
.
Fields
.
name
),
@Index
(
columnList
=
DictItem
.
Fields
.
name
),
@Index
(
columnList
=
DictItem
.
Fields
.
enable
),
@Index
(
columnList
=
DictItem
.
Fields
.
enable
),
}
}
...
...
build.gradle
浏览文件 @
08e911f1
plugins
{
plugins
{
id
'java'
id
'java'
// https://start.spring.io
// https://start.spring.io
id
'org.springframework.boot'
version
'3.0.
2
'
id
'org.springframework.boot'
version
'3.0.
3
'
id
'org.graalvm.buildtools.native'
version
'0.9.18'
id
'org.graalvm.buildtools.native'
version
'0.9.18'
// https://plugins.gradle.org/plugin/io.spring.dependency-management
// https://plugins.gradle.org/plugin/io.spring.dependency-management
id
'io.spring.dependency-management'
version
'1.1.0'
id
'io.spring.dependency-management'
version
'1.1.0'
// https://plugins.gradle.org/plugin/com.diffplug.spotless
// https://plugins.gradle.org/plugin/com.diffplug.spotless
id
"com.diffplug.spotless"
version
"6.1
3
.0"
id
"com.diffplug.spotless"
version
"6.1
5
.0"
}
}
ext
{
ext
{
// Spotless
// Spotless
// https://www.npmjs.com/package/prettier
// https://www.npmjs.com/package/prettier
prettierVersion
=
'2.8.
3
'
prettierVersion
=
'2.8.
4
'
// https://www.npmjs.com/package/prettier-plugin-java
// https://www.npmjs.com/package/prettier-plugin-java
prettierJavaVersion
=
'2.0.0'
prettierJavaVersion
=
'2.0.0'
// SpringCloud
// SpringCloud
// https://start.spring.io/
// https://start.spring.io/
springCloudVersion
=
'2022.0.1'
springCloudVersion
=
'2022.0.1'
//
SpringBootAdmi
n
//
springBootAdminVersio
n
springBootAdminVersion
=
'3.0.0'
springBootAdminVersion
=
'3.0.0'
// Dependencies
// Dependencies
//
//
https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-openapi3-jakarta-spring-boot-starter
// https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-openapi3-jakarta-spring-boot-starter
knife4jOpen3Version
=
'4.0.0'
knife4jOpen3Version
=
'4.0.0'
// https://mvnrepository.com/artifact/io.swagger/swagger-annotations
// https://mvnrepository.com/artifact/io.swagger/swagger-annotations
swaggerAnnotationsVersion
=
'1.6.9'
swaggerAnnotationsVersion
=
'1.6.9'
...
@@ -32,15 +32,15 @@ ext {
...
@@ -32,15 +32,15 @@ ext {
// https://mvnrepository.com/artifact/cn.hutool/hutool-all
// https://mvnrepository.com/artifact/cn.hutool/hutool-all
hutoolVersion
=
'5.8.12'
hutoolVersion
=
'5.8.12'
// https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2
// https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2
fastJsonVersion
=
'2.0.2
3
'
fastJsonVersion
=
'2.0.2
4
'
// https://mvnrepository.com/artifact/com.xuxueli/xxl-job-core
// https://mvnrepository.com/artifact/com.xuxueli/xxl-job-core
xxlJobVersion
=
'2.3.1'
xxlJobVersion
=
'2.3.1'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
okhttpVersion
=
'4.10.0'
okhttpVersion
=
'4.10.0'
// https://mvnrepository.com/artifact/io.minio/minio
// https://mvnrepository.com/artifact/io.minio/minio
minioVersion
=
'8.5.
1
'
minioVersion
=
'8.5.
2
'
// https://mvnrepository.com/artifact/io.hypersistence/hypersistence-utils-hibernate-60
// https://mvnrepository.com/artifact/io.hypersistence/hypersistence-utils-hibernate-60
hibernateTypesVersion
=
'3.
1.2
'
hibernateTypesVersion
=
'3.
2.0
'
// https://mvnrepository.com/artifact/org.hibernate/hibernate-spatial
// https://mvnrepository.com/artifact/org.hibernate/hibernate-spatial
hibernateSpatialVersion
=
'6.1.7.Final'
hibernateSpatialVersion
=
'6.1.7.Final'
// https://mvnrepository.com/artifact/org.locationtech.jts/jts-core
// https://mvnrepository.com/artifact/org.locationtech.jts/jts-core
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论