forked from gzzfw/backEnd/gz-dyh

xusd
2024-09-21 a07512d88aa5b1561f64b06f72717588dc8a89cc
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUserMapper.xml
@@ -240,7 +240,7 @@
                    and disp_status = #{terms.dispStatus}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = '1'
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
@@ -325,4 +325,104 @@
        limit #{page.offset}, #{page.size}
    </select>
    <!--  根据条件统计  -->
    <select id="countQueryCtUser" resultType="java.lang.Long">
        SELECT COUNT(distinct t1.id)
        FROM dyh_ct_user t1
        LEFT JOIN dyh_ct_userole t2 on t1.id = t2.user_id
        <if test="terms != null">
            <where>
                <if test="terms.trueName != null and terms.trueName !=''">
                    and t1.true_name like concat('%', #{terms.trueName}, '%')
                </if>
                <if test="terms.acc != null and terms.acc !=''">
                    and t1.acc like concat('%', #{terms.acc}, '%')
                </if>
                <if test="terms.unitId != null and terms.unitId !=''">
                    and t1.unit_id = #{terms.unitId}
                </if>
                <if test="terms.deptId != null and terms.deptId !=''">
                    and t1.dept_id = #{terms.deptId}
                </if>
                <if test="terms.status != null and terms.status !=''">
                    and t1.status = #{terms.status}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and t1.delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and t1.delete_status = #{terms.deleteStatus}
                </if>
                <if test="terms.roleId != null and terms.roleId !=''">
                    and t2.role_id = #{terms.roleId}
                </if>
            </where>
        </if>
    </select>
    <!--  根据条件分页查询  -->
    <select id="pageQueryCtUser" resultMap="dataResult">
        SELECT t1.*
        FROM dyh_ct_user t1
        LEFT JOIN dyh_ct_userole t2 on t1.id = t2.user_id
        <if test="terms != null">
            <where>
                <if test="terms.trueName != null and terms.trueName !=''">
                    and t1.true_name like concat('%', #{terms.trueName}, '%')
                </if>
                <if test="terms.acc != null and terms.acc !=''">
                    and t1.acc like concat('%', #{terms.acc}, '%')
                </if>
                <if test="terms.unitId != null and terms.unitId !=''">
                    and t1.unit_id = #{terms.unitId}
                </if>
                <if test="terms.deptId != null and terms.deptId !=''">
                    and t1.dept_id = #{terms.deptId}
                </if>
                <if test="terms.status != null and terms.status !=''">
                    and t1.status = #{terms.status}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and t1.delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and t1.delete_status = #{terms.deleteStatus}
                </if>
                <if test="terms.roleId != null and terms.roleId !=''">
                    and t2.role_id = #{terms.roleId}
                </if>
                <if test="terms.roleCode != null and terms.roleCode !=''">
                    and t2.role_code = #{terms.roleCode}
                </if>
            </where>
        </if>
        GROUP BY t1.id
        <if test="page.sort != null">
            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
                isnull(${s.property}), ${s.property} ${s.direction}
            </foreach>
        </if>
        <if test="page.sort == null">
            order by isnull(t1.create_time), t1.create_time desc
        </if>
        limit #{page.offset}, #{page.size}
    </select>
    <!--  根据部门和角色查询  -->
    <select id="listUserByUnitRoleList" resultMap="dataResult">
        SELECT t1.id, t1.true_name, t1.dept_id
        FROM dyh_ct_user t1 LEFT JOIN dyh_ct_userole t2 ON t1.id = t2.user_id
        WHERE
        t1.delete_status = '0'
        AND t2.role_code = #{roleCode}
        AND t1.status = '1'
        AND t1.unit_id = #{unitId}
    </select>
    <select id="selectByIdCard" resultMap="dataResult">
        SELECT * FROM dyh_ct_user
        WHERE
            delete_status = '0'
            and status = '1' and idcard=#{idCard}
    </select>
</mapper>