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.
173 lines
9.8 KiB
173 lines
9.8 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.GoodsSkuMapper">
|
|
|
|
<resultMap id="goodsSkuMap" type="com.qs.serve.modules.goods.entity.GoodsSku" >
|
|
<result property="id" column="id"/>
|
|
<result property="skuCode" column="sku_code"/>
|
|
<result property="spuId" column="spu_id"/>
|
|
<result property="picUrl" column="pic_url"/>
|
|
<result property="salesPrice" column="sales_price"/>
|
|
<result property="marketPrice" column="market_price"/>
|
|
<result property="costPrice" column="cost_price"/>
|
|
<result property="specInfos" column="spec_infos"/>
|
|
<result property="stock" column="stock"/>
|
|
<result property="unitId" column="unit_id"/>
|
|
<result property="unitName" column="unit_name"/>
|
|
<result property="weight" column="weight"/>
|
|
<result property="volume" column="volume"/>
|
|
<result property="minPurchase" column="min_purchase"/>
|
|
<result property="enable" column="enable"/>
|
|
<result property="version" column="version"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="tenantId" column="tenant_id"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="costFlag" column="cost_flag"/>
|
|
<result property="belong" column="belong"/>
|
|
</resultMap>
|
|
|
|
<sql id="goodsSkuSql">
|
|
goods_sku.`id`,
|
|
goods_sku.`sku_code`,
|
|
goods_sku.`sku_name`,
|
|
goods_sku.`spu_id`,
|
|
goods_sku.`pic_url`,
|
|
goods_sku.`sales_price`,
|
|
goods_sku.`market_price`,
|
|
goods_sku.`cost_price`,
|
|
goods_sku.`spec_infos`,
|
|
goods_sku.`stock`,
|
|
goods_sku.`unit_id`,
|
|
goods_sku.`unit_name`,
|
|
goods_sku.`weight`,
|
|
goods_sku.`volume`,
|
|
goods_sku.`min_purchase`,
|
|
goods_sku.`enable`,
|
|
goods_sku.`version`,
|
|
goods_sku.`remark`,
|
|
goods_sku.`update_time`,
|
|
goods_sku.`create_time`,
|
|
goods_sku.`tenant_id`,
|
|
goods_sku.`del_flag`,
|
|
goods_sku.`create_by`,
|
|
goods_sku.`cost_flag`,
|
|
goods_sku.`update_by`,
|
|
goods_sku.`special_flag`,
|
|
goods_sku.`order_flag`,
|
|
goods_sku.`belong`
|
|
</sql>
|
|
|
|
<select id="selectGoodsSkuList" parameterType="com.qs.serve.modules.goods.entity.GoodsSku" resultMap="goodsSkuMap">
|
|
SELECT <include refid="goodsSkuSql"/> FROM `goods_sku` `goods_sku`
|
|
<where>
|
|
<if test="query.id != null"> and `goods_sku`.`id` = #{query.id}</if>
|
|
<if test="query.skuCode != null and query.skuCode != ''"> and `goods_sku`.`sku_code` = #{query.skuCode}</if>
|
|
<if test="query.spuId != null"> and `goods_sku`.`spu_id` = #{query.spuId}</if>
|
|
<if test="query.salesPrice != null"> and `goods_sku`.`sales_price` = #{query.salesPrice}</if>
|
|
<if test="query.marketPrice != null"> and `goods_sku`.`market_price` = #{query.marketPrice}</if>
|
|
<if test="query.costPrice != null"> and `goods_sku`.`cost_price` = #{query.costPrice}</if>
|
|
<if test="query.belong != null"> and `goods_sku`.`belong` = #{query.belong}</if>
|
|
<if test="query.specInfos != null and query.specInfos != ''"> and `goods_sku`.`spec_infos` = #{query.specInfos}</if>
|
|
<if test="query.stock != null"> and `goods_sku`.`stock` = #{query.stock}</if>
|
|
<if test="query.unitId != null"> and `goods_sku`.`unit_id` = #{query.unitId}</if>
|
|
<if test="query.unitName != null and query.unitName != ''"> and `goods_sku`.`unit_name` = #{query.unitName}</if>
|
|
<if test="query.weight != null"> and `goods_sku`.`weight` = #{query.weight}</if>
|
|
<if test="query.volume != null"> and `goods_sku`.`volume` = #{query.volume}</if>
|
|
<if test="query.enable != null and query.enable != ''"> and `goods_sku`.`enable` = #{query.enable}</if>
|
|
<if test="query.version != null"> and `goods_sku`.`version` = #{query.version}</if>
|
|
<if test="query.remark != null and query.remark != ''"> and `goods_sku`.`remark` = #{query.remark}</if>
|
|
<if test="query.updateTime != null"> and `goods_sku`.`update_time` = #{query.updateTime}</if>
|
|
<if test="query.createTime != null"> and `goods_sku`.`create_time` = #{query.createTime}</if>
|
|
<if test="query.tenantId != null and query.tenantId != ''"> and `goods_sku`.`tenant_id` = #{query.tenantId}</if>
|
|
<if test="query.delFlag != null and query.delFlag != ''"> and `goods_sku`.`del_flag` = #{query.delFlag}</if>
|
|
<if test="query.createBy != null and query.createBy != ''"> and `goods_sku`.`create_by` = #{query.createBy}</if>
|
|
<if test="query.updateBy != null and query.updateBy != ''"> and `goods_sku`.`update_by` = #{query.updateBy}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<resultMap id="skuVoResultMap" type="com.qs.serve.modules.goods.entity.vo.GoodSkuVo" extends="goodsSkuMap">
|
|
<result property="name" column="name"/>
|
|
<result property="shelf" column="shelf"/>
|
|
<result property="spuCode" column="spu_code"/>
|
|
</resultMap>
|
|
|
|
<select id="selectSkuVo" parameterType="com.qs.serve.modules.goods.entity.GoodsSku" resultMap="skuVoResultMap">
|
|
SELECT
|
|
`goods_spu`.`name`,
|
|
`goods_spu`.`spu_code`,
|
|
`goods_spu`.`shelf`,
|
|
<include refid="goodsSkuSql"/>
|
|
FROM `goods_sku` `goods_sku`
|
|
LEFT JOIN `goods_spu` ON `goods_sku`.`spu_id` = `goods_spu`.id
|
|
<where>
|
|
and `goods_sku`.`del_flag` = 0
|
|
and `goods_spu`.`del_flag` = 0
|
|
<if test="query.id != null"> and `goods_sku`.`id` = #{query.id}</if>
|
|
<if test="query.skuCode != null and query.skuCode != ''"> and `goods_sku`.`sku_code` = #{query.skuCode}</if>
|
|
<if test="query.spuId != null"> and `goods_sku`.`spu_id` = #{query.spuId}</if>
|
|
<if test="query.salesPrice != null"> and `goods_sku`.`sales_price` = #{query.salesPrice}</if>
|
|
<if test="query.marketPrice != null"> and `goods_sku`.`market_price` = #{query.marketPrice}</if>
|
|
<if test="query.costPrice != null"> and `goods_sku`.`cost_price` = #{query.costPrice}</if>
|
|
<if test="query.specInfos != null and query.specInfos != ''"> and `goods_sku`.`spec_infos` = #{query.specInfos}</if>
|
|
<if test="query.stock != null"> and `goods_sku`.`stock` = #{query.stock}</if>
|
|
<if test="query.belong != null"> and `goods_sku`.`belong` = #{query.belong}</if>
|
|
<if test="query.unitId != null"> and `goods_sku`.`unit_id` = #{query.unitId}</if>
|
|
<if test="query.unitName != null and query.unitName != ''"> and `goods_sku`.`unit_name` = #{query.unitName}</if>
|
|
<if test="query.weight != null"> and `goods_sku`.`weight` = #{query.weight}</if>
|
|
<if test="query.volume != null"> and `goods_sku`.`volume` = #{query.volume}</if>
|
|
<if test="query.enable != null "> and `goods_sku`.`enable` = #{query.enable}</if>
|
|
<if test="query.version != null"> and `goods_sku`.`version` = #{query.version}</if>
|
|
<if test="query.remark != null and query.remark != ''"> and `goods_sku`.`remark` = #{query.remark}</if>
|
|
<if test="query.updateTime != null"> and `goods_sku`.`update_time` = #{query.updateTime}</if>
|
|
<if test="query.createTime != null"> and `goods_sku`.`create_time` = #{query.createTime}</if>
|
|
<if test="query.tenantId != null and query.tenantId != ''"> and `goods_sku`.`tenant_id` = #{query.tenantId}</if>
|
|
<if test="query.delFlag != null and query.delFlag != ''"> and `goods_sku`.`del_flag` = #{query.delFlag}</if>
|
|
<if test="query.createBy != null and query.createBy != ''"> and `goods_sku`.`create_by` = #{query.createBy}</if>
|
|
<if test="query.updateBy != null and query.updateBy != ''"> and `goods_sku`.`update_by` = #{query.updateBy}</if>
|
|
<if test="query.querySpuShelf != null and query.querySpuShelf != ''"> and `goods_spu`.`shelf` = #{query.querySpuShelf}</if>
|
|
<if test="query.selectSkuIds!=null and query.selectSkuIds.size > 0">
|
|
and `goods_sku`.`id` in
|
|
<foreach collection="query.selectSkuIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
ORDER BY `goods_sku`.`create_time` DESC
|
|
</select>
|
|
|
|
<select id="selectByCategoryIds" resultType="com.qs.serve.modules.goods.entity.GoodsSku">
|
|
SELECT goods_sku.* FROM `goods_sku`
|
|
LEFT JOIN `goods_spu`
|
|
ON goods_sku.spu_id = goods_spu.id
|
|
WHERE
|
|
goods_sku.tenant_id = #{tenantId}
|
|
and goods_sku.del_flag = 0
|
|
and goods_sku.enable = 1
|
|
and goods_spu.shelf = 1
|
|
and goods_spu.category_third in
|
|
<foreach collection="categoryIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
or
|
|
goods_spu.category_second in
|
|
<foreach collection="categoryIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
or
|
|
goods_spu.category_first in
|
|
<foreach collection="categoryIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="getBelongStringList" resultType="java.lang.String">
|
|
SELECT `belong` FROM `goods_sku` where `belong` is not null GROUP BY `belong`
|
|
</select>
|
|
|
|
</mapper>
|
|
|