| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | 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.Client; |
| | |
| | | @AllArgsConstructor |
| | | public class ClientService extends BaseServiceImpl<ClientMapper, Client> { |
| | | |
| | | public void addClient(ClientPrarm clientPrarm) { |
| | | public boolean addClient(ClientPrarm clientPrarm) { |
| | | Client client=new Client(); |
| | | client.setClientName(clientPrarm.getClientName()); |
| | | client.setLinkMan(clientPrarm.getLinkMan()); |
| | | client.setMobile(clientPrarm.getMobile()); |
| | | client.setClientSuperior(clientPrarm.getClientSuperior()); |
| | | save(client); |
| | | |
| | | return save(client); |
| | | } |
| | | |
| | | |
| | | public void updateClient(Long id,ClientPrarm clientPrarm){ |
| | | public boolean updateClient(Long id,ClientPrarm clientPrarm){ |
| | | //Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, id)); |
| | | Client one=getById(id); |
| | | if(one==null){ |
| | | throw new BusinessException("该客户不存在"); |
| | | } |
| | | Client client=new Client(); |
| | | client.setId(id); |
| | | client.setClientName(clientPrarm.getClientName()); |
| | |
| | | client.setClientSuperior(clientPrarm.getClientSuperior()); |
| | | |
| | | // update(client); |
| | | updateById(client); |
| | | return updateById(client); |
| | | } |
| | | |
| | | public boolean deleteClient(Long id){ |
| | | Client one=getById(id); |
| | | if (one == null) { |
| | | throw new BusinessException("该客户不存在"); |
| | | } |
| | | return removeById(id); |
| | | } |
| | | |
| | | } |