进入款式模块提示异常问题

zhc4dev
赵玉瑞 2 years ago
parent d5c89cc962
commit 8379f013b0
  1. 10
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zyclothsstyle/controller/ZyClothsStyleController.java
  2. 14
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodule/controller/ZyStyleModuleController.java

@ -163,15 +163,11 @@ public class ZyClothsStyleController extends JeecgController<ZyClothsStyle, IZyC
return Result.error("添加失败!编号不能为空");
}
LambdaQueryWrapper<ZyClothsStyle> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ZyClothsStyle::getTypeName, zyClothsStyle.getTypeName());
queryWrapper.eq(ZyClothsStyle::getStyleNames, zyClothsStyle.getStyleNames());
int a = zyClothsStyleService.count(queryWrapper);
if (a >= 1)
if (a >= 1) {
return Result.error("存在以添加过的数据!");
// for (ZyClothsStyle zy : zyClothsStyleList) {
// if (zyClothsStyle.getStyleNames().equals(zy.getStyleNames())) {
// return Result.error("添加失败!数据已存在");
// }
// }
}
zyClothsStyleService.save(zyClothsStyle);
return Result.OK("添加成功!");
}

@ -31,6 +31,7 @@ import org.jeecg.modules.zystylemodule.mapper.ZyStyleModuleMapper;
import org.jeecg.modules.zystylemodule.service.IZyStyleModuleService;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@ -87,13 +88,18 @@ public class ZyStyleModuleController extends JeecgController<ZyStyleModule, IZyS
Page<ZyStyleModule> page = new Page<>(pageNo, pageSize);
IPage<ZyStyleModule> pageList = zyStyleModuleService.page(page, queryWrapper);
//List<ZyStyleModule> zyStyleModules = zyStyleModuleMapper.getListByStyleId(id);
//改变list中的实体类 类型
List<NewStyleModule> newStyleModuleList = zyStyleModuleService.changeList(pageList.getRecords());
IPage<NewStyleModule> pageList2 = new Page<>(pageNo, pageSize, newStyleModuleList.size());
pageList2.setRecords(newStyleModuleList);
return Result.OK(pageList2);
if (!ObjectUtils.isEmpty(newStyleModuleList)){
IPage<NewStyleModule> pageList2 = new Page<>(pageNo, pageSize, newStyleModuleList.size());
pageList2.setRecords(newStyleModuleList);
return Result.OK(pageList2);
} else {
IPage<NewStyleModule> pageList2 = new Page<>(pageNo, pageSize, 0);
return Result.OK(pageList2);
}
}

Loading…
Cancel
Save