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.

138 lines
7.2 KiB

2 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.checkstock.mapper.CheckStockDetailMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.checkstock.entity.CheckStockDetail">
<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="check_stock_id" jdbcType="VARCHAR" property="checkStockId" />
<result column="product_id" jdbcType="VARCHAR" property="productId" />
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<result column="product_picture" jdbcType="VARCHAR" property="productPicture" />
<result column="product_sn" jdbcType="VARCHAR" property="productSn" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="attribute_list" jdbcType="VARCHAR" property="attributeList" />
<result column="pd_num" jdbcType="INTEGER" property="pdNum" />
<result column="change_count" jdbcType="INTEGER" property="changeCount" />
<result column="stock_count" jdbcType="INTEGER" property="stockCount" />
</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, check_stock_id, product_id, product_name,
product_picture, product_sn, shop_id, attribute_list, pd_num, change_count, stock_count
</sql>
<insert id="batchInsertCheckStock" parameterType="java.util.List">
insert into t_check_stock_detail (id, create_by, create_time, del_flag, update_by, update_time, check_stock_id, product_id, product_name,
product_picture, product_sn, shop_id, attribute_list, pd_num, change_count, stock_count)
values
<foreach collection="checkStockDetailList" item="checkStockDetail" separator=",">
(#{checkStockDetail.id},#{checkStockDetail.createBy},#{checkStockDetail.createTime},#{checkStockDetail.delFlag},
#{checkStockDetail.updateBy},#{checkStockDetail.updateTime},#{checkStockDetail.checkStockId},#{checkStockDetail.productId},#{checkStockDetail.productName},
#{checkStockDetail.productPicture},#{checkStockDetail.productSn},#{checkStockDetail.shopId},#{checkStockDetail.attributeList},#{checkStockDetail.pdNum},
#{checkStockDetail.changeCount},#{checkStockDetail.stockCount})
2 years ago
</foreach>
</insert>
<select id="getByCheckStockDetailByCheckId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_check_stock_detail
where check_stock_id = #{checkStockId,jdbcType=VARCHAR}
</select>
<select id="getByCheckStockDetailByCheckIdOfPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_check_stock_detail
where check_stock_id = #{checkStockPageQuery.checkStockId,jdbcType=VARCHAR}
and product_id in
<foreach item="productId" collection="checkStockPageQuery.productIdList" open="(" separator="," close=")">
#{productId}
</foreach>
</select>
<select id="getByCheckStockProductByCheckId" resultType="java.lang.String">
SELECT
product_id
FROM
t_check_stock_detail
WHERE
check_stock_id = #{checkStockPageQuery.checkStockId,jdbcType=VARCHAR}
GROUP BY
product_id
order by product_id
</select>
<delete id="deleteByProductId" parameterType="java.lang.String">
delete
from t_check_stock_detail
where shop_id = #{shopId,jdbcType=VARCHAR}
and check_stock_id = #{checkStockId,jdbcType=VARCHAR}
and product_id = #{productId,jdbcType=VARCHAR}
</delete>
2 years ago
</mapper>