<?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.StockMapper" >
<resultMap id= "BaseResultMap" type= "cc.hiver.mall.entity.Stock" >
<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_id" jdbcType= "VARCHAR" property= "productId" />
<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= "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= "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= "stock_count" jdbcType= "INTEGER" property= "stockCount" />
<result column= "stock_warn_count" jdbcType= "INTEGER" property= "stockWarnCount" />
<result column= "tail_warn" jdbcType= "INTEGER" property= "tailWarn" />
</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_id, product_name,
unit, shop_id, category_id, attribute_list, supplier_id,supplier_name, product_sn, barcode, price,
purchase_price, wholesale_price, product_picture, product_video, product_intro, sales_week,
print_barcode, stock_count, stock_warn_count, tail_warn
</sql>
<select id= "selectByExample" parameterType= "cc.hiver.mall.entity.StockExample" resultMap= "BaseResultMap" >
select
<if test= "distinct" >
distinct
</if>
<include refid= "Base_Column_List" />
from t_stock
<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_stock
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id= "deleteByPrimaryKey" parameterType= "java.lang.String" >
delete from t_stock
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id= "deleteByExample" parameterType= "cc.hiver.mall.entity.StockExample" >
delete from t_stock
<if test= "_parameter != null" >
<include refid= "Example_Where_Clause" />
</if>
</delete>
<insert id= "insert" parameterType= "cc.hiver.mall.entity.Stock" >
insert into t_stock (id, create_by, create_time,
del_flag, update_by, update_time,
product_id, product_name, unit,
shop_id, category_id, attribute_list,
supplier_id,supplier_name, product_sn, barcode,
price, purchase_price, wholesale_price,
product_picture, product_video, product_intro,
sales_week, print_barcode, stock_count,
stock_warn_count, tail_warn)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{productId,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
#{shopId,jdbcType=VARCHAR}, #{categoryId,jdbcType=VARCHAR}, #{attributeList,jdbcType=VARCHAR},
#{supplierId,jdbcType=VARCHAR},#{supplierName,jdbcType=VARCHAR}, #{productSn,jdbcType=VARCHAR}, #{barcode,jdbcType=VARCHAR},
#{price,jdbcType=DECIMAL}, #{purchasePrice,jdbcType=DECIMAL}, #{wholesalePrice,jdbcType=DECIMAL},
#{productPicture,jdbcType=VARCHAR}, #{productVideo,jdbcType=VARCHAR}, #{productIntro,jdbcType=VARCHAR},
#{salesWeek,jdbcType=TIMESTAMP}, #{printBarcode,jdbcType=VARCHAR}, #{stockCount,jdbcType=INTEGER},
#{stockWarnCount,jdbcType=INTEGER}, #{tailWarn,jdbcType=INTEGER})
</insert>
<insert id= "insertSelective" parameterType= "cc.hiver.mall.entity.Stock" >
insert into t_stock
<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= "productId != null" >
product_id,
</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= "attributeList != null" >
attribute_list,
</if>
<if test= "supplierId != null" >
supplier_id,
</if>
<if test= "supplierName != null" >
supplier_name,
</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= "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= "stockCount != null" >
stock_count,
</if>
<if test= "stockWarnCount != null" >
stock_warn_count,
</if>
<if test= "tailWarn != null" >
tail_warn,
</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= "productId != null" >
#{productId,jdbcType=VARCHAR},
</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= "attributeList != null" >
#{attributeList,jdbcType=VARCHAR},
</if>
<if test= "supplierId != null" >
#{supplierId,jdbcType=VARCHAR},
</if>
<if test= "supplierName != null" >
#{supplierName,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= "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= "stockCount != null" >
#{stockCount,jdbcType=INTEGER},
</if>
<if test= "stockWarnCount != null" >
#{stockWarnCount,jdbcType=INTEGER},
</if>
<if test= "tailWarn != null" >
#{tailWarn,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id= "countByExample" parameterType= "cc.hiver.mall.entity.StockExample" resultType= "java.lang.Long" >
select count(*) from t_stock
<if test= "_parameter != null" >
<include refid= "Example_Where_Clause" />
</if>
</select>
<update id= "updateByExampleSelective" parameterType= "map" >
update t_stock
<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.productId != null" >
product_id = #{record.productId,jdbcType=VARCHAR},
</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.attributeList != null" >
attribute_list = #{record.attributeList,jdbcType=VARCHAR},
</if>
<if test= "record.supplierId != null" >
supplier_id = #{record.supplierId,jdbcType=VARCHAR},
</if>
<if test= "record.supplierName != null" >
supplier_name = #{record.supplierName,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.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.stockCount != null" >
stock_count = #{record.stockCount,jdbcType=INTEGER},
</if>
<if test= "record.stockWarnCount != null" >
stock_warn_count = #{record.stockWarnCount,jdbcType=INTEGER},
</if>
<if test= "record.tailWarn != null" >
tail_warn = #{record.tailWarn,jdbcType=INTEGER},
</if>
</set>
<if test= "_parameter != null" >
<include refid= "Update_By_Example_Where_Clause" />
</if>
</update>
<update id= "updateByExample" parameterType= "map" >
update t_stock
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_id = #{record.productId,jdbcType=VARCHAR},
product_name = #{record.productName,jdbcType=VARCHAR},
unit = #{record.unit,jdbcType=VARCHAR},
shop_id = #{record.shopId,jdbcType=VARCHAR},
category_id = #{record.categoryId,jdbcType=VARCHAR},
attribute_list = #{record.attributeList,jdbcType=VARCHAR},
supplier_id = #{record.supplierId,jdbcType=VARCHAR},
supplier_name = #{record.supplierName,jdbcType=VARCHAR},
product_sn = #{record.productSn,jdbcType=VARCHAR},
barcode = #{record.barcode,jdbcType=VARCHAR},
price = #{record.price,jdbcType=DECIMAL},
purchase_price = #{record.purchasePrice,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},
stock_count = #{record.stockCount,jdbcType=INTEGER},
stock_warn_count = #{record.stockWarnCount,jdbcType=INTEGER},
tail_warn = #{record.tailWarn,jdbcType=INTEGER}
<if test= "_parameter != null" >
<include refid= "Update_By_Example_Where_Clause" />
</if>
</update>
<update id= "updateByPrimaryKeySelective" parameterType= "cc.hiver.mall.entity.Stock" >
update t_stock
<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= "productId != null" >
product_id = #{productId,jdbcType=VARCHAR},
</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= "attributeList != null" >
attribute_list = #{attributeList,jdbcType=VARCHAR},
</if>
<if test= "supplierId != null" >
supplier_id = #{supplierId,jdbcType=VARCHAR},
</if>
<if test= "supplierName != null" >
supplier_name = #{supplierName,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= "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= "stockCount != null" >
stock_count = #{stockCount,jdbcType=INTEGER},
</if>
<if test= "stockWarnCount != null" >
stock_warn_count = #{stockWarnCount,jdbcType=INTEGER},
</if>
<if test= "tailWarn != null" >
tail_warn = #{tailWarn,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id= "updateByPrimaryKey" parameterType= "cc.hiver.mall.entity.Stock" >
update t_stock
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_id = #{productId,jdbcType=VARCHAR},
product_name = #{productName,jdbcType=VARCHAR},
unit = #{unit,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=VARCHAR},
category_id = #{categoryId,jdbcType=VARCHAR},
attribute_list = #{attributeList,jdbcType=VARCHAR},
supplier_id = #{supplierId,jdbcType=VARCHAR},
supplier_name = #{supplierName,jdbcType=VARCHAR},
product_sn = #{productSn,jdbcType=VARCHAR},
barcode = #{barcode,jdbcType=VARCHAR},
price = #{price,jdbcType=DECIMAL},
purchase_price = #{purchasePrice,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},
stock_count = #{stockCount,jdbcType=INTEGER},
stock_warn_count = #{stockWarnCount,jdbcType=INTEGER},
tail_warn = #{tailWarn,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id= "stockListOfShop" parameterType= "java.lang.String" resultMap= "BaseResultMap" >
select
s.id, s.create_by, s.create_time, s.del_flag, s.update_by, s.update_time, s.product_id, s.product_name,
s.unit, s.shop_id, s.category_id, s.attribute_list, s.supplier_id, s.supplier_name, s.product_sn, s.barcode, s.price,
s.purchase_price, s.wholesale_price, s.product_picture, s.product_video, s.product_intro, s.sales_week,
s.print_barcode, s.stock_count, s.stock_warn_count, s.tail_warn
from t_stock s
right join t_product t
on s.product_id = t.id
and t.del_flag != 2
<where >
and s.shop_id = #{shopId,jdbcType=VARCHAR}
</where>
ORDER BY
s.create_time desc
</select>
<select id= "productCount" parameterType= "java.lang.String" resultType= "java.lang.String" >
select
stock_count
from t_stock
<where >
and product_id = #{productId,jdbcType=VARCHAR}
and attribute_list = #{attributeList,jdbcType=VARCHAR}
</where>
</select>
<select id= "getlistByAttributeList" resultType= "cc.hiver.mall.pojo.vo.ProductCategoryStockVo" >
select
product_name,attribute_list,stock_count
from t_stock
<where >
and category_id = #{id,jdbcType=VARCHAR}
and shop_id = #{shopId,jdbcType=VARCHAR}
and stock_count != '0'
<if test= "attributeList != null and attributeList !=''" >
and attribute_list like concat('%',#{attributeList,jdbcType=VARCHAR},'%')
</if>
</where>
ORDER BY
attribute_list desc
</select>
<select id= "getTailWarnProduct" resultMap= "BaseResultMap" >
SELECT
s.product_id,
s.product_name,
s.product_sn,
p.product_picture,
p.print_barcode,
s.attribute_list,
s.stock_count,
p.tail_warn
FROM
t_stock s
right join t_product p
ON s.product_id = p.id
and p.del_flag != 2
where s.shop_id= #{stockPageQuery.shopId,jdbcType=VARCHAR}
and s.stock_count < p.tail_warn
<if test= "stockPageQuery.searchStr != null and stockPageQuery.searchStr !=''" >
and (s.product_name like concat('%',#{stockPageQuery.searchStr,jdbcType=VARCHAR},'%')
or s.product_sn like concat('%',#{stockPageQuery.searchStr,jdbcType=VARCHAR},'%')
)
</if>
order by s.product_name
</select>
<select id= "getProductStock" resultMap= "BaseResultMap" >
SELECT
s.product_id,
s.product_name,
s.product_sn,
s.attribute_list,
s.stock_count
FROM
t_stock s
where s.product_id= #{productId,jdbcType=VARCHAR}
</select>
<select id= "getProductsStock" resultMap= "BaseResultMap" >
SELECT
<include refid= "Base_Column_List" />
FROM
t_stock s
where s.product_id in
<foreach item= "item" index= "index" collection= "productIds" open= "(" close= ")" separator= "," >
#{item}
</foreach>
</select>
<update id= "putInUpdatePurchasePrice" >
<foreach collection= "purchaseDetails" item= "item" separator= ";" open= "" close= "" >
update t_stock set purchase_price = #{item.purchasePrice},supplier_id = #{item.supplierId},supplier_name = #{item.supplierName} WHERE product_id = #{item.productId} and purchase_price is null
</foreach>
</update>
<select id= "getByProductIdAndAttributeList" parameterType= "java.lang.String" resultMap= "BaseResultMap" >
select
<include refid= "Base_Column_List" />
from t_stock
<where >
and product_id = #{productId,jdbcType=VARCHAR}
and attribute_list = #{attributeList,jdbcType=VARCHAR}
</where>
</select>
</mapper>