Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
3db465e6
提交
3db465e6
authored
6月 07, 2022
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: postgres 适配、依赖升级、修复新增/更新权限没有写入 meta 字段问题
上级
cac2d7bb
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
122 行增加
和
70 行删除
+122
-70
build.gradle
app/build.gradle
+1
-1
application-dev-mysql.yml
app/src/main/resources/application-dev-mysql.yml
+0
-0
application-dev-postgresql.yml
app/src/main/resources/application-dev-postgresql.yml
+52
-0
application.yml
app/src/main/resources/application.yml
+1
-1
Permission.java
...in/java/com/yiring/auth/domain/permission/Permission.java
+1
-6
Role.java
...-auth/src/main/java/com/yiring/auth/domain/role/Role.java
+1
-1
User.java
...-auth/src/main/java/com/yiring/auth/domain/user/User.java
+7
-14
PermissionController.java
.../com/yiring/auth/web/permission/PermissionController.java
+3
-0
init-test-mysql.sql
basic-auth/src/main/resources/init-test-mysql.sql
+4
-4
init-test-postgresql.sql
basic-auth/src/main/resources/init-test-postgresql.sql
+0
-0
Minio.java
...mon/minio/src/main/java/com/yiring/common/core/Minio.java
+1
-1
build.gradle
build.gradle
+51
-42
没有找到文件。
app/build.gradle
浏览文件 @
3db465e6
...
...
@@ -13,7 +13,7 @@ dependencies {
runtimeOnly
'com.h2database:h2'
// 💬 Prod/Dev Env
runtimeOnly
'mysql:mysql-connector-java'
//
runtimeOnly 'org.postgresql:postgresql'
runtimeOnly
'org.postgresql:postgresql'
// 本地依赖
implementation
fileTree
(
dir:
project
.
rootDir
.
getPath
()
+
'\\libs'
,
includes:
[
'*jar'
])
...
...
app/src/main/resources/application-dev.yml
→
app/src/main/resources/application-dev
-mysql
.yml
浏览文件 @
3db465e6
File moved
app/src/main/resources/application-dev-postgresql.yml
0 → 100644
浏览文件 @
3db465e6
# 环境变量
env
:
host
:
192.168.0.156
spring
:
datasource
:
url
:
jdbc:postgresql://${env.host}:5432/basic_app
username
:
admin
password
:
123456
jpa
:
database-platform
:
org.hibernate.dialect.PostgreSQL10Dialect
open-in-view
:
true
hibernate
:
ddl-auto
:
update
show-sql
:
true
properties
:
hibernate
:
format_sql
:
true
redis
:
database
:
5
host
:
${env.host}
port
:
6379
password
:
123456
# Optional: MyBatis Plus
mybatis-plus
:
global-config
:
banner
:
false
# knife4j
knife4j
:
enable
:
true
basic
:
enable
:
false
username
:
admin
password
:
123456
setting
:
enableOpenApi
:
true
enableDebug
:
true
# minio
minio
:
access-key
:
minioadmin
secret-key
:
minioadmin
end-point
:
"
http://${env.host}:18100"
bucket
:
basic
domain
:
${minio.endpoint}/${minio.bucket}
logging
:
level
:
# sql bind parameter
org.hibernate.type.descriptor.sql.BasicBinder
:
trace
app/src/main/resources/application.yml
浏览文件 @
3db465e6
...
...
@@ -13,7 +13,7 @@ spring:
name
:
"
basic-api-app"
profiles
:
include
:
auth, conf-patch
active
:
beta
active
:
dev-postgresql
# DEBUG
debug
:
false
basic-auth/src/main/java/com/yiring/auth/domain/permission/Permission.java
浏览文件 @
3db465e6
...
...
@@ -33,12 +33,7 @@ import org.hibernate.annotations.TypeDef;
@TypeDef
(
name
=
"json"
,
typeClass
=
JsonType
.
class
)
@Table
(
name
=
"SYS_PERMISSION"
,
indexes
=
{
@Index
(
columnList
=
"type"
),
@Index
(
columnList
=
"pid"
),
@Index
(
columnList
=
"tree"
),
@Index
(
columnList
=
"uid"
,
unique
=
true
),
}
indexes
=
{
@Index
(
columnList
=
"type"
),
@Index
(
columnList
=
"pid"
),
@Index
(
columnList
=
"tree"
)
}
)
@Comment
(
"系统权限"
)
public
class
Permission
extends
BasicEntity
implements
Serializable
{
...
...
basic-auth/src/main/java/com/yiring/auth/domain/role/Role.java
浏览文件 @
3db465e6
...
...
@@ -40,7 +40,7 @@ public class Role extends BasicEntity implements Serializable {
private
static
final
long
serialVersionUID
=
910404402503275957L
;
@Comment
(
"标识"
)
@Column
(
unique
=
true
,
nullable
=
false
)
@Column
(
nullable
=
false
)
String
uid
;
@Comment
(
"名称"
)
...
...
basic-auth/src/main/java/com/yiring/auth/domain/user/User.java
浏览文件 @
3db465e6
...
...
@@ -15,6 +15,7 @@ import lombok.experimental.FieldDefaults;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Where
;
/**
* 用户
...
...
@@ -31,17 +32,9 @@ import org.hibernate.annotations.Comment;
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Where
(
clause
=
"deleted = false"
)
@Entity
@Table
(
name
=
"SYS_USER"
,
indexes
=
{
@Index
(
columnList
=
"mobile"
,
unique
=
true
),
@Index
(
columnList
=
"username"
,
unique
=
true
),
@Index
(
columnList
=
"email"
,
unique
=
true
),
@Index
(
columnList
=
"enabled"
),
@Index
(
columnList
=
"deleted"
),
}
)
@Table
(
name
=
"SYS_USER"
,
indexes
=
{
@Index
(
columnList
=
"enabled"
),
@Index
(
columnList
=
"deleted"
)
})
@Comment
(
"系统用户"
)
public
class
User
extends
BasicEntity
implements
Serializable
{
...
...
@@ -81,13 +74,13 @@ public class User extends BasicEntity implements Serializable {
@JsonIgnore
@Builder
.
Default
@Comment
(
"角色集合"
)
@ManyToMany
(
fetch
=
FetchType
.
EAGER
)
@ManyToMany
@JoinTable
(
name
=
"SYS_USER_ROLES"
,
joinColumns
=
{
@JoinColumn
(
name
=
"user_id"
)
}
,
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"role_id"
)
}
joinColumns
=
@JoinColumn
(
name
=
"user_id"
)
,
inverseJoinColumns
=
@JoinColumn
(
name
=
"role_id"
)
)
Set
<
Role
>
roles
=
new
HashSet
<>();
Set
<
Role
>
roles
=
new
HashSet
<>(
0
);
@Comment
(
"最后登录IP地址"
)
String
lastLoginIp
;
...
...
basic-auth/src/main/java/com/yiring/auth/web/permission/PermissionController.java
浏览文件 @
3db465e6
...
...
@@ -2,6 +2,7 @@
package
com
.
yiring
.
auth
.
web
.
permission
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
com.yiring.auth.domain.permission.Permission
;
import
com.yiring.auth.domain.permission.PermissionRepository
;
...
...
@@ -61,6 +62,7 @@ public class PermissionController {
Permission
entity
=
new
Permission
();
BeanUtils
.
copyProperties
(
param
,
entity
);
entity
.
setTree
(
getTreeNode
(
param
.
getPid
()));
entity
.
setMeta
(
JSON
.
parseObject
(
param
.
getMeta
()));
permissionRepository
.
saveAndFlush
(
entity
);
return
Result
.
ok
();
}
...
...
@@ -83,6 +85,7 @@ public class PermissionController {
BeanUtils
.
copyProperties
(
param
,
entity
);
entity
.
setTree
(
getTreeNode
(
param
.
getPid
()));
entity
.
setMeta
(
JSON
.
parseObject
(
param
.
getMeta
()));
permissionRepository
.
saveAndFlush
(
entity
);
return
Result
.
ok
();
}
...
...
basic-auth/src/main/resources/init-test-mysql.sql
浏览文件 @
3db465e6
...
...
@@ -49,10 +49,10 @@ CREATE TABLE `sys_permission` (
-- ----------------------------
-- Records of sys_permission
-- ----------------------------
INSERT
INTO
`sys_permission`
VALUES
(
'1515550180340928512'
,
'2022-04-17 12:38:15.212000'
,
'2022-04-17 12:38:15.212000'
,
'LAYOUT'
,
b
'1'
,
NULL
,
'ion:grid-outline'
,
'{
\"
title
\"
:
\"
routes.dashboard.dashboard
\"
,
\"
hideChildrenInMenu
\
"
: true}'
,
'Dashboard'
,
'/dashboard'
,
0
,
'/dashboard/workbench'
,
1
,
'0'
,
'MENU'
,
'Dashboard'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515627442394370048'
,
'2022-04-17 17:45:15.941000'
,
'2022-04-17 17:45:15.941000'
,
'/dashboard/workbench/index'
,
b
'1'
,
b
'1'
,
NULL
,
'{
\"
title
\"
:
\"
routes.dashboard.workbench
\"
,
\"
hideBreadcrumb
\"
: true,
\"
currentActiveMenu
\"
:
\"
/dashboard
\"
,
\"
hideChildrenInMenu
\
"
: true}'
,
'Workbench'
,
'workbench'
,
'1515550180340928512'
,
NULL
,
1
,
'0.1515550180340928512'
,
'MENU'
,
'Workbench'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515627944716800000'
,
'2022-04-17 17:47:15.683000'
,
'2022-04-17 17:47:15.683000'
,
'LAYOUT'
,
b
'1'
,
NULL
,
'simple-icons:about-dot-me'
,
'{
\"
title
\"
:
\"
routes.dashboard.about
\"
,
\"
hideChildrenInMenu
\
"
: true}'
,
'About'
,
'/about'
,
0
,
'/about/index'
,
100000
,
'0'
,
'MENU'
,
'About'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515628470086930432'
,
'2022-04-17 17:49:20.941000'
,
'2022-04-17 17:49:20.942000'
,
'/sys/about/index'
,
b
'1'
,
NULL
,
'simple-icons:about-dot-me'
,
'{
\"
title
\"
:
\"
routes.dashboard.about
\"
,
\"
hideMenu
\
"
: true}'
,
'AboutPage'
,
'index'
,
'1515627944716800000'
,
NULL
,
NULL
,
'0.1515627944716800000'
,
'MENU'
,
'AboutPage'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515550180340928512'
,
'2022-04-17 12:38:15.212000'
,
'2022-04-17 12:38:15.212000'
,
'LAYOUT'
,
b
'1'
,
NULL
,
'ion:grid-outline'
,
'{
"title": "routes.dashboard.dashboard", "hideChildrenInMenu
": true}'
,
'Dashboard'
,
'/dashboard'
,
0
,
'/dashboard/workbench'
,
1
,
'0'
,
'MENU'
,
'Dashboard'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515627442394370048'
,
'2022-04-17 17:45:15.941000'
,
'2022-04-17 17:45:15.941000'
,
'/dashboard/workbench/index'
,
b
'1'
,
b
'1'
,
NULL
,
'{
"title": "routes.dashboard.workbench", "hideBreadcrumb": true, "currentActiveMenu": "/dashboard", "hideChildrenInMenu
": true}'
,
'Workbench'
,
'workbench'
,
'1515550180340928512'
,
NULL
,
1
,
'0.1515550180340928512'
,
'MENU'
,
'Workbench'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515627944716800000'
,
'2022-04-17 17:47:15.683000'
,
'2022-04-17 17:47:15.683000'
,
'LAYOUT'
,
b
'1'
,
NULL
,
'simple-icons:about-dot-me'
,
'{
"title": "routes.dashboard.about", "hideChildrenInMenu
": true}'
,
'About'
,
'/about'
,
0
,
'/about/index'
,
100000
,
'0'
,
'MENU'
,
'About'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515628470086930432'
,
'2022-04-17 17:49:20.941000'
,
'2022-04-17 17:49:20.942000'
,
'/sys/about/index'
,
b
'1'
,
NULL
,
'simple-icons:about-dot-me'
,
'{
"title": "routes.dashboard.about", "hideMenu
": true}'
,
'AboutPage'
,
'index'
,
'1515627944716800000'
,
NULL
,
NULL
,
'0.1515627944716800000'
,
'MENU'
,
'AboutPage'
);
-- ----------------------------
-- Table structure for sys_role
...
...
basic-auth/src/main/resources/init-test-postgresql.sql
0 → 100644
浏览文件 @
3db465e6
差异被折叠。
点击展开。
basic-common/minio/src/main/java/com/yiring/common/core/Minio.java
浏览文件 @
3db465e6
...
...
@@ -167,7 +167,7 @@ public record Minio(MinioConfig config, MinioClient client) {
public
ObjectWriteResponse
putBusinessObject
(
Path
path
,
String
object
)
throws
Exception
{
UploadObjectArgs
args
=
UploadObjectArgs
.
builder
()
// 固定
的
储存桶位置
// 固定
地
储存桶位置
.
bucket
(
BUSINESS_BUCKET
)
.
filename
(
path
.
toString
())
.
object
(
object
)
...
...
build.gradle
浏览文件 @
3db465e6
buildscript
{
repositories
{
maven
{
url
"https://plugins.gradle.org/m2/"
}
}
ext
{
// https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-spring-boot-starter
knife4jVersion
=
'2.0.9'
// https://mvnrepository.com/artifact/io.swagger/swagger-annotations
swaggerAnnotationsVersion
=
'1.6.6'
// https://mvnrepository.com/artifact/cn.dev33/sa-token-spring-boot-starter
saTokenVersion
=
'1.29.1.trial'
// https://mvnrepository.com/artifact/cn.hutool/hutool-all
hutoolVersion
=
'5.8.0'
// https://mvnrepository.com/artifact/com.alibaba/fastjson
fastJsonVersion
=
'2.0.2'
// https://mvnrepository.com/artifact/com.xuxueli/xxl-job-core
xxlJobVersion
=
'2.3.0'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
okhttpVersion
=
'4.9.3'
// https://mvnrepository.com/artifact/io.minio/minio
minioVersion
=
'8.4.0'
// https://mvnrepository.com/artifact/com.vladmihalcea/hibernate-types-55
hibernateTypesVersion
=
'2.16.2'
// https://mvnrepository.com/artifact/org.hibernate/hibernate-spatial
hibernateSpatialVersion
=
'5.6.8.Final'
// https://mvnrepository.com/artifact/org.locationtech.jts/jts-core
jtsVersion
=
'1.18.2'
// https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter
mybatisPlusVersion
=
'3.5.1'
// https://mvnrepository.com/artifact/com.github.liaochong/myexcel
myexcelVersion
=
'4.2.0'
}
}
plugins
{
id
'java'
id
'org.springframework.boot'
version
'2.6.7'
// https://start.spring.io
id
'org.springframework.boot'
version
'2.6.8'
// https://plugins.gradle.org/plugin/io.spring.dependency-management
id
'io.spring.dependency-management'
version
'1.0.11.RELEASE'
// https://plugins.gradle.org/plugin/com.diffplug.spotless
id
"com.diffplug.spotless"
version
"6.
5.2
"
id
"com.diffplug.spotless"
version
"6.
7.0
"
// https://plugins.gradle.org/plugin/com.github.spotbugs
// id "com.github.spotbugs" version "5.0.6"
// id "com.github.spotbugs" version "5.0.7"
}
ext
{
// Spotless
// https://www.npmjs.com/package/prettier
prettierVersion
=
'2.6.2'
// https://www.npmjs.com/package/prettier-plugin-java
prettierJavaVersion
=
'1.6.2'
// https://start.spring.io/
springCloudVersion
=
'2021.0.3'
// https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-spring-boot-starter
knife4jVersion
=
'2.0.9'
// https://mvnrepository.com/artifact/io.swagger/swagger-annotations
swaggerAnnotationsVersion
=
'1.6.6'
// https://mvnrepository.com/artifact/cn.dev33/sa-token-spring-boot-starter
saTokenVersion
=
'1.30.0'
// https://mvnrepository.com/artifact/cn.hutool/hutool-all
hutoolVersion
=
'5.8.2'
// https://mvnrepository.com/artifact/com.alibaba/fastjson
fastJsonVersion
=
'2.0.6'
// https://mvnrepository.com/artifact/com.xuxueli/xxl-job-core
xxlJobVersion
=
'2.3.1'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
okhttpVersion
=
'4.9.3'
// https://mvnrepository.com/artifact/io.minio/minio
minioVersion
=
'8.4.1'
// https://mvnrepository.com/artifact/com.vladmihalcea/hibernate-types-55
hibernateTypesVersion
=
'2.16.2'
// https://mvnrepository.com/artifact/org.hibernate/hibernate-spatial
hibernateSpatialVersion
=
'5.6.9.Final'
// https://mvnrepository.com/artifact/org.locationtech.jts/jts-core
jtsVersion
=
'1.18.2'
// https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter
mybatisPlusVersion
=
'3.5.2'
// https://mvnrepository.com/artifact/com.github.liaochong/myexcel
myexcelVersion
=
'4.2.0'
}
allprojects
{
...
...
@@ -76,6 +81,12 @@ subprojects {
annotationProcessor
'org.springframework.boot:spring-boot-configuration-processor'
}
dependencyManagement
{
imports
{
mavenBom
"org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
[
compileJava
,
compileTestJava
,
javadoc
]*.
options
*.
encoding
=
'UTF-8'
tasks
.
withType
(
JavaCompile
)
{
...
...
@@ -86,7 +97,7 @@ subprojects {
enabled
=
false
}
t
est
{
t
asks
.
named
(
'test'
)
{
useJUnitPlatform
()
}
...
...
@@ -110,9 +121,7 @@ subprojects {
importOrder
()
removeUnusedImports
()
licenseHeader
'/* (C) $YEAR YiRing, Inc. */'
// https://www.npmjs.com/package/prettier
// https://www.npmjs.com/package/prettier-plugin-java
prettier
([
'prettier'
:
'2.6.2'
,
'prettier-plugin-java'
:
'1.6.1'
]).
config
([
prettier
([
'prettier'
:
prettierVersion
,
'prettier-plugin-java'
:
prettierJavaVersion
]).
config
([
'parser'
:
'java'
,
'tabWidth'
:
4
,
'printWidth'
:
120
,
...
...
@@ -123,6 +132,7 @@ subprojects {
}
task
hooks
()
{
// fix: CI/CD
try
{
// GitHook pre-commit (spotless, spotbugs)
def
hook
=
new
File
(
"$rootProject.projectDir/.git/hooks/pre-commit"
)
...
...
@@ -139,7 +149,6 @@ task hooks() {
gradle
.
getTaskGraph
().
whenReady
{
def
skipHooks
=
gradle
.
startParameter
.
getSystemPropertiesArgs
().
containsKey
(
'skip-hooks'
)
printf
(
"skip-hooks: %s"
,
skipHooks
)
if
(!
skipHooks
)
{
hooks
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论