You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
5.1 KiB
88 lines
5.1 KiB
<?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.qs.serve.modules.goods.mapper.GoodsSpuMapper">
|
|
|
|
<resultMap id="goodsSpuMap" type="com.qs.serve.modules.goods.entity.GoodsSpu" >
|
|
<result property="id" column="id"/>
|
|
<result property="spuCode" column="spu_code"/>
|
|
<result property="name" column="name"/>
|
|
<result property="categoryFirst" column="category_first"/>
|
|
<result property="categorySecond" column="category_second"/>
|
|
<result property="categoryThird" column="category_third"/>
|
|
<result property="categoryLast" column="category_last"/>
|
|
<result property="picUrls" column="pic_urls" typeHandler="com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler" />
|
|
<result property="shelf" column="shelf"/>
|
|
<result property="sort" column="sort"/>
|
|
<result property="saleNum" column="sale_num"/>
|
|
<result property="tasteValue" column="taste_value"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="tenantId" column="tenant_id"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
<result property="costFlag" column="cost_flag"/>
|
|
<result property="cateFirstLabel" column="cate_first_label"/>
|
|
<result property="cateSecondLabel" column="cate_second_label"/>
|
|
<result property="cateThirdLabel" column="cate_third_label"/>
|
|
|
|
</resultMap>
|
|
|
|
<sql id="goodsSpuSql">
|
|
goods_spu.`id`,
|
|
goods_spu.`spu_code`,
|
|
goods_spu.`name`,
|
|
goods_spu.`category_first`,
|
|
goods_spu.`category_second`,
|
|
goods_spu.`category_third`,
|
|
goods_spu.`category_last`,
|
|
goods_spu.`pic_urls`,
|
|
goods_spu.`shelf`,
|
|
goods_spu.`sort`,
|
|
goods_spu.`sale_num`,
|
|
goods_spu.`spec_type`,
|
|
goods_spu.`taste_value`,
|
|
goods_spu.`create_time`,
|
|
goods_spu.`update_time`,
|
|
goods_spu.`create_by`,
|
|
goods_spu.`update_by`,
|
|
goods_spu.`tenant_id`,
|
|
goods_spu.`cost_flag`,
|
|
goods_spu.`del_flag` </sql>
|
|
|
|
<select id="selectSpuList" parameterType="com.qs.serve.modules.goods.entity.GoodsSpu" resultMap="goodsSpuMap">
|
|
SELECT
|
|
`cate1`.`name` AS `cate_first_label`,
|
|
`cate2`.`name` AS `cate_second_label`,
|
|
`cate3`.`name` AS `cate_third_label`,
|
|
<include refid="goodsSpuSql"/>
|
|
FROM `goods_spu` `goods_spu`
|
|
LEFT JOIN `goods_category` `cate1` ON `cate1`.`id` = `goods_spu`.`category_first`
|
|
LEFT JOIN `goods_category` `cate2` ON `cate2`.`id` = `goods_spu`.`category_second`
|
|
LEFT JOIN `goods_category` `cate3` ON `cate3`.`id` = `goods_spu`.`category_third`
|
|
<where>
|
|
<if test="query.id != null"> and `goods_spu`.`id` = #{query.id}</if>
|
|
<if test="query.spuCode != null and query.spuCode != ''"> and `goods_spu`.`spu_code` like concat('%', #{query.spuCode},'%')</if>
|
|
<if test="query.name != null and query.name != ''"> and `goods_spu`.`name` like concat('%', #{query.name},'%') </if>
|
|
<if test="query.categoryFirst != null"> and `goods_spu`.`category_first` = #{query.categoryFirst}</if>
|
|
<if test="query.categorySecond != null"> and `goods_spu`.`category_second` = #{query.categorySecond}</if>
|
|
<if test="query.categoryThird != null"> and `goods_spu`.`category_third` = #{query.categoryThird}</if>
|
|
<if test="query.categoryLast != null"> and `goods_spu`.`category_last` = #{query.categoryLast}</if>
|
|
<if test="query.shelf != null and query.shelf != ''"> and `goods_spu`.`shelf` = #{query.shelf}</if>
|
|
<if test="query.sort != null"> and `goods_spu`.`sort` = #{query.sort}</if>
|
|
<if test="query.saleNum != null"> and `goods_spu`.`sale_num` = #{query.saleNum}</if>
|
|
<if test="query.tasteValue != null and query.tasteValue != ''"> and `goods_spu`.`taste_value` = #{query.tasteValue}</if>
|
|
<if test="query.createTime != null"> and `goods_spu`.`create_time` = #{query.createTime}</if>
|
|
<if test="query.updateTime != null"> and `goods_spu`.`update_time` = #{query.updateTime}</if>
|
|
<if test="query.createBy != null and query.createBy != ''"> and `goods_spu`.`create_by` = #{query.createBy}</if>
|
|
<if test="query.updateBy != null and query.updateBy != ''"> and `goods_spu`.`update_by` = #{query.updateBy}</if>
|
|
<if test="query.tenantId != null and query.tenantId != ''"> and `goods_spu`.`tenant_id` = #{query.tenantId}</if>
|
|
<if test="query.delFlag != null and query.delFlag != ''"> and `goods_spu`.`del_flag` = #{query.delFlag}</if>
|
|
|
|
<if test="query.searchValue != null and query.searchValue != ''"> and (`goods_spu`.`name` like concat('%',#{query.searchValue},'%') or `goods_spu`.`goods_spu` like concat('%',#{query.searchValue},'%')) </if>
|
|
</where>
|
|
</select>
|
|
|
|
</mapper>
|
|
|