| | |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | |
| | | LambdaQueryWrapper<UserAccount> queryWrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | // 只有当 keyword 不为空时才添加 OR 条件 |
| | | if (ObjectUtil.isNotEmpty(vo.getKeyword())) { |
| | | if (ObjectUtil.isNotEmpty(vo.getKeywords())) { |
| | | queryWrapper.and(wrapper -> wrapper |
| | | .eq(UserAccount::getId, vo.getKeyword()) |
| | | .eq(UserAccount::getId, vo.getKeywords()) |
| | | .or() |
| | | .eq(UserAccount::getPhoneNumber, vo.getKeyword()) |
| | | .like(UserAccount::getPhoneNumber, vo.getKeywords()) |
| | | .or() |
| | | .eq(UserAccount::getAccount, vo.getKeyword()) |
| | | .like(UserAccount::getAccount, vo.getKeywords()) |
| | | .or() |
| | | .eq(UserAccount::getNickname, vo.getKeyword()) |
| | | .like(UserAccount::getNickname, vo.getKeywords()) |
| | | ); |
| | | } |
| | | |
| | |
| | | queryWrapper.orderByDesc(UserAccount::getCreateTime); |
| | | startPage(); |
| | | List<UserAccount> list = userAccountService.list(queryWrapper); |
| | | |
| | | PageInfo<UserAccount> pageInfo = new PageInfo<>(list); |
| | | |
| | | List<UserAccountOut> toList = ConverterUtil.convertToList(list, UserAccountOut.class); |
| | | return getDataTable(toList); |
| | | |
| | | TableDataInfo rspData = new TableDataInfo(); |
| | | rspData.setCode(HttpStatus.SUCCESS); |
| | | rspData.setMsg("查询成功"); |
| | | rspData.setRows(toList); |
| | | rspData.setTotal(pageInfo.getTotal()); |
| | | return rspData; |
| | | } |
| | | |
| | | /** |