fix(自定义对比): 80791

This commit is contained in:
yjz
2024-01-23 14:40:56 +08:00
parent 8ea81465d0
commit bd53579da3
3 changed files with 22 additions and 0 deletions
@@ -231,6 +231,8 @@ public class LawsCustomCompareInfoController {
if (StringUtils.isNotBlank(lawsCustomCompareInfo.getId())){
lawsCustomCompareInfoService.isHorizontalOverstep(lawsCustomCompareInfo.getId());
}
// 清单名称唯一性校验
lawsCustomCompareInfoService.uniqueVerify(lawsCustomCompareInfo.getId(), lawsCustomCompareInfo.getListName());
lawsCustomCompareInfoService.saveOrUpdate(lawsCustomCompareInfo);
lawsCustomCompareInfoService.editCompareCreateTime(lawsCustomCompareInfo.getId());
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
@@ -118,5 +118,12 @@ public interface ILawsCustomCompareInfoService extends IService<LawsCustomCompar
* 自定义对比-是否水平越权
*/
void isHorizontalOverstep(String ids);
/**
* 自定义对比-清单名称唯一性校验
* @param id
* @param listName
*/
void uniqueVerify(String id, String listName);
}
@@ -187,6 +187,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
if (StringUtils.isBlank(lawsCustomCompareInfo.getId())){
lawsCustomCompareInfo.setId(id);
}
uniqueVerify(lawsCustomCompareInfo.getId(), lawsCustomCompareInfo.getListName());
saveOrUpdate(lawsCustomCompareInfo);
// 自定义对比_标准 旧数据
@@ -485,6 +486,18 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
}
}
@Override
public void uniqueVerify(String id, String listName) {
if (StringUtils.isNotBlank(listName)){
int count = count(new LambdaQueryWrapper<LawsCustomCompareInfo>()
.eq(LawsCustomCompareInfo::getListName, listName)
.ne(StringUtils.isNotBlank(id), LawsCustomCompareInfo::getId, id));
if (count > 0){
throw new JeroBootException("清单名称已存在!");
}
}
}
private void createTableCellContent(HSSFSheet sheet, List<StandardVO> standardVOS, List<LawsCustomCompareInventory> featureList, List<LawsCustomCompareInventory> compareList, List<LawsCustomCompareCell> list, CellStyle cellStyle) {
for (int i = 2; i <= compareList.size() + 2; i++) {
// 创建行