<?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="cn.ey.biz.module.system.dal.mapper.delegation.UserDelegationMapper">

    <resultMap id="BaseResultMap" type="cn.ey.biz.module.system.dal.dataobject.delegation.UserDelegationDO">
        <id property="id" column="id"/>
        <result property="appId" column="app_id"/>
        <result property="agentUserId" column="agent_user_id"/>
        <result property="agentUserName" column="agent_user_name"/>
        <result property="agentGpn" column="agent_gpn"/>
        <result property="agentEmail" column="agent_email"/>
        <result property="userId" column="user_id"/>
        <result property="userName" column="user_name"/>
        <result property="gpn" column="gpn"/>
        <result property="email" column="email"/>
        <result property="creator" column="creator"/>
        <result property="createTime" column="create_time"/>
        <result property="updater" column="updater"/>
        <result property="updateTime" column="update_time"/>
        <result property="deleted" column="deleted"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,app_id,agent_user_id,
        agent_user_name,agent_gpn,agent_email,
        user_id,user_name,gpn,
        email,creator,create_time,
        updater,update_time,deleted
    </sql>

    <select id="getBizUnique" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        system_user_delegation T1
        WHERE
        (T1.app_id,T1.agent_user_id,T1.user_id,T1.deleted) IN
        <foreach collection="list" item="item" open="(" close=")" separator=",">
            (#{item.appId},#{item.agentUserId},#{item.userId},0)
        </foreach>
    </select>
</mapper>
