代码生成器优化,配置更方便

pull/127/head
dqjdda 2019-08-22 20:15:28 +08:00
parent e471a9dafd
commit e775de19bf
2 changed files with 20 additions and 2 deletions

View File

@ -5,6 +5,8 @@ import me.zhengjie.repository.GenConfigRepository;
import me.zhengjie.service.GenConfigService; import me.zhengjie.service.GenConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
import java.util.Optional; import java.util.Optional;
/** /**
@ -30,6 +32,22 @@ public class GenConfigServiceImpl implements GenConfigService {
@Override @Override
public GenConfig update(GenConfig genConfig) { public GenConfig update(GenConfig genConfig) {
genConfig.setId(1L); 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); return genConfigRepository.save(genConfig);
} }
} }

View File

@ -45,8 +45,8 @@ spring:
jwt: jwt:
header: Authorization header: Authorization
secret: mySecret secret: mySecret
# token 过期时间 2个小时 # token 过期时间 6个小时
expiration: 7200000 expiration: 21000000
auth: auth:
# 授权路径 # 授权路径
path: /login path: /login