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.
67 lines
3.1 KiB
67 lines
3.1 KiB
|
3 years ago
|
<?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="cc.hiver.mall.dao.mapper.GoodsMapper">
|
||
|
|
|
||
|
|
<resultMap id="BaseResultMap" type="cc.hiver.mall.pojo.vo.GoodsPageVO">
|
||
|
|
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||
|
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||
|
|
<result property="categoryId" column="category_id" jdbcType="BIGINT"/>
|
||
|
|
<result property="brandId" column="brand_id" jdbcType="BIGINT"/>
|
||
|
|
<result property="purchasePrice" column="purchase_price" jdbcType="BIGINT"/>
|
||
|
|
<result property="price" column="price" jdbcType="BIGINT"/>
|
||
|
|
<result property="wholesalePrice" column="wholesale_price" jdbcType="BIGINT"/>
|
||
|
|
<result property="sales" column="sales" jdbcType="INTEGER"/>
|
||
|
|
<result property="picUrl" column="pic_url" jdbcType="VARCHAR"/>
|
||
|
|
<result property="album" column="album" jdbcType="OTHER"/>
|
||
|
|
<result property="unit" column="unit" jdbcType="VARCHAR"/>
|
||
|
|
<result property="description" column="description" jdbcType="VARCHAR"/>
|
||
|
|
<result property="detail" column="detail" jdbcType="VARCHAR"/>
|
||
|
|
<result property="status" column="status" jdbcType="TINYINT"/>
|
||
|
|
<result property="categoryName" column="categoryName" jdbcType="VARCHAR"/>
|
||
|
|
<result property="brandName" column="brandName" jdbcType="VARCHAR"/>
|
||
|
|
<collection property="goodsStockList" column="id" select="cc.hiver.mall.dao.mapper.listGoodsByGoodsId">
|
||
|
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
||
|
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||
|
|
<result property="sn" column="sn" jdbcType="VARCHAR"/>
|
||
|
|
<result property="picUrl" column="pic_url" jdbcType="VARCHAR"/>
|
||
|
|
<result property="specIds" column="spec_ids" jdbcType="VARCHAR"/>
|
||
|
|
<result property="price" column="price" jdbcType="BIGINT"/>
|
||
|
|
<result property="stock" column="stock" jdbcType="INTEGER"/>
|
||
|
|
<result property="lockedStock" column="locked_stock" jdbcType="INTEGER"/>
|
||
|
|
</collection>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!--商品分页列表-->
|
||
|
|
<select id="listGoodsPages" resultMap="BaseResultMap">
|
||
|
|
SELECT
|
||
|
|
t1.id,
|
||
|
|
t1.name,
|
||
|
|
t1.pic_url,
|
||
|
|
t1.origin_price,
|
||
|
|
t1.price,
|
||
|
|
t1.sales,
|
||
|
|
t1.unit,
|
||
|
|
t1.detail,
|
||
|
|
t1.description,
|
||
|
|
t3.NAME categoryName,
|
||
|
|
t4.NAME brandName
|
||
|
|
FROM t_goods t1
|
||
|
|
LEFT JOIN t_goods_category t3 ON t1.category_id = t3.id
|
||
|
|
LEFT JOIN t_goods_brand t4 ON t1.brand_id = t4.id
|
||
|
|
<where>
|
||
|
|
<if test='queryParams.keywords!=null and queryParams.keywords.trim() neq ""'>
|
||
|
|
AND t1.name like concat('%',#{queryParams.keywords},'%')
|
||
|
|
</if>
|
||
|
|
<if test="queryParams.categoryId!=null">
|
||
|
|
AND t1.category_id =#{queryParams.categoryId}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
</where>
|
||
|
|
ORDER BY
|
||
|
|
t1.update_time DESC,
|
||
|
|
t1.create_time DESC
|
||
|
|
</select>
|
||
|
|
</mapper>
|