cashier-client/src/main/resources/mapper/TbProskuConMapper.xml

142 lines
5.1 KiB
XML

<?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.chaozhanggui.system.cashierservice.dao.TbProskuConMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="product_id" jdbcType="INTEGER" property="productId" />
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_prosku_con
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_prosku_con
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con (id, shop_id, product_sku_id,
con_info_id, surplus_stock, status,
create_time)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="productSkuId != null">
product_sku_id,
</if>
<if test="conInfoId != null">
con_info_id,
</if>
<if test="surplusStock != null">
surplus_stock,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="shopId != null">
#{shopId,jdbcType=INTEGER},
</if>
<if test="productSkuId != null">
#{productSkuId,jdbcType=INTEGER},
</if>
<if test="conInfoId != null">
#{conInfoId,jdbcType=INTEGER},
</if>
<if test="surplusStock != null">
#{surplusStock,jdbcType=DECIMAL},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
update tb_prosku_con
<set>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=INTEGER},
</if>
<if test="productSkuId != null">
product_sku_id = #{productSkuId,jdbcType=INTEGER},
</if>
<if test="conInfoId != null">
con_info_id = #{conInfoId,jdbcType=INTEGER},
</if>
<if test="surplusStock != null">
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
update tb_prosku_con
set shop_id = #{shopId,jdbcType=INTEGER},
product_sku_id = #{productSkuId,jdbcType=INTEGER},
con_info_id = #{conInfoId,jdbcType=INTEGER},
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
status = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
</select>
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
SELECT
p.con_info_id
FROM
tb_prosku_con p
WHERE
p.shop_id = #{shopId}
AND p.product_sku_id = #{skuId}
AND p.`status` = 1
group by p.con_info_id
</select>
<select id="selectByShopIdAndSkuIdAndProductId" resultMap="BaseResultMap">
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
</select>
</mapper>