<?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.copy.trade.dao.TraderTagMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.copy.trade.entity.po.TraderTag">
    <result column="id" property="id" />
    <result column="updated_time" property="updatedTime" />
        <result column="trader_id" property="traderId" />
        <result column="tag_id" property="tagId" />
        <result column="craeted_time" property="craetedTime" />
    </resultMap>


    <select id="traderTagByTraderId" resultType="com.copy.trade.entity.po.Tag">
        select t.id, t.name from trader_tag as tt left join tag as t on tt.tag_id = t.id
        <where>
            <if test="traderId != null">
                tt.trader_id = #{traderId}
            </if>
        </where>
    </select>
</mapper>
