| | |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.AddClientPrarm; |
| | | import com.sandu.ximon.admin.param.ClientPrarm; |
| | | import com.sandu.ximon.admin.param.UpdateClientPrarm; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.domain.Client; |
| | | import com.sandu.ximon.dao.domain.ClientRoleRelation; |
| | |
| | | } |
| | | |
| | | |
| | | public boolean updateClient(Long id, ClientPrarm clientPrarm) { |
| | | public boolean updateClient(Long id, UpdateClientPrarm updateClientPrarm) { |
| | | //判断用户是否存在 |
| | | Client one = getById(id); |
| | | if (one == null) { |
| | |
| | | } |
| | | |
| | | //判断用户名是否重复 |
| | | Client client1 = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getClientName, clientPrarm.getClientName().trim())); |
| | | Client client1 = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getClientName, updateClientPrarm.getClientName().trim())); |
| | | if (client1 != null && !client1.getId().equals(one.getId())) { |
| | | throw new BusinessException("该用户名已存在!"); |
| | | } |
| | | //判断上级用户是否存在 |
| | | Client client = new Client(); |
| | | if (clientPrarm.getClientSuperior() != null && clientPrarm.getClientSuperior().trim().length() != 0) { |
| | | Client superior = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getClientName, clientPrarm.getClientSuperior())); |
| | | if (updateClientPrarm.getClientSuperior() != null && updateClientPrarm.getClientSuperior().trim().length() != 0) { |
| | | Client superior = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getClientName, updateClientPrarm.getClientSuperior())); |
| | | if (superior != null) { |
| | | if (superior.getId().equals(one.getId())) { |
| | | throw new BusinessException("上级客户为本账户!"); |
| | | } else { |
| | | client.setSuperiorId(superior.getId()); |
| | | client.setClientSuperior(clientPrarm.getClientSuperior()); |
| | | client.setClientSuperior(updateClientPrarm.getClientSuperior()); |
| | | } |
| | | } else { |
| | | throw new BusinessException("上级客户不存在"); |
| | | } |
| | | } |
| | | client.setId(id); |
| | | client.setClientName(clientPrarm.getClientName()); |
| | | client.setLinkMan(clientPrarm.getLinkMan()); |
| | | client.setMobile(clientPrarm.getMobile()); |
| | | client.setClientName(updateClientPrarm.getClientName()); |
| | | client.setLinkMan(updateClientPrarm.getLinkMan()); |
| | | client.setMobile(updateClientPrarm.getMobile()); |
| | | |
| | | // update(client); |
| | | return updateById(client); |