mirror of https://github.com/elunez/eladmin
代码生成器优化,配置更方便
parent
e471a9dafd
commit
e775de19bf
|
@ -5,6 +5,8 @@ import me.zhengjie.repository.GenConfigRepository;
|
|||
import me.zhengjie.service.GenConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
|
@ -30,6 +32,22 @@ public class GenConfigServiceImpl implements GenConfigService {
|
|||
@Override
|
||||
public GenConfig update(GenConfig genConfig) {
|
||||
genConfig.setId(1L);
|
||||
// 自动设置Api路径,注释掉前需要同步取消前端的注释
|
||||
String separator = File.separator;
|
||||
String[] paths = null;
|
||||
if (separator.equals("\\")) {
|
||||
paths = genConfig.getPath().split("\\\\");
|
||||
} else paths = genConfig.getPath().split(File.separator);
|
||||
StringBuffer api = new StringBuffer();
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
api.append(paths[i]);
|
||||
api.append(separator);
|
||||
if(paths[i].equals("src")){
|
||||
api.append("api");
|
||||
break;
|
||||
}
|
||||
}
|
||||
genConfig.setApiPath(api.toString());
|
||||
return genConfigRepository.save(genConfig);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ spring:
|
|||
jwt:
|
||||
header: Authorization
|
||||
secret: mySecret
|
||||
# token 过期时间 2个小时
|
||||
expiration: 7200000
|
||||
# token 过期时间 6个小时
|
||||
expiration: 21000000
|
||||
auth:
|
||||
# 授权路径
|
||||
path: /login
|
||||
|
|
Loading…
Reference in New Issue