TEmergencyWorkingUser.xml 2.07 KB
Newer Older
Rensq's avatar
Rensq committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.testor.module.emergency.dao.TEmergencyWorkingUserDao">
    <!-- 开启二级缓存 -->
    <!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> -->
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.testor.module.emergency.model.domain.TEmergencyWorkingUser">
        <id column="user_id" property="userId"/>
        <id column="group_id" property="groupId"/>
        <id column="org_id" property="orgId"/>
        <id column="id" property="id"/>
        <id column="role_name" property="roleName"/>
        <id column="role_id" property="roleId"/>
        <id column="phone" property="phone"/>
        <id column="user_name" property="userName"/>
    </resultMap>
    <select id="getUserList" resultType="com.testor.module.emergency.model.vo.TEmergencyWorkingUserVO">
        select
            a.user_id,
            a.id,
            a.group_id,
            a.role_name,
            a.role_id,
            a.phone,
            a.user_name,
            b.name as groupName,
            c.dict_value as littleGroupName
        from t_emergency_working_user a
        left join t_emergency_working_group b
        on  a.group_id = b.id
        left join  t_sys_dict_data c on b.group_id = c.dict_data_id
        where
            a.status = 0

        <if test="param.orgId != null and param.orgId != '' ">
            and a.org_id = #{param.orgId}
        </if>
        <if test="param.phone != null and param.phone != '' ">
            and a.phone like concat('%',#{param.phone},'%')
        </if>
        <if test="param.userName != null and param.userName != '' ">
            and a.user_name like concat('%',#{param.userName},'%')
        </if>
        <if test="param.ids != null">
            and a.group_id in
            <foreach collection="param.ids" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>

    </select>
</mapper>