Helius
2021-06-24 1aeb2be4330eb8119845b10bffca5ddaf272c2c4
gc-shop/src/main/resources/mapper/shop/ScoreGoodsCategoryMapper.xml
@@ -2,6 +2,21 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xzx.gc.shop.mapper.ScoreGoodsCategoryMapper">
    <resultMap id="goodsCategoryMap" type="com.xzx.gc.shop.vo.GoodsCategoryVo">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <collection property="children" ofType="com.xzx.gc.shop.vo.GoodsCategoryVo">
            <id column="c_id" property="id" />
            <result column="c_name" property="name" />
        </collection>
    </resultMap>
    <select id="selectCategoryWithChildren" resultMap="goodsCategoryMap">
        select a.id id, a.name name, b.id c_id, b.name c_name
        from xzx_score_goods_category a
        left join xzx_score_goods_category b on a.id=b.parent_id
    </select>
    <select id="queryGoodsCategoryList" resultType="com.xzx.gc.shop.vo.QueryGoodsCategoryListVo">
        SELECT
               *