区域含食堂不能删
This commit is contained in:
parent
4873c9107b
commit
8322745260
|
|
@ -59,4 +59,6 @@ public interface AllocCanteenMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteAllocCanteenByCanteenIds(Long[] canteenIds);
|
||||
|
||||
public int selectAllocCanteenCountByAreaIds(Long[] areaIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
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.common.core.exception.ServiceException;
|
||||
|
|
@ -25,6 +27,8 @@ import com.bonus.canteen.core.alloc.service.IAllocAreaService;
|
|||
public class AllocAreaServiceImpl implements IAllocAreaService {
|
||||
@Autowired
|
||||
private AllocAreaMapper allocAreaMapper;
|
||||
@Autowired
|
||||
private AllocCanteenMapper allocCanteenMapper;
|
||||
|
||||
@Override
|
||||
public List<TreeSelect> selectAreaTreeList(AllocArea area) {
|
||||
|
|
@ -104,6 +108,10 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
|
|||
*/
|
||||
@Override
|
||||
public int deleteAllocAreaByAreaIds(Long[] areaIds) {
|
||||
int count = allocCanteenMapper.selectAllocCanteenCountByAreaIds(areaIds);
|
||||
if (count > 0) {
|
||||
throw new ServiceException("区域含有食堂信息,不能删除");
|
||||
}
|
||||
return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,4 +172,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{canteenId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectAllocCanteenCountByAreaIds" resultType="Integer">
|
||||
select count(1)
|
||||
from alloc_canteen
|
||||
where del_flag = 0 and area_id in
|
||||
<foreach item="areaId" collection="array" open="(" separator="," close=")">
|
||||
#{areaId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectAllocStallCountByCanteenIds" resultType="Integer">
|
||||
select count(1)
|
||||
from alloc_stall
|
||||
where canteen_id in
|
||||
where del_flag = 0 and canteen_id in
|
||||
<foreach item="canteenId" collection="array" open="(" separator="," close=")">
|
||||
#{canteenId}
|
||||
</foreach>
|
||||
|
|
|
|||
Loading…
Reference in New Issue