|
|
@@ -3,6 +3,7 @@ package com.ruoyi.clock.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.ruoyi.clock.exception.AgentExceptionEnum;
|
|
|
+import com.ruoyi.clock.service.IShopService;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.BeanCopyUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
@@ -35,6 +36,7 @@ import java.util.Collection;
|
|
|
public class AgentServiceImpl implements IAgentService {
|
|
|
|
|
|
private final AgentMapper baseMapper;
|
|
|
+ private final IShopService shopService;
|
|
|
|
|
|
/**
|
|
|
* 查询代理商信息分页
|
|
|
@@ -159,6 +161,13 @@ public class AgentServiceImpl implements IAgentService {
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
if(isValid){
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
+ ids.forEach(agentId -> {
|
|
|
+ Long shopCount = shopService.selectShopCount(agentId);
|
|
|
+ //被使用的类别不能删除
|
|
|
+ if(shopCount > 0){
|
|
|
+ throw new ServiceException(AgentExceptionEnum.AGENT_USED);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
return baseMapper.deleteBatchIds(ids) > 0;
|
|
|
}
|