diff --git a/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java b/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java index 4ca6b4b..838d29d 100644 --- a/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java +++ b/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java @@ -11,6 +11,7 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.query.MPJQueryWrapper; import com.ydool.common.base.BaseService; import com.ydool.common.cache.ConfigCache; import com.ydool.common.data.dto.AjaxResult; @@ -152,12 +153,14 @@ public class UserServiceImpl extends BaseService implements IU @Override public AjaxResult userList(Page page, String value, String column, String orderBy, Boolean status, String role, String dept, String job) { - QueryWrapper qw = new QueryWrapper(); + MPJQueryWrapper qw = new MPJQueryWrapper(); + qw.selectAll(User.class).leftJoin("t_sys_dept dept on dept.id = t.dept"); if (StrUtil.isNotBlank(value)) { - qw.like("AES_DECRYPT(from_base64 (phone),'" + CodecUtils.KEY + "')", value).lambda() + qw.and(query -> + query.like("AES_DECRYPT(from_base64 (t.phone),'" + CodecUtils.KEY + "')", value).lambda() .or().like(User::getLoginName, value) .or().like(User::getRemarks, value) - .or().like(User::getUserName, value); + .or().like(User::getUserName, value)); } qw.lambda().eq(ObjectUtil.isNotNull(status), User::getStatus, status) @@ -166,12 +169,16 @@ public class UserServiceImpl extends BaseService implements IU .eq(StrUtil.isNotBlank(job), User::getJob, job); if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) { - qw.orderByDesc(StrUtil.toUnderlineCase(column)); + qw.orderByDesc("t." + StrUtil.toUnderlineCase(column)); } if ("asc".equals(orderBy) && StrUtil.isNotBlank(column)) { - qw.orderByAsc(StrUtil.toUnderlineCase(column)); + qw.orderByAsc("t." + StrUtil.toUnderlineCase(column)); } + if (StrUtil.isBlank(column)) { + qw.orderByAsc("dept.sort_no"); + } + Page pageList = page(page, qw);