From cedf9aab0ee975b04c52c0a75749e1eba852db2c Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Mon, 28 Jun 2021 17:44:21 +0800 Subject: [PATCH] add orderList --- gc-shop/src/main/resources/mapper/shop/ScoreGoodsCategoryMapper.xml | 50 +++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 43 insertions(+), 7 deletions(-) diff --git a/gc-shop/src/main/resources/mapper/shop/ScoreGoodsCategoryMapper.xml b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsCategoryMapper.xml index 581a8ec..9ee661b 100644 --- a/gc-shop/src/main/resources/mapper/shop/ScoreGoodsCategoryMapper.xml +++ b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsCategoryMapper.xml @@ -2,22 +2,58 @@ <!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 - * + a.*, + a.CREATED_TIME createTime FROM xzx_score_goods_category a WHERE 1 = 1 - <if test="name != null and name != ''"> - and a.name=#{name} + <if test="record.name != null and record.name != ''"> + and a.name like concat('%',#{record.name},'%') </if> - <if test="categoryIden != null and categoryIden != ''"> - and a.category_iden=#{categoryIden} + <if test="record.categoryIden != null and record.categoryIden != ''"> + and a.category_iden=#{record.categoryIden} </if> - <if test="parentId != null and parentId != ''"> - and a.parent_id=#{parentId} + <if test="record.parentId != null and record.parentId != ''"> + and a.parent_id=#{record.parentId} </if> order by a.CREATED_TIME desc </select> + <select id="viewGoodsCategoryOneList" resultType="com.xzx.gc.shop.vo.ViewGoodsCategoryListVo"> + SELECT + a.*, + a.CREATED_TIME createTime + FROM + xzx_score_goods_category a + WHERE 1 = 1 + and a.parent_id=#{parentId} + </select> + + <select id="viewGoodsCategoryList" resultType="com.xzx.gc.shop.vo.ViewGoodsCategoryListVo"> + SELECT + a.*, + a.CREATED_TIME createTime, + (select name from xzx_score_goods_category where a.parent_id = id) parentName + FROM + xzx_score_goods_category a + WHERE 1 = 1 + </select> + </mapper> -- Gitblit v1.9.1