fix:用户表分页查询页数不对

This commit is contained in:
zhangzhiqiang
2023-05-04 13:53:34 +08:00
parent f13875ace8
commit ea280b05f8

View File

@@ -52,25 +52,14 @@
<result column="updateTime" property="updateTime" />
<result column="extpersonId" property="extpersonId" />
<result column="extuserId" property="extuserId" />
<collection property="depts" ofType="org.nl.system.service.dept.dao.SysDept">
<id property="deptId" column="deptId"/>
<result column="deptName" property="name"/>
</collection>
<collection property="roles" ofType="org.nl.system.service.role.dao.SysRole">
<id property="roleId" column="roleId"/>
</collection>
<collection property="depts" ofType="org.nl.system.service.dept.dao.SysDept" column="userId" select="selectDept"></collection>
<collection property="roles" ofType="org.nl.system.service.role.dao.SysRole" column="userId" select="selectRole"></collection>
</resultMap>
<select id="getUserDetail" resultMap="UserDetail">
SELECT
<include refid="Base_Column_List"/>
,sys_dept.dept_id as deptId
,sys_dept.name as deptName
,sys_users_roles.role_id as roleId
FROM
sys_user
left join sys_user_dept on sys_user.user_id = sys_user_dept.user_id
left join sys_users_roles on sys_users_roles.user_id = sys_user.user_id
left join sys_dept on sys_user_dept.dept_id = sys_dept.dept_id
<where>
<if test="query.deptId != null">
and
@@ -90,6 +79,20 @@
</if>
</where>
</select>
<select id="selectDept" resultType="org.nl.system.service.dept.dao.SysDept">
select
sys_dept.dept_id as deptId,
sys_dept.name as name
from sys_dept
left join sys_user_dept
on sys_user_dept.dept_id = sys_dept.dept_id
where user_id = #{userId}
</select>
<select id="selectRole" resultType="org.nl.system.service.role.dao.SysRole">
select role_id as roleId
from sys_users_roles
where user_id = #{userId}
</select>
<select id="getDetailForMap" resultType="java.util.Map">
SELECT