<?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.ruoyi.clock.mapper.ActivityAgentMapper">

    <resultMap type="com.ruoyi.clock.domain.ActivityAgent" id="ActivityAgentResult">
        <result property="id" column="id"/>
        <result property="activityId" column="activity_id"/>
        <result property="agentId" column="agent_id"/>
    </resultMap>

    <select id="selectAgentList" resultType="com.ruoyi.clock.domain.vo.AgentVo">
        select
            a.agent_id,
            a.agent_name
        from tb_activity_agent aa
        left join tb_agent a on aa.agent_id = a.agent_id
        where aa.activity_id = #{activityId}
    </select>

    <select id="queryList" resultType="com.ruoyi.clock.domain.vo.ActivityAgentVo">
        select
            a.id,
            a.activity_id,
            a.agent_id,
            b.agent_name
        from tb_activity_agent a
        left join tb_agent b on a.agent_id = b.agent_id
        where 1=1 and b.del_flag = 0
        <if test="bo.id != null">
            and a.id = #{bo.id}
        </if>
        <if test="bo.activityId != null">
            and a.activity_id = #{bo.activityId}
        </if>
    </select>


</mapper>
