新增接口 分类列表(包括子分类)

This commit is contained in:
2024-06-20 11:57:02 +08:00
parent 08625bd03e
commit 762a902950
5 changed files with 58 additions and 0 deletions

View File

@@ -18,6 +18,18 @@
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
</resultMap>
<!-- 定义结果映射 -->
<resultMap id="queryAllResultMap" type="com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo">
<id property="id" column="id"/>
<result property="name" column="name"/>
<collection property="childs" ofType="com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo">
<id property="id" column="childId"/>
<result property="name" column="childName"/>
</collection>
</resultMap>
<sql id="Base_Column_List">
id, name, short_name, tree, pid, pic, merchant_id, shop_id, style, is_show, detail,
sort, key_word, created_at, updated_at
@@ -220,4 +232,15 @@
ORDER BY
`sort` asc
</select>
<select id="queryAllCategory" resultMap="queryAllResultMap">
SELECT a.id AS id, a.name AS name, b.id AS childId, b.name AS childName
FROM tb_shop_category a
LEFT JOIN tb_shop_category b ON a.id = b.pid
WHERE a.shop_id = #{shopId}
AND a.is_show = 1
AND a.tree IS NULL
ORDER BY a.sort ASC
</select>
</mapper>