<?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.yd.csf.service.dao.AgentAccumulatedFycMapper">

    <select id="queryUserGradeList" resultType="com.yd.csf.service.dto.UserGradeDto">
        select
        aaf.agent_id as clientUserBizId,
        mgc.grade_code as gradeCode,
        mgc.grade_name as gradeName
        from agent_accumulated_fyc aaf
        left join member_grade_config mgc on aaf.current_grade_code = mgc.grade_code and mgc.is_deleted = 0
        <where>
            <if test="userBizIdList != null and userBizIdList.size > 0">
                aaf.agent_id in
                <foreach collection="userBizIdList" item="item" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
            and aaf.is_deleted = 0
        </where>
    </select>
</mapper>
