<?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.TEmergencyWorkingGroupDao">
    <!-- 开启二级缓存 -->
    <!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> -->
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.testor.module.emergency.model.domain.TEmergencyWorkingGroup">
        <id column="id" property="id"/>
        <id column="group_id" property="groupId"/>
        <id column="group_key" property="groupKey"/>
        <id column="group_name" property="name"/>
        <id column="responsibility" property="responsibility"/>
        <id column="org_id" property="orgId"/>
    </resultMap>
    <select id="getResponsibilityList" resultType="com.testor.module.emergency.model.dto.TEmergencyWorkingGroupDTO">
         select
            a.id,
            a.group_id,
            a.group_key,
            a.name as name,
            a.responsibility,
            a.org_id,
            b.dict_value as groupName
        from t_emergency_working_group a left join t_sys_dict_data b on a.group_id = b.dict_data_id
        where a.status = 0 and
        a.org_id = #{param.orgId}
        <if test="param.ids != null">
            and a.id in
            <foreach collection="param.ids" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>

    </select>

    <select id="getWorkingGroupList" resultType="com.testor.module.emergency.model.dto.TEmergencyWorkingGroupDTO">
        select
            a.id,
            a.group_id,
            a.group_key,
            a.name as name,
            a.responsibility,
            a.org_id,
            b.dict_value as groupName
        from t_emergency_working_group a
        left join t_sys_dict_data b on a.group_id = b.dict_data_id
        where a.status = 0 and a.org_id = #{id}
    </select>
</mapper>