| | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.ClientPrarm; |
| | | import com.sandu.ximon.dao.domain.Admin; |
| | | import com.sandu.ximon.dao.domain.Client; |
| | | import com.sandu.ximon.dao.mapper.ClientMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @AllArgsConstructor |
| | | public class ClientService extends BaseServiceImpl<ClientMapper, Client> { |
| | | |
| | | |
| | | |
| | | public boolean addClient(ClientPrarm clientPrarm) { |
| | | Client client=new Client(); |
| | | if(clientPrarm.getClientSuperior()!=null){ |
| | | Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getClientSuperior, clientPrarm.getClientSuperior())); |
| | | if(one!=null){ |
| | | client.setSuperiorId(one.getId()); |
| | | }else { |
| | | throw new BusinessException("上级客户不存在"); |
| | | } |
| | | } |
| | | client.setClientName(clientPrarm.getClientName()); |
| | | client.setLinkMan(clientPrarm.getLinkMan()); |
| | | client.setMobile(clientPrarm.getMobile()); |
| | | client.setClientSuperior(clientPrarm.getClientSuperior()); |
| | | |
| | | |
| | | return save(client); |
| | | } |
| | | |