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.
 
 

979 lines
42 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="cc.hiver.mall.dao.mapper.ProductMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.entity.Product">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="product_name" jdbcType="VARCHAR" property="productName"/>
<result column="unit" jdbcType="VARCHAR" property="unit"/>
<result column="shop_id" jdbcType="VARCHAR" property="shopId"/>
<result column="category_id" jdbcType="VARCHAR" property="categoryId"/>
<result column="attr_id" jdbcType="VARCHAR" property="attrId"/>
<result column="attribute_list" jdbcType="VARCHAR" property="attributeList"/>
<result column="supplier_id" jdbcType="VARCHAR" property="supplierId"/>
<result column="supplier_name" jdbcType="VARCHAR" property="supplierName"/>
<result column="product_sn" jdbcType="VARCHAR" property="productSn"/>
<result column="barcode" jdbcType="VARCHAR" property="barcode"/>
<result column="price" jdbcType="DECIMAL" property="price"/>
<result column="purchase_price" jdbcType="DECIMAL" property="purchasePrice"/>
<result column="commission" jdbcType="DECIMAL" property="commission"/>
<result column="wholesale_price" jdbcType="DECIMAL" property="wholesalePrice"/>
<result column="product_picture" jdbcType="VARCHAR" property="productPicture"/>
<result column="product_video" jdbcType="VARCHAR" property="productVideo"/>
<result column="product_intro" jdbcType="VARCHAR" property="productIntro"/>
<result column="sales_week" jdbcType="TIMESTAMP" property="salesWeek"/>
<result column="print_barcode" jdbcType="VARCHAR" property="printBarcode"/>
<result column="tail_warn" jdbcType="INTEGER" property="tailWarn"/>
<result column="in_storage_status" jdbcType="INTEGER" property="inStorageStatus"/>
<result column="customer_category_rule" jdbcType="VARCHAR" property="customerCategoryRule"/>
<result column="attribute_list_price" jdbcType="VARCHAR" property="attributeListPrice"/>
<result column="is_push" jdbcType="INTEGER" property="isPush"/>
<result column="is_must" jdbcType="INTEGER" property="isMust"/>
<result column="order_filed" jdbcType="INTEGER" property="orderFiled"/>
<result column="sell_begin_time" jdbcType="VARCHAR" property="sellBeginTime"/>
<result column="sell_end_time" jdbcType="VARCHAR" property="sellEndTime"/>
<result column="start_pay_num" jdbcType="INTEGER" property="startPayNum"/>
<result column="lunch_box" jdbcType="DECIMAL" property="lunchBox"/>
<result column="is_more_buy" jdbcType="INTEGER" property="isMoreBuy"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, create_by, create_time, del_flag, update_by, update_time, product_name, unit,
shop_id, category_id,attr_id, attribute_list, supplier_id,supplier_name, product_sn, barcode, price, purchase_price,commission,
wholesale_price, product_picture, product_video, product_intro, sales_week, print_barcode,
tail_warn,in_storage_status,customer_category_rule, attribute_list_price, is_push,
is_must, order_filed, sell_begin_time, sell_end_time, start_pay_num, lunch_box, is_more_buy
</sql>
<select id="selectByExample" parameterType="cc.hiver.mall.entity.ProductExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from t_product
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_product
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from t_product
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="cc.hiver.mall.entity.ProductExample">
delete from t_product
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="cc.hiver.mall.entity.Product">
insert into t_product (id, create_by, create_time,
del_flag, update_by, update_time,
product_name, unit, shop_id,
category_id,attr_id, attribute_list, supplier_id,
product_sn, barcode, price,
purchase_price, commission, wholesale_price, product_picture,
product_video, product_intro, sales_week,
print_barcode, tail_warn,in_storage_status,customer_category_rule,
attribute_list_price,is_push,is_must,order_filed,sell_begin_time, sell_end_time
, start_pay_num, lunch_box,is_more_buy)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{productName,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR},
#{categoryId,jdbcType=VARCHAR},#{attrId,jdbcType=VARCHAR}, #{attributeList,jdbcType=VARCHAR}, #{supplierId,jdbcType=VARCHAR},
#{productSn,jdbcType=VARCHAR}, #{barcode,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL},
#{purchasePrice,jdbcType=DECIMAL}, #{commission}, #{wholesalePrice,jdbcType=DECIMAL},
#{productPicture,jdbcType=VARCHAR},
#{productVideo,jdbcType=VARCHAR}, #{productIntro,jdbcType=VARCHAR}, #{salesWeek,jdbcType=TIMESTAMP},
#{printBarcode,jdbcType=VARCHAR}, #{tailWarn,jdbcType=INTEGER}, #{inStorageStatus,jdbcType=INTEGER},
#{customerCategoryRule,jdbcType=VARCHAR},#{attributeListPrice,jdbcType=VARCHAR},
#{isPush,jdbcType=INTEGER}, #{isMust,jdbcType=INTEGER},
#{orderFiled,jdbcType=INTEGER},#{sellBeginTime,jdbcType=VARCHAR},
#{sellEndTime,jdbcType=VARCHAR},#{startPayNum,jdbcType=INTEGER}, #{lunchBox,jdbcType=DECIMAL},#{isMoreBuy,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Product">
insert into t_product
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="productName != null">
product_name,
</if>
<if test="unit != null">
unit,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="categoryId != null">
category_id,
</if>
<if test="attrId != null">
attr_id,
</if>
<if test="attributeList != null">
attribute_list,
</if>
<if test="supplierId != null">
supplier_id,
</if>
<if test="productSn != null">
product_sn,
</if>
<if test="barcode != null">
barcode,
</if>
<if test="price != null">
price,
</if>
<if test="purchasePrice != null">
purchase_price,
</if>
<if test="commission != null">
commission,
</if>
<if test="wholesalePrice != null">
wholesale_price,
</if>
<if test="productPicture != null">
product_picture,
</if>
<if test="productVideo != null">
product_video,
</if>
<if test="productIntro != null">
product_intro,
</if>
<if test="salesWeek != null">
sales_week,
</if>
<if test="printBarcode != null">
print_barcode,
</if>
<if test="tailWarn != null">
tail_warn,
</if>
<if test="inStorageStatus != null">
in_storage_status,
</if>
<if test="customerCategoryRule != null">
customer_category_rule,
</if>
<if test="attributeListPrice != null">
attribute_list_price,
</if>
<if test="isPush != null">
is_push,
</if>
<if test="isMust != null">
is_must
</if>
<if test="orderFiled != null">
order_filed
</if>
<if test="sellBeginTime != null">
sell_begin_time
</if>
<if test="sellEndTime != null">
sell_end_time
</if>
<if test="startPayNum != null">
start_pay_num
</if>
<if test="lunchBox != null">
lunch_box
</if>
<if test="isMoreBuy != null">
is_more_buy
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="productName != null">
#{productName,jdbcType=VARCHAR},
</if>
<if test="unit != null">
#{unit,jdbcType=VARCHAR},
</if>
<if test="shopId != null">
#{shopId,jdbcType=VARCHAR},
</if>
<if test="categoryId != null">
#{categoryId,jdbcType=VARCHAR},
</if>
<if test="attrId != null">
#{attrId,jdbcType=VARCHAR},
</if>
<if test="attributeList != null">
#{attributeList,jdbcType=VARCHAR},
</if>
<if test="supplierId != null">
#{supplierId,jdbcType=VARCHAR},
</if>
<if test="productSn != null">
#{productSn,jdbcType=VARCHAR},
</if>
<if test="barcode != null">
#{barcode,jdbcType=VARCHAR},
</if>
<if test="price != null">
#{price,jdbcType=DECIMAL},
</if>
<if test="purchasePrice != null">
#{purchasePrice,jdbcType=DECIMAL},
</if>
<if test="commission != null">
#{commission},
</if>
<if test="wholesalePrice != null">
#{wholesalePrice,jdbcType=DECIMAL},
</if>
<if test="productPicture != null">
#{productPicture,jdbcType=VARCHAR},
</if>
<if test="productVideo != null">
#{productVideo,jdbcType=VARCHAR},
</if>
<if test="productIntro != null">
#{productIntro,jdbcType=VARCHAR},
</if>
<if test="salesWeek != null">
#{salesWeek,jdbcType=TIMESTAMP},
</if>
<if test="printBarcode != null">
#{printBarcode,jdbcType=VARCHAR},
</if>
<if test="tailWarn != null">
#{tailWarn,jdbcType=INTEGER},
</if>
<if test="inStorageStatus != null">
#{inStorageStatus,jdbcType=INTEGER},
</if>
<if test="customerCategoryRule != null">
#{customerCategoryRule,jdbcType=VARCHAR},
</if>
<if test="attributeListPrice != null">
#{attributeListPrice,jdbcType=VARCHAR},
</if>
<if test="isPush != null">
#{isPush,jdbcType=INTEGER},
</if>
<if test="isMust != null">
#{isMust,jdbcType=INTEGER},
</if>
<if test="orderFiled != null">
#{orderFiled,jdbcType=INTEGER}
</if>
<if test="sellBeginTime != null">
#{sellBeginTime,jdbcType=VARCHAR},
</if>
<if test="sellEndTime != null">
#{sellEndTime,jdbcType=VARCHAR}
</if>
<if test="startPayNum != null">
#{startPayNum,jdbcType=INTEGER},
</if>
<if test="lunchBox != null">
#{lunchBox,jdbcType=DECIMAL}
</if>
<if test="isMoreBuy != null">
#{isMoreBuy,jdbcType=INTEGER}
</if>
</trim>
</insert>
<select id="countByExample" parameterType="cc.hiver.mall.entity.ProductExample" resultType="java.lang.Long">
select count(*) from t_product
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_product
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.delFlag != null">
del_flag = #{record.delFlag,jdbcType=INTEGER},
</if>
<if test="record.updateBy != null">
update_by = #{record.updateBy,jdbcType=VARCHAR},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.productName != null">
product_name = #{record.productName,jdbcType=VARCHAR},
</if>
<if test="record.unit != null">
unit = #{record.unit,jdbcType=VARCHAR},
</if>
<if test="record.shopId != null">
shop_id = #{record.shopId,jdbcType=VARCHAR},
</if>
<if test="record.categoryId != null">
category_id = #{record.categoryId,jdbcType=VARCHAR},
</if>
<if test="record.attrId != null">
attr_id = #{record.attrId,jdbcType=VARCHAR},
</if>
<if test="record.attributeList != null">
attribute_list = #{record.attributeList,jdbcType=VARCHAR},
</if>
<if test="record.supplierId != null">
supplier_id = #{record.supplierId,jdbcType=VARCHAR},
</if>
<if test="record.productSn != null">
product_sn = #{record.productSn,jdbcType=VARCHAR},
</if>
<if test="record.barcode != null">
barcode = #{record.barcode,jdbcType=VARCHAR},
</if>
<if test="record.price != null">
price = #{record.price,jdbcType=DECIMAL},
</if>
<if test="record.purchasePrice != null">
purchase_price = #{record.purchasePrice,jdbcType=DECIMAL},
</if>
<if test="record.commission != null">
commission = #{record.commission,jdbcType=DECIMAL},
</if>
<if test="record.wholesalePrice != null">
wholesale_price = #{record.wholesalePrice,jdbcType=DECIMAL},
</if>
<if test="record.productPicture != null">
product_picture = #{record.productPicture,jdbcType=VARCHAR},
</if>
<if test="record.productVideo != null">
product_video = #{record.productVideo,jdbcType=VARCHAR},
</if>
<if test="record.productIntro != null">
product_intro = #{record.productIntro,jdbcType=VARCHAR},
</if>
<if test="record.salesWeek != null">
sales_week = #{record.salesWeek,jdbcType=TIMESTAMP},
</if>
<if test="record.printBarcode != null">
print_barcode = #{record.printBarcode,jdbcType=VARCHAR},
</if>
<if test="record.tailWarn != null">
tail_warn = #{record.tailWarn,jdbcType=INTEGER},
</if>
<if test="record.inStorageStatus != null">
in_storage_status = #{record.inStorageStatus,jdbcType=INTEGER},
</if>
<if test="record.customerCategoryRule != null">
customer_category_rule = #{record.customerCategoryRule,jdbcType=VARCHAR},
</if>
<if test="record.attributeListPrice != null">
attribute_list_price = #{record.attributeListPrice,jdbcType=VARCHAR},
</if>
<if test="record.isPush != null">
is_push = #{record.isPush,jdbcType=INTEGER},
</if>
<if test="record.isMust != null">
is_must = #{record.isMust,jdbcType=INTEGER},
</if>
<if test="record.orderFiled != null">
order_filed = #{record.orderFiled,jdbcType=INTEGER}
</if>
<if test="record.sellBeginTime != null">
sell_begin_time = #{record.sellBeginTime,jdbcType=VARCHAR},
</if>
<if test="record.sellEndTime != null">
sell_end_time = #{record.sellEndTime,jdbcType=VARCHAR}
</if>
<if test="record.startPayNum != null">
start_pay_num = #{record.startPayNum,jdbcType=INTEGER},
</if>
<if test="record.lunchBox != null">
lunch_box = #{record.lunchBox,jdbcType=DECIMAL}
</if>
<if test="record.lunchBox != null">
is_more_buy = #{isMoreBuy,jdbcType=INTEGER}
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_product
set id = #{record.id,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
del_flag = #{record.delFlag,jdbcType=INTEGER},
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
product_name = #{record.productName,jdbcType=VARCHAR},
unit = #{record.unit,jdbcType=VARCHAR},
shop_id = #{record.shopId,jdbcType=VARCHAR},
category_id = #{record.categoryId,jdbcType=VARCHAR},
attr_id = #{record.attrId,jdbcType=VARCHAR},
attribute_list = #{record.attributeList,jdbcType=VARCHAR},
supplier_id = #{record.supplierId,jdbcType=VARCHAR},
product_sn = #{record.productSn,jdbcType=VARCHAR},
barcode = #{record.barcode,jdbcType=VARCHAR},
price = #{record.price,jdbcType=DECIMAL},
purchase_price = #{record.purchasePrice,jdbcType=DECIMAL},
commission = #{record.commission,jdbcType=DECIMAL},
wholesale_price = #{record.wholesalePrice,jdbcType=DECIMAL},
product_picture = #{record.productPicture,jdbcType=VARCHAR},
product_video = #{record.productVideo,jdbcType=VARCHAR},
product_intro = #{record.productIntro,jdbcType=VARCHAR},
sales_week = #{record.salesWeek,jdbcType=TIMESTAMP},
print_barcode = #{record.printBarcode,jdbcType=VARCHAR},
tail_warn = #{record.tailWarn,jdbcType=INTEGER},
in_storage_status = #{record.inStorageStatus,jdbcType=INTEGER},
customer_category_rule = #{record.customerCategoryRule,jdbcType=VARCHAR},
attribute_list_price = #{record.attributeListPrice,jdbcType=VARCHAR},
is_push = #{record.isPush,jdbcType=INTEGER},
is_must = #{record.isMust,jdbcType=INTEGER},
order_filed = #{record.orderFiled,jdbcType=INTEGER},
sell_begin_time = #{record.sellBeginTime,jdbcType=VARCHAR},
sell_end_time = #{record.sellEndTime,jdbcType=VARCHAR},
start_pay_num = #{record.startPayNum,jdbcType=INTEGER},
lunch_box = #{record.lunchBox,jdbcType=DECIMAL},
is_more_buy = #{isMoreBuy,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.Product">
update t_product
<set>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="productName != null">
product_name = #{productName,jdbcType=VARCHAR},
</if>
<if test="unit != null">
unit = #{unit,jdbcType=VARCHAR},
</if>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=VARCHAR},
</if>
<if test="categoryId != null">
category_id = #{categoryId,jdbcType=VARCHAR},
</if>
<if test="attrId != null">
attr_id = #{attrId,jdbcType=VARCHAR},
</if>
<if test="attributeList != null">
attribute_list = #{attributeList,jdbcType=VARCHAR},
</if>
<if test="supplierId != null">
supplier_id = #{supplierId,jdbcType=VARCHAR},
</if>
<if test="productSn != null">
product_sn = #{productSn,jdbcType=VARCHAR},
</if>
<if test="barcode != null">
barcode = #{barcode,jdbcType=VARCHAR},
</if>
<if test="price != null">
price = #{price,jdbcType=DECIMAL},
</if>
<if test="purchasePrice != null">
purchase_price = #{purchasePrice,jdbcType=DECIMAL},
</if>
<if test="commission != null">
commission = #{commission,jdbcType=DECIMAL},
</if>
<if test="wholesalePrice != null">
wholesale_price = #{wholesalePrice,jdbcType=DECIMAL},
</if>
<if test="productPicture != null">
product_picture = #{productPicture,jdbcType=VARCHAR},
</if>
<if test="productVideo != null">
product_video = #{productVideo,jdbcType=VARCHAR},
</if>
<if test="productIntro != null">
product_intro = #{productIntro,jdbcType=VARCHAR},
</if>
<if test="salesWeek != null">
sales_week = #{salesWeek,jdbcType=TIMESTAMP},
</if>
<if test="printBarcode != null">
print_barcode = #{printBarcode,jdbcType=VARCHAR},
</if>
<if test="tailWarn != null">
tail_warn = #{tailWarn,jdbcType=INTEGER},
</if>
<if test="inStorageStatus != null">
in_storage_status = #{inStorageStatus,jdbcType=INTEGER},
</if>
<if test="customerCategoryRule != null">
customer_category_rule = #{customerCategoryRule,jdbcType=VARCHAR},
</if>
<if test="attributeListPrice != null">
attribute_list_price = #{attributeListPrice,jdbcType=VARCHAR},
</if>
<if test="isPush != null">
is_push = #{isPush,jdbcType=INTEGER},
</if>
<if test="isMust != null">
is_must = #{isMust,jdbcType=INTEGER},
</if>
<if test="orderFiled != null">
order_filed = #{orderFiled,jdbcType=INTEGER}
</if>
<if test="sellBeginTime != null">
sell_begin_time = #{sellBeginTime,jdbcType=VARCHAR},
</if>
<if test="sellEndTime != null">
sell_end_time = #{sellEndTime,jdbcType=VARCHAR},
</if>
<if test="startPayNum != null">
start_pay_num = #{startPayNum,jdbcType=INTEGER},
</if>
<if test="lunchBox != null">
lunch_box = #{lunchBox,jdbcType=DECIMAL}
</if>
<if test="isMoreBuy != null">
is_more_buy = #{isMoreBuy,jdbcType=INTEGER}
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.entity.Product">
update t_product
set create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
product_name = #{productName,jdbcType=VARCHAR},
unit = #{unit,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=VARCHAR},
category_id = #{categoryId,jdbcType=VARCHAR},
attr_id = #{attrId,jdbcType=VARCHAR},
attribute_list = #{attributeList,jdbcType=VARCHAR},
supplier_id = #{supplierId,jdbcType=VARCHAR},
product_sn = #{productSn,jdbcType=VARCHAR},
barcode = #{barcode,jdbcType=VARCHAR},
price = #{price,jdbcType=DECIMAL},
purchase_price = #{purchasePrice,jdbcType=DECIMAL},
commission = #{commission,jdbcType=DECIMAL},
wholesale_price = #{wholesalePrice,jdbcType=DECIMAL},
product_picture = #{productPicture,jdbcType=VARCHAR},
product_video = #{productVideo,jdbcType=VARCHAR},
product_intro = #{productIntro,jdbcType=VARCHAR},
sales_week = #{salesWeek,jdbcType=TIMESTAMP},
print_barcode = #{printBarcode,jdbcType=VARCHAR},
tail_warn = #{tailWarn,jdbcType=INTEGER},
in_storage_status = #{inStorageStatus,jdbcType=INTEGER},
customer_category_rule = #{customerCategoryRule,jdbcType=VARCHAR},
attribute_list_price = #{attributeListPrice,jdbcType=VARCHAR},
is_push = #{isPush,jdbcType=INTEGER},
is_must = #{isMust,jdbcType=INTEGER},
order_filed = #{orderFiled,jdbcType=INTEGER},
sell_begin_time = #{sellBeginTime,jdbcType=VARCHAR},
sell_end_time = #{sellEndTime,jdbcType=VARCHAR},
start_pay_num = #{startPayNum,jdbcType=INTEGER},
lunch_box = #{lunchBox,jdbcType=DECIMAL},
is_more_buy = #{isMoreBuy,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
<!--管理商品分页列表-->
<select id="getShareList" resultType="cc.hiver.mall.pojo.vo.ProductPageVO">
SELECT
t.id,
t.create_by,
t.create_time,
t.del_flag,
t.update_by,
t.update_time,
t.product_name,
t.unit,
t.shop_id,
t.category_id,
t.attr_id,
t.attribute_list,
t.supplier_id,
t.supplier_name,
t.product_sn,
t.barcode,
t.price,
t.purchase_price,
t.commission,
t.wholesale_price,
t.product_picture,
t.product_video,
t.product_intro,
t.sales_week,
t.print_barcode,
t.tail_warn,
t.in_storage_status,
t.customer_category_rule,
t.attribute_list_price,
t.is_push,
t.is_must,
t.order_filed,
t.sell_begin_time,
t.sell_end_time,
t.start_pay_num,
t.lunch_box,
t.is_more_buy
FROM t_product t
<where>
t.del_flag != 2
<!--店铺id-->
<if test='queryParams.shopId!=null and queryParams.shopId.trim() neq ""'>
AND t.shop_id = #{queryParams.shopId}
</if>
<!--上下架状态-->
<if test='queryParams.delFlag!=null'>
AND t.del_flag = #{queryParams.delFlag}
</if>
<!--查询加料的-->
<if test='queryParams.isMoreBuy!=null'>
AND t.is_more_buy = #{queryParams.isMoreBuy}
</if>
<if test='queryParams.isPush!=null'>
AND t.is_push = #{queryParams.isPush}
</if>
<if test='queryParams.isMust!=null'>
AND t.is_must = #{queryParams.isMust}
</if>
<!--分类id-->
<if test='queryParams.categoryId!=null and queryParams.categoryId.trim() neq ""'>
AND t.category_id =#{queryParams.categoryId}
</if>
<!--商品名称-->
<if test='queryParams.productName!=null and queryParams.productName.trim() neq ""'>
AND t.product_name like concat('%',#{queryParams.productName},'%')
</if>
<if test='queryParams.idList!=null '>
and t.id in
<foreach item="item" index="index" collection="queryParams.idList" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test='queryParams.shopIdList!=null '>
and t.shop_id in
<foreach item="item" index="index" collection="queryParams.shopIdList" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="queryParams.searchStr != null and queryParams.searchStr != ''">
and (
t.product_name like concat('%',#{queryParams.searchStr},'%')
)
</if>
</where>
ORDER BY t.order_filed desc,
<!--销量排序
<if test='queryParams.startDate !=null and queryParams.startDate.trim() neq "" and queryParams.endDate !=null and queryParams.endDate.trim() neq ""'>
<if test='queryParams.sortField!=null and queryParams.sortField.trim() neq "" and queryParams.sortField eq "totalSold"'>
sd.total_sold desc,
</if>
</if>-->
<!-- 如果sort字段为stockCount,则按照total_stock_count库存数排序
<if test='queryParams.sort !=null and queryParams.sort.trim() eq "stockCount" and queryParams.order !=null and queryParams.order.trim() neq "" '>
<if test='queryParams.order.trim() eq "desc" '>
total_stock_count desc ,
</if>
<if test='queryParams.order.trim() eq "asc" '>
total_stock_count asc ,
</if>
</if> -->
t.in_storage_status asc, t.del_flag desc,t.create_time desc, id
</select>
<select id="getProductList" resultType="cc.hiver.mall.entity.Product">
select
<include refid="Base_Column_List"/>
from t_product
<where>
and id in
<foreach item="item" index="index" collection="productIdList" open="(" close=")" separator=",">
#{item}
</foreach>
</where>
ORDER BY
create_time desc
</select>
<select id="getProductListOfShop" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_product
<where>
<!--查询为上架和未上架的-->
and del_flag != '2'
and shop_id = #{shopId,jdbcType=VARCHAR}
</where>
ORDER BY
create_time desc
</select>
<select id="getByProductSn" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_product
where upper(product_sn) = upper(#{productSn,jdbcType=VARCHAR})
and shop_id = #{shopId,jdbcType=VARCHAR}
<!--查询为上架和未上架的-->
and del_flag != '2'
</select>
<select id="getByBarcode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_product
where barcode = #{barcode,jdbcType=VARCHAR}
and shop_id = #{shopId,jdbcType=VARCHAR}
<!--查询为上架和未上架的-->
and del_flag != '2'
</select>
<select id="getByUserIdAndProductId" resultType="cc.hiver.mall.pojo.vo.ProductLastBuyVo">
SELECT
s.sale_id,t.create_time,s.product_id,s.discount_amount,sum(s.product_count) as product_count
FROM
t_sale t
LEFT JOIN t_sale_detail s ON t.id = s.sale_id
WHERE
s.product_id = #{productId,jdbcType=VARCHAR}
AND t.user_id = #{userId,jdbcType=VARCHAR}
group by s.product_id,s.sale_id,s.discount_amount
order by t.create_time desc
limit 1
</select>
<select id="getByUserIdAndProductIds" resultType="cc.hiver.mall.pojo.vo.ProductLastBuyVo">
select MAX(tt.discount_amount) as discount_amount, tt.product_id from t_sale_detail tt,
(SELECT
MAX(s.create_time) as create_time,s.product_id
FROM
t_sale t
LEFT JOIN t_sale_detail s ON t.id = s.sale_id
WHERE
s.product_id IN
<foreach item="productId" index="index" collection="array" open="(" separator="," close=")">
#{productId}
</foreach>
AND t.user_id = #{userId,jdbcType=VARCHAR}
GROUP BY
s.product_id) aa
where tt.create_time = aa.create_time and tt.product_id = aa.product_id GROUP BY tt.product_id
</select>
<select id="getByIdOrBrcode" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_product
where id = #{id,jdbcType=VARCHAR} or barcode =#{id,jdbcType=VARCHAR}
</select>
<select id="getProductSaleCount" parameterType="java.lang.String" resultType="java.lang.Integer">
select SUM(dd.product_count) from t_sale_detail dd
right join t_sale aa on aa.id = dd.sale_id and aa.status = 4 where dd.product_id = #{id,jdbcType=VARCHAR}
</select>
<select id="getProductByProductSnList" resultType="cc.hiver.mall.entity.Product">
select
<include refid="Base_Column_List"/>
from t_product
<where>
and shop_id = #{shopId}
and del_flag != 2
and product_sn in
<foreach item="item" index="index" collection="productSnList" open="(" close=")" separator=",">
#{item}
</foreach>
</where>
ORDER BY
create_time desc
</select>
<select id="getProductByProductNameList" resultType="cc.hiver.mall.entity.Product">
select
<include refid="Base_Column_List"/>
from t_product
<where>
and shop_id = #{shopId}
and del_flag != 2
and product_name in
<foreach item="item" index="index" collection="productNameList" open="(" close=")" separator=",">
#{item}
</foreach>
</where>
ORDER BY
create_time desc
</select>
<!-- 删除分类时,根据分类id删除商品信息-->
<update id="deleteProductByCategoryId" parameterType="java.lang.String">
update t_product
set del_flag = 2
where category_id = #{categoryId,jdbcType=VARCHAR}
</update>
<!--批量新增商品子图-->
<insert id="batchSaveProduct" parameterType="java.util.List">
insert into t_product (id, create_by, create_time, del_flag, update_by, update_time, product_name, unit,
shop_id, category_id,attr_id, attribute_list, supplier_id,supplier_name, product_sn, barcode, price, purchase_price,commission,
wholesale_price, product_picture, product_video, product_intro, sales_week, print_barcode,
tail_warn,in_storage_status) values
<foreach item="product" collection="addProductList" index="index" separator=",">
(#{product.id,jdbcType=VARCHAR},#{product.createBy,jdbcType=VARCHAR},#{product.createTime,jdbcType=TIMESTAMP},
#{product.delFlag,jdbcType=INTEGER},#{product.updateBy,jdbcType=VARCHAR},#{product.updateTime,jdbcType=TIMESTAMP},
#{product.productName,jdbcType=VARCHAR},#{product.unit,jdbcType=VARCHAR},#{product.shopId,jdbcType=VARCHAR},
#{product.categoryId,jdbcType=VARCHAR},#{product.attrId,jdbcType=VARCHAR},#{product.attributeList,jdbcType=VARCHAR},
#{product.supplierId,jdbcType=VARCHAR},#{product.supplierName,jdbcType=VARCHAR},#{product.productSn,jdbcType=VARCHAR},
#{product.barcode,jdbcType=VARCHAR},#{product.price,jdbcType=DECIMAL},#{product.purchasePrice,jdbcType=DECIMAL},#{product.commission,jdbcType=DECIMAL},
#{product.wholesalePrice,jdbcType=DECIMAL},#{product.productPicture,jdbcType=VARCHAR},#{product.productVideo,jdbcType=VARCHAR},
#{product.productIntro,jdbcType=VARCHAR},#{product.salesWeek,jdbcType=DATE},#{product.printBarcode,jdbcType=VARCHAR},
#{product.tailWarn,jdbcType=INTEGER},#{product.inStorageStatus,jdbcType=INTEGER})
</foreach>
</insert>
<update id="batchUpdateDelFlag" >
update t_product
set del_flag = #{delFlag,jdbcType=INTEGER}
where id in
<foreach close=")" collection="idList" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</update>
<update id="batchUpdatePurchasePrice" >
<foreach collection="productList" item="item" separator=";" open="" close="">
update t_product set purchase_price = #{item.purchasePrice} WHERE id = #{item.id}
</foreach>
</update>
</mapper>