Commit 29626cdd by 刘栋

更新代码

parent 6d04a535
......@@ -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;
}
......
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();
}
}
......@@ -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);
......
......@@ -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);
......
......@@ -59,7 +59,7 @@ public class FileStorageProperties {
/**
* 下载接口地址
*/
private String downloadUrl = "";
private String downloadUrl = "http://127.0.0.1/api/udi/oss/downloadFile";
/**
* 存储空间
*/
......
......@@ -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,解压即可;
---
## 创建索引
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment