提交 f365fc72 编写于 作者: 有来技术

refactor(SysUserMapper.*): SQL从注解移动至xml中,并修复部门ID和用户状态查询的问题

上级 9bcdc9bf
......@@ -3,9 +3,6 @@ package com.youlai.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.admin.pojo.entity.SysUser;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
......@@ -13,32 +10,6 @@ import java.util.List;
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
@Select("<script> " +
" select u.*,d.name as dept_name , GROUP_CONCAT(r.name) as roleNames" +
" from sys_user u " +
" left join sys_dept d on u.dept_id= d.id " +
" left join sys_user_role ur on u.id=ur.user_id " +
" left join sys_role r on ur.role_id=r.id " +
" where u.deleted != 1 " +
" <if test ='user.username!=null and user.username.trim() neq \"\"'>" +
" and u.username like concat('%',#{user.username},'%')" +
" </if>" +
" <if test ='user.mobile!=null and user.mobile.trim() neq \"\"'>" +
" and u.mobile like concat('%',#{user.mobile},'%')" +
" </if>" +
" <if test ='user.status!=null and user.status>0'>" +
" and u.status = #{user.status}" +
" </if>" +
" <if test ='user.deptId!=null and user.deptId > 0'>" +
" and concat(',',concat(d.tree_path,',',d.id),',') like concat('%,',#{user.deptId},',%')" +
" </if>" +
" GROUP BY u.id " +
"</script>")
@Results({
@Result(id = true, column = "id", property = "id")
})
List<SysUser> list(Page<SysUser> page, SysUser user);
SysUser getByUsername(String username);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册