<?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.liquidnet.service.goblin.mapper.GoblinSelfGoodsCategoryMapper">

    <select id="listForMultiGradeCateId" resultType="java.lang.String">
        select cate_id from goblin_self_goods_category cf where del_flg = '0' and grade = '1'
                                                            and cf.cate_id in
        <foreach item="cateId" collection="cateIdArr" open="(" separator="," close=")">
            #{cateId}
        </foreach>
        union all
        select cate_id from goblin_self_goods_category cf where del_flg = '0' and grade = '2'
                                                            and cf.cate_pid in
        <foreach item="cateId" collection="cateIdArr" open="(" separator="," close=")">
            #{cateId}
        </foreach>
        union all
        select cate_id from goblin_self_goods_category cf where del_flg = '0' and grade = '3'
                                                            and cf.cate_pid in (
            select cate_id from goblin_self_goods_category cf where del_flg = '0' and grade = '2'
                                                                and cf.cate_pid in
        <foreach item="cateId" collection="cateIdArr" open="(" separator="," close=")">
            #{cateId}
        </foreach>
        )
    </select>
</mapper>
