修改服务方式删除接口
This commit is contained in:
parent
2b8385b1aa
commit
d53f70fd82
@ -294,11 +294,16 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
|
||||
*/
|
||||
@Override
|
||||
public int deleteServiceWayById(Long id) {
|
||||
// 判断该服务方式下是否是关联记录,如果有则不能删除
|
||||
// 判断该服务方式下是否有关联记录,如果有且数量不为0,则不能删除
|
||||
List<ServiceWayContentAndNumVO> voList = serviceWayContentMapper.selectListNum(null, id);
|
||||
if (voList.size() > 0) {
|
||||
boolean hasAssociatedContent = voList.stream()
|
||||
.anyMatch(vo -> vo.getServiceContentNum() != null && vo.getServiceContentNum() > 0);
|
||||
|
||||
if (hasAssociatedContent) {
|
||||
throw new ServiceException("该服务方式下有服务内容,请先删除服务内容");
|
||||
}
|
||||
|
||||
// 如果没有关联记录或数量为0,则可以删除服务方式
|
||||
return serviceWayContentMapper.deleteServiceWayById(id);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user