dev^2
itcast 1 year ago
parent 65a5b17237
commit 1a058fb39c
  1. 14
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java

@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import com.aliyuncs.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@ -436,6 +437,7 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
if (StringUtils.isEmpty(String.valueOf(cell))) {
break;
}
ExcelInfo excelInfo = new ExcelInfo();
excelInfo.setcells(cells);
Fieldx222 fieldx222 = new Fieldx222();
@ -455,6 +457,7 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
fieldx222Service.remove(null);
return Result.error("序号为" + (r - 2) + "的中文名称不能为空");
}
fieldx222.setFieldName(excelInfo.getFieldName());
Fieldx222 fieldx2221=fieldx222Service.query().eq("field_name",excelInfo.getFieldName()).one();
if(fieldx2221!=null){
message.put("isError", "true");
@ -466,6 +469,17 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
}
fieldx222.setFieldName(excelInfo.getFieldName());
LambdaQueryWrapper<Fieldx> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(Fieldx::getTableId,fieldx222.getTableId()).eq(Fieldx::getFieldName,fieldx222.getFieldName());
List<Fieldx> list=fieldxService.list(queryWrapper);
if(list!=null&&list.size()!=0){
message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的字段名此表已存在不能重复");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
fieldx222Service.remove(null);
return Result.error("序号为" + (r - 2) + "的字段名此表已存在不能重复");
}
if (StringUtil.isBlank(excelInfo.getFieldEnName())) {
message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的”英文名称”不能为空");

Loading…
Cancel
Save