Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
刘栋
/
infynova-udi
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
29626cdd
authored
Apr 07, 2025
by
刘栋
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新代码
parent
6d04a535
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
15 deletions
saas-udi-service/src/main/java/com/infynova/udi/config/mybatis/CustomTenantHandler.java
saas-udi-service/src/main/java/com/infynova/udi/config/mybatis/MybatisPlusConfig.java
saas-udi-service/src/main/java/com/infynova/udi/controller/OSSController.java
saas-udi-service/src/main/java/com/infynova/udi/filter/IdentityFilter.java
saas-udi-service/src/main/java/com/infynova/udi/manager/storage/config/FileStorageProperties.java
saas-udi-service/src/main/java/com/infynova/udi/service/helper/UdiDataMigrator.java
saas-udi-service/src/main/resources/es.md
saas-udi-service/src/main/java/com/infynova/udi/config/mybatis/CustomTenantHandler.java
View file @
29626cdd
...
...
@@ -13,6 +13,8 @@ import net.sf.jsqlparser.expression.LongValue;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
java.util.Objects
;
@Component
public
class
CustomTenantHandler
implements
TenantLineHandler
{
...
...
@@ -21,6 +23,9 @@ public class CustomTenantHandler implements TenantLineHandler {
// 假设有一个租户上下文,能够从中获取当前用户的租户
Long
identityId
=
SpringContextUtils
.
getIdentityId
();
// 返回租户ID的表达式
if
(
Objects
.
isNull
(
identityId
)){
return
new
LongValue
(
0
);
}
return
new
LongValue
(
identityId
);
}
...
...
@@ -38,6 +43,9 @@ public class CustomTenantHandler implements TenantLineHandler {
if
(
StringUtils
.
equals
(
"udi_user"
,
tableName
)){
return
true
;
}
if
(
StringUtils
.
equals
(
"sys_file"
,
tableName
)){
return
true
;
}
return
false
;
}
...
...
saas-udi-service/src/main/java/com/infynova/udi/config/mybatis/MybatisPlusConfig.java
View file @
29626cdd
package
com
.
infynova
.
udi
.
config
.
mybatis
;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.core.injector.AbstractMethod
;
import
com.baomidou.mybatisplus.core.injector.DefaultSqlInjector
;
import
com.baomidou.mybatisplus.core.injector.ISqlInjector
;
...
...
@@ -41,16 +42,19 @@ public class MybatisPlusConfig {
return
interceptor
;
}
// @Bean
// public ISqlInjector sqlInjector() {
// return new DefaultSqlInjector() {
// @Override
// public List<AbstractMethod> getMethodList(org.apache.ibatis.session.Configuration configuration, Class<?> mapperClass, TableInfo tableInfo) {
// List<AbstractMethod> methodList = super.getMethodList(configuration,mapperClass,tableInfo);
// methodList.add(new InsertBatchSomeColumn());
// methodList.add(new AlwaysUpdateSomeColumnById());
// return methodList;
// }
// };
// }
public
class
MySqlInjector
extends
DefaultSqlInjector
{
@Override
public
List
<
AbstractMethod
>
getMethodList
(
Class
<?>
mapperClass
,
TableInfo
tableInfo
)
{
List
<
AbstractMethod
>
methodList
=
super
.
getMethodList
(
mapperClass
,
tableInfo
);
// 添加 InsertBatchSomeColumn 方法,跳过 FieldFill.UPDATE 或 FieldFill.DEFAULT 的字段
methodList
.
add
(
new
InsertBatchSomeColumn
(
column
->
column
.
getFieldFill
()
!=
FieldFill
.
UPDATE
));
return
methodList
;
}
}
@Bean
public
MySqlInjector
sqlInjector
()
{
return
new
MySqlInjector
();
}
}
saas-udi-service/src/main/java/com/infynova/udi/controller/OSSController.java
View file @
29626cdd
...
...
@@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletResponse;
@Slf4j
@RestController
@RequestMapping
(
"oss"
)
@RequestMapping
(
"
/
oss"
)
@Api
(
tags
=
"图片上传"
)
public
class
OSSController
{
...
...
@@ -28,7 +28,7 @@ public class OSSController {
private
LocalFileStorage
localFileStorage
;
@ApiOperation
(
value
=
"下载文件"
)
@GetMapping
(
value
=
"downloadFile"
)
@GetMapping
(
value
=
"
/
downloadFile"
)
@SneakyThrows
public
void
downloadFile
(
@RequestParam
(
"fileId"
)
Long
fileId
,
HttpServletResponse
response
)
{
SysFile
sysFile
=
sysFileService
.
getById
(
fileId
);
...
...
saas-udi-service/src/main/java/com/infynova/udi/filter/IdentityFilter.java
View file @
29626cdd
...
...
@@ -73,6 +73,8 @@ public class IdentityFilter implements Filter {
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
Set
<
String
>
configPathList
=
new
HashSet
<>();
configPathList
.
add
(
"/udi/user/token"
);
configPathList
.
add
(
"/udi/match/task/template"
);
configPathList
.
add
(
"/udi/oss/downloadFile"
);
if
(!
checkPath
(
httpRequest
.
getRequestURI
(),
configPathList
))
{
if
(
StrUtil
.
isBlank
(
token
))
{
throw
new
SaasException
(
CommonExceptionCode
.
JWT_ILLEGAL_ARGUMENT
);
...
...
saas-udi-service/src/main/java/com/infynova/udi/manager/storage/config/FileStorageProperties.java
View file @
29626cdd
...
...
@@ -59,7 +59,7 @@ public class FileStorageProperties {
/**
* 下载接口地址
*/
private
String
downloadUrl
=
""
;
private
String
downloadUrl
=
"
http://127.0.0.1/api/udi/oss/downloadFile
"
;
/**
* 存储空间
*/
...
...
saas-udi-service/src/main/java/com/infynova/udi/service/helper/UdiDataMigrator.java
0 → 100644
View file @
29626cdd
This diff is collapsed.
Click to expand it.
saas-udi-service/src/main/resources/es.md
View file @
29626cdd
...
...
@@ -30,6 +30,7 @@ docker创建服务需要注意网关设置
docker run -d --name es -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -e "discovery.type=single-node" --privileged --net esnet -p 9200:9200 -p 9300:9300 elasticsearch:7.12.1
docker run -d --name kibana -e ELASTICSEARCH_HOSTS=http://es:9200 --net esnet -p 5601:5601 kibana:7.12.1
```
## Linux创建注意
...
...
@@ -46,6 +47,9 @@ curl 127.0.0.1:9200
linux安装要确认好是否提供外部服务
---
ik分词安装注意事项
与es版本对齐,在对应的文件夹plugins创建ik文件夹,然后上传zip,解压即可;
---
## 创建索引
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment