<?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.gree.mall.manager.commonmapper.CustomTagGroupMapper">
    <select id="queryTagList" resultMap="tagListMap">
        SELECT *
        FROM tag_group tg
        left join tag ta on tg.tag_group_id=ta.group_id
        <if test=' companyWechatIds != null and companyWechatIds.size > 0' >
            where  tg.company_wechat_id in
            <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
                #{companyWechatId}
            </foreach>
        </if>
        order by tg.create_time desc
    </select>



    <resultMap id="tagListMap" type="com.gree.mall.manager.bean.tag.CustomTagGroup">
        <id column="tag_group_id" property="tagGroupId"/>
        <result column="tag_group_name" property="tagGroupName"/>
        <result column="group_type" property="groupType"/>
        <result column="create_time" property="createTime"/>
        <collection property="tags" ofType="com.gree.mall.manager.plus.entity.Tag">
            <id column="tag_id" property="tagId"/>
            <result column="name" property="name"/>
            <result column="group_name" property="groupName"/>
            <result column="group_id" property="groupId"/>
            <result column="type" property="type"/>
        </collection>
    </resultMap>
</mapper>