xiangpei
2024-05-27 b87239353afdc0c9502e81961249d527dd8ad54e
src/main/resources/mapper/UserMapper.xml
@@ -329,30 +329,27 @@
    </select>
    <select id="userPage" resultMap="BaseResultMap"
            parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM">
    <select id="userPage" resultType="com.mindskip.xzs.viewmodel.admin.user.UserResponseVM" parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM">
        SELECT
        a.*
        a.*,
        c.result as departmentExamineResult,
        d.result as conditionExamineResult
        FROM t_user a
        lEFT join
            (select * from t_user_department
            <if test="departmentId != null and departmentId.size() > 0">
                where department_id in <foreach collection="departmentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
            </if>
                group by user_id
            )
            b on a.id = b.user_id
        where
        LEFT JOIN t_user_department b ON a.id = b.user_id
        LEFT JOIN t_department_examine c ON a.id = c.user_id AND c.deleted = 0 AND c.result = 0
        LEFT JOIN t_user_condition_examine d ON a.id = d.user_id AND d.deleted = 0 AND d.result = 0
        WHERE
            a.deleted=0
            <if test="departmentId != null and departmentId.size() > 0">
                and b.department_id in <foreach collection="departmentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
                AND b.department_id IN <foreach collection="departmentId" item="item" open="(" separator="," close=")"> #{item} </foreach>
            </if>
            <if test="userName != null and userName != ''">
                and real_name like concat('%',#{userName},'%')
                AND real_name LIKE concat('%',#{userName},'%')
            </if>
            <if test="role != null and role.size() > 0">
                and role in <foreach collection="role" item="item" open="(" separator="," close=")"> #{item} </foreach>
                AND role IN <foreach collection="role" item="item" open="(" separator="," close=")"> #{item} </foreach>
            </if>
        GROUP BY a.id
    </select>