| | |
| | | import com.sandu.common.util.IpUtil; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.dto.ClientDto; |
| | | import com.sandu.ximon.admin.dto.ClientDtoNode; |
| | | import com.sandu.ximon.admin.param.AddClientPrarm; |
| | | import com.sandu.ximon.admin.param.AdminLoginParam; |
| | | import com.sandu.ximon.admin.param.UpdateClientPrarm; |
| | |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> listLikeClient(BaseConditionVO baseConditionVO, |
| | | @RequestParam(value = "keyword", required = false) String keyword, |
| | | public ResponseVO<Object> listLikeClient(@RequestParam(value = "keyword", required = false) String keyword, |
| | | @RequestParam(value = "order", required = false) Integer order, |
| | | @RequestParam(value = "seq", required = false) Integer seq) { |
| | | if (!permissionConfig.check(MenuEnum.CLIENT_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<ClientDtoNode> clientDtoNodes = clientService.listLikeClient(keyword, order, seq); |
| | | |
| | | |
| | | LambdaQueryWrapper<Client> wrapper = Wrappers.lambdaQuery(Client.class); |
| | | if (AdministratorEnums.NORMAL.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | wrapper.eq(Client::getSuperiorId, SecurityUtils.getUserId()).or(w -> w.eq( |
| | | Client::getId, SecurityUtils.getUserId() |
| | | )); |
| | | } |
| | | if (keyword != null && !keyword.isEmpty()) { |
| | | wrapper.like(Client::getClientName, keyword) |
| | | .or(w1 -> w1.like(Client::getMobile, keyword)) |
| | | .or(w2 -> w2.like(Client::getLinkMan, keyword)); |
| | | } |
| | | //排序字段 |
| | | String orderByResult = "id"; |
| | | //正序、倒叙 |
| | | String orderBySeq = OrderByEnums.ASC.getCode(); |
| | | if (order != null) { |
| | | switch (order) { |
| | | case 1: |
| | | orderByResult = OrderByEnums.CLIENT_CREATE_TIME.getCode(); |
| | | break; |
| | | default: |
| | | } |
| | | } |
| | | if (seq != null) { |
| | | switch (seq) { |
| | | case 1: |
| | | orderBySeq = OrderByEnums.ASC.getCode(); |
| | | break; |
| | | case 2: |
| | | orderBySeq = OrderByEnums.DESC.getCode(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | //排序方式 |
| | | String orderBy = orderByResult + " " + orderBySeq; |
| | | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy); |
| | | List<Client> clientList = clientService.list(wrapper); |
| | | |
| | | List<ClientDto> clientDtoList = new ArrayList<>(); |
| | | for (Client demo : clientList) { |
| | | ClientDto clientDto = new ClientDto(); |
| | | BeanUtil.copyProperties(demo, clientDto); |
| | | ClientRoleRelation one = clientRoleRelationService.getOne(Wrappers.lambdaQuery(ClientRoleRelation.class) |
| | | .eq(ClientRoleRelation::getClientId, demo.getId())); |
| | | |
| | | if (one != null) { |
| | | clientDto.setRoleId(one.getRoleId()); |
| | | } |
| | | clientDtoList.add(clientDto); |
| | | |
| | | } |
| | | return ResponseUtil.successPage(clientDtoList); |
| | | return ResponseUtil.successPage(clientDtoNodes); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | |
| | | StoreOperationRecordsUtils.storeOperationLoginData(client.getId(), client.getClientName(), "用户登录", content); |
| | | return ResponseUtil.success(authInfo); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @GetMapping("/getTokenByKey") |
| | | public ResponseVO<Object> getLonginKey(@RequestParam(required = false, value = "keyValue") String keyValue) { |
| | | |
| | | return ResponseUtil.success(clientService.creatKeyByLogin(keyValue)); |
| | | } |
| | | } |