删除区域保护
This commit is contained in:
parent
3cf549e24a
commit
03e369c5ee
|
|
@ -60,5 +60,5 @@ public interface AllocCanteenMapper {
|
|||
*/
|
||||
public int deleteAllocCanteenByCanteenIds(Long[] canteenIds);
|
||||
|
||||
public int selectAllocCanteenCountByAreaIds(Long[] areaIds);
|
||||
public int getAllocCanteenCountByAreaIds(Long[] areaIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import java.util.stream.Collectors;
|
|||
import com.bonus.canteen.core.alloc.mapper.AllocCanteenMapper;
|
||||
import com.bonus.canteen.core.common.domain.TreeSelect;
|
||||
import com.bonus.canteen.core.alloc.mapper.AllocAreaMapper;
|
||||
import com.bonus.canteen.core.supermarket.mapper.SupermarketInfoMapper;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
|
|
@ -29,6 +30,8 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
|||
private AllocAreaMapper allocAreaMapper;
|
||||
@Autowired
|
||||
private AllocCanteenMapper allocCanteenMapper;
|
||||
@Autowired
|
||||
private SupermarketInfoMapper supermarketInfoMapper;
|
||||
|
||||
@Override
|
||||
public List<TreeSelect> selectAreaTreeList(AllocArea area) {
|
||||
|
|
@ -108,9 +111,13 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
|||
*/
|
||||
@Override
|
||||
public int deleteAllocAreaByAreaIds(Long[] areaIds) {
|
||||
int count = allocCanteenMapper.selectAllocCanteenCountByAreaIds(areaIds);
|
||||
if (count > 0) {
|
||||
throw new ServiceException("区域含有食堂信息,不能删除");
|
||||
int count1 = allocCanteenMapper.getAllocCanteenCountByAreaIds(areaIds);
|
||||
if (count1 > 0) {
|
||||
throw new ServiceException("该区域含有食堂信息,不能删除");
|
||||
}
|
||||
int coun2 = supermarketInfoMapper.getSupermarketCountByAreaIds(areaIds);
|
||||
if (coun2 > 0) {
|
||||
throw new ServiceException("该区域含有超市信息,不能删除");
|
||||
}
|
||||
return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,4 +57,6 @@ public interface SupermarketInfoMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSupermarketInfoBySupermarketIds(Long[] supermarketIds);
|
||||
|
||||
public int getSupermarketCountByAreaIds(Long[] areaIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectAllocCanteenCountByAreaIds" resultType="Integer">
|
||||
<select id="getAllocCanteenCountByAreaIds" resultType="Integer">
|
||||
select count(1)
|
||||
from alloc_canteen
|
||||
where del_flag = 0 and area_id in
|
||||
|
|
|
|||
|
|
@ -177,4 +177,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{supermarketId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getSupermarketCountByAreaIds" resultType="Integer">
|
||||
select count(1)
|
||||
from supermarket_info
|
||||
where del_flag = 0 and area_id in
|
||||
<foreach item="areaId" collection="array" open="(" separator="," close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue