Compare commits

..

No commits in common. '84f2b601c1279801e7308d1b622d629cbf96f417' and 'ed181a656e7656b0564d12c1597512baaa00b083' have entirely different histories.

  1. 47
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java

@ -387,19 +387,6 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("对应模块填写不能为空"); return Result.error("对应模块填写不能为空");
} }
//判断实体是否已存在
LambdaQueryWrapper<Tablex> query = new LambdaQueryWrapper<>();
query.eq(Tablex::getModuleId,voList.get(i).getModuleId());
Tablex tablex1 = tablexService.getOne(query);
if (tablex1 != null){
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的实体已存在");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的实体已存在");
}
LambdaQueryWrapper<Modulex> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Modulex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Modulex::getId, moduleId); queryWrapper.eq(Modulex::getId, moduleId);
Modulex modulex = modulexService.getOne(queryWrapper); Modulex modulex = modulexService.getOne(queryWrapper);
@ -420,7 +407,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
//判断版本状态 //判断版本状态
//int verisonStatusInt = verisonStatus.equals("当前") ? 1 : verisonStatus.equals("历史") ? 0 : 3; //int verisonStatusInt = verisonStatus.equals("当前") ? 1 : verisonStatus.equals("历史") ? 0 : 3;
//判断版本号 //判断版本号,若实体已存在,查找最大的版本号并且版本号+1
if(voList.get(i).getVerison() == null || voList.get(i).getVerison().equals("")){ if(voList.get(i).getVerison() == null || voList.get(i).getVerison().equals("")){
message.put("isError", "true"); message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的版本号填写不能为空!"); message.put("status","导入失败,第" + (i + 1) + "条的版本号填写不能为空!");
@ -428,16 +415,30 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的版本号填写不能为空!"); return Result.error("导入失败,第" + (i + 1) + "条的版本号填写不能为空!");
} }
LambdaQueryWrapper<Tablex> query = new LambdaQueryWrapper<>();
//判断版本号是否为正整数且长度不能大于5 query.eq(Tablex::getTableName,voList.get(i).getTableName());
if (!voList.get(i).getVerison().matches("^[0-9]*[1-9][0-9]*$") || voList.get(i).getVerison().length() > 5){ List<Tablex> verisonList = tablexService.list(query);
message.put("isError", "true"); if (verisonList != null){
message.put("status","导入失败,第" + (i + 1) + "条的版本状态填写错误!"); int version = 0;
message.put("closeable","true"); for(Tablex verisonMax : verisonList){
webSocketUtils.sendMessage(loginUser.getId(), message); if(verisonMax.getVerison() > version){
return Result.error("导入失败,第" + (i + 1) + "条的版本状态填写错误!"); version = verisonMax.getVerison();
}
}
int v = version + 1;
tablex.setVerison(v);
}else {
//判断版本号是否为正整数且长度不能大于5
if (!voList.get(i).getVerison().matches("^[0-9]*[1-9][0-9]*$") && voList.get(i).getVerison().length() > 5){
message.put("isError", "true");
message.put("status","导入失败,第" + (i + 1) + "条的版本状态填写错误!");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,第" + (i + 1) + "条的版本状态填写错误!");
}
tablex.setVerison(Integer.valueOf(voList.get(i).getVerison()));
} }
tablex.setVerison(Integer.valueOf(voList.get(i).getVerison()));
//判断对应模块 //判断对应模块
if (modulexId != null && voList.get(i).getModuleId() != null && !voList.get(i).getModuleId().equals("")) { if (modulexId != null && voList.get(i).getModuleId() != null && !voList.get(i).getModuleId().equals("")) {
//判断中文名称 //判断中文名称

Loading…
Cancel
Save