限制房号重复录入 --renpc

This commit is contained in:
Renpc-kilig 2023-12-25 16:21:06 +08:00
parent 34ee0d8d18
commit 9e762b5593
2 changed files with 23 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package com.cm.population.service.house.impl;
import com.cm.common.base.AbstractService;
import com.cm.common.exception.SaveException;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.bos.UserInfoBO;
import com.cm.common.result.SuccessResultList;
@ -26,6 +27,7 @@ import com.cm.population.service.residential.IResidentialService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.apache.pdfbox.contentstream.operator.state.Save;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -86,10 +88,15 @@ public class HouseServiceImpl extends AbstractService implements IHouseService {
} else {
setSaveInfo(token, params);
}
houseDao.save(params);
// 2023年11月20日15:38:06 崔宝铖 创建saveAll函数
populationService.saveAll(token, houseId, houseVO.getPopulationVOList(), true);
// 查询当前房间信息是否存在存在则不做操作
Integer count = houseDao.count(params);
if(count <= 0) {
houseDao.save(params);
// 2023年11月20日15:38:06 崔宝铖 创建saveAll函数
populationService.saveAll(token, houseId, houseVO.getPopulationVOList(), true);
}
return houseId;
}

View File

@ -965,6 +965,15 @@
SELECT COUNT(*)
FROM house_house t1
WHERE t1.is_delete = 0
<if test="buildingId != null and buildingId != ''">
AND building_id = #{buildingId}
</if>
<if test="affiliationFloors != null and affiliationFloors != ''">
AND affiliation_floors = #{affiliationFloors}
</if>
<if test="affiliationUnit != null and affiliationUnit != ''">
AND affiliation_unit = #{affiliationUnit}
</if>
</select>
<!-- 以房找人列表 -->
@ -1124,10 +1133,10 @@
t1.is_delete = 0
<if test="houseIds != null and houseIds.size > 0">
AND
house_id IN
<foreach collection="houseIds" index="index" open="(" separator="," close=")">
#{houseIds[${index}]}
</foreach>
house_id IN
<foreach collection="houseIds" index="index" open="(" separator="," close=")">
#{houseIds[${index}]}
</foreach>
</if>
</select>