This commit is contained in:
sxu 2025-05-15 16:03:35 +08:00
parent 4dbb3a8088
commit c226cc5aec
3 changed files with 18 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import com.bonus.canteen.core.alloc.mapper.AllocCanteenMapper;
import com.bonus.canteen.core.common.domain.TreeSelect; import com.bonus.canteen.core.common.domain.TreeSelect;
import com.bonus.canteen.core.alloc.mapper.AllocAreaMapper; import com.bonus.canteen.core.alloc.mapper.AllocAreaMapper;
import com.bonus.canteen.core.supermarket.mapper.SupermarketInfoMapper; import com.bonus.canteen.core.supermarket.mapper.SupermarketInfoMapper;
import com.bonus.canteen.core.warehouse.mapper.WarehouseInfoMapper;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
@ -32,6 +33,8 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
private AllocCanteenMapper allocCanteenMapper; private AllocCanteenMapper allocCanteenMapper;
@Autowired @Autowired
private SupermarketInfoMapper supermarketInfoMapper; private SupermarketInfoMapper supermarketInfoMapper;
@Autowired
WarehouseInfoMapper warehouseInfoMapper;
@Override @Override
public List<TreeSelect> selectAreaTreeList(AllocArea area) { public List<TreeSelect> selectAreaTreeList(AllocArea area) {
@ -119,6 +122,10 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
if (coun2 > 0) { if (coun2 > 0) {
throw new ServiceException("该区域含有超市信息,不能删除"); throw new ServiceException("该区域含有超市信息,不能删除");
} }
int coun3 = warehouseInfoMapper.getWarehouseCountByAreaIds(areaIds);
if (coun3 > 0) {
throw new ServiceException("该区域含有仓库信息,不能删除");
}
return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds); return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
} }

View File

@ -57,4 +57,6 @@ public interface WarehouseInfoMapper {
* @return 结果 * @return 结果
*/ */
public int deleteWarehouseInfoByWarehouseIds(Long[] warehouseIds); public int deleteWarehouseInfoByWarehouseIds(Long[] warehouseIds);
public int getWarehouseCountByAreaIds(Long[] areaIds);
} }

View File

@ -152,4 +152,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{warehouseId} #{warehouseId}
</foreach> </foreach>
</delete> </delete>
<select id="getWarehouseCountByAreaIds" resultType="Integer">
select count(1)
from warehouse_info
where del_flag = 0 and area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId}
</foreach>
</select>
</mapper> </mapper>