mirror of https://github.com/elunez/eladmin
优化badsmell:包括空指针以及多次使用变量的提取
parent
7d68d58bbd
commit
4a3a564298
|
@ -59,6 +59,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||
|
||||
private final ColumnInfoRepository columnInfoRepository;
|
||||
|
||||
private final String CONFIG_MESSAGE = "请先配置生成器";
|
||||
@Override
|
||||
public Object getTables() {
|
||||
// 使用预编译防止sql注入
|
||||
|
@ -169,7 +170,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||
@Override
|
||||
public void generator(GenConfig genConfig, List<ColumnInfo> columns) {
|
||||
if (genConfig.getId() == null) {
|
||||
throw new BadRequestException("请先配置生成器");
|
||||
throw new BadRequestException(CONFIG_MESSAGE);
|
||||
}
|
||||
try {
|
||||
GenUtil.generatorCode(columns, genConfig);
|
||||
|
@ -182,7 +183,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||
@Override
|
||||
public ResponseEntity<Object> preview(GenConfig genConfig, List<ColumnInfo> columns) {
|
||||
if (genConfig.getId() == null) {
|
||||
throw new BadRequestException("请先配置生成器");
|
||||
throw new BadRequestException(CONFIG_MESSAGE);
|
||||
}
|
||||
List<Map<String, Object>> genList = GenUtil.preview(columns, genConfig);
|
||||
return new ResponseEntity<>(genList, HttpStatus.OK);
|
||||
|
@ -191,7 +192,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||
@Override
|
||||
public void download(GenConfig genConfig, List<ColumnInfo> columns, HttpServletRequest request, HttpServletResponse response) {
|
||||
if (genConfig.getId() == null) {
|
||||
throw new BadRequestException("请先配置生成器");
|
||||
throw new BadRequestException(CONFIG_MESSAGE);
|
||||
}
|
||||
try {
|
||||
File file = new File(GenUtil.download(columns, genConfig));
|
||||
|
|
|
@ -114,7 +114,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
throw new EntityExistException(Menu.class,"componentName",resources.getComponentName());
|
||||
}
|
||||
}
|
||||
if(resources.getPid().equals(0L)){
|
||||
if (Long.valueOf(0L).equals(resources.getPid())) {
|
||||
resources.setPid(null);
|
||||
}
|
||||
if(resources.getIFrame()){
|
||||
|
|
Loading…
Reference in New Issue