Files
cashier-client/src/main/resources/mapper/ShopUserDutyDetailMapper.xml
韩鹏辉 b96a251fd8 提交
2024-03-21 10:17:54 +08:00

147 lines
6.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.ShopUserDutyDetailMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.ShopUserDutyDetail">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="duty_id" jdbcType="INTEGER" property="dutyId"/>
<result column="product_id" jdbcType="INTEGER" property="productId"/>
<result column="product_name" jdbcType="VARCHAR" property="productName"/>
<result column="sku_id" jdbcType="INTEGER" property="skuId"/>
<result column="sku_name" jdbcType="VARCHAR" property="skuName"/>
<result column="num" jdbcType="INTEGER" property="num"/>
<result column="amount" jdbcType="DECIMAL" property="amount"/>
</resultMap>
<sql id="Base_Column_List">
id, duty_id, product_id, product_name, sku_id, sku_name, num, amount
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tb_shop_user_duty_detail
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByDuctId" resultType="com.chaozhanggui.system.cashierservice.entity.ShopUserDutyDetail">
select * from tb_shop_user_duty_detail where duty_id = #{id} and sku_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectAllByDuctId"
resultType="com.chaozhanggui.system.cashierservice.entity.ShopUserDutyDetail">
select * from tb_shop_user_duty_detail where duty_id = #{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_shop_user_duty_detail
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.ShopUserDutyDetail">
insert into tb_shop_user_duty_detail (id, duty_id, product_id,
product_name, sku_id, sku_name,
num, amount)
values (#{id,jdbcType=INTEGER}, #{dutyId,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER},
#{productName,jdbcType=VARCHAR}, #{skuId,jdbcType=INTEGER}, #{skuName,jdbcType=VARCHAR},
#{num,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.ShopUserDutyDetail">
insert into tb_shop_user_duty_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="dutyId != null">
duty_id,
</if>
<if test="productId != null">
product_id,
</if>
<if test="productName != null">
product_name,
</if>
<if test="skuId != null">
sku_id,
</if>
<if test="skuName != null">
sku_name,
</if>
<if test="num != null">
num,
</if>
<if test="amount != null">
amount,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="dutyId != null">
#{dutyId,jdbcType=INTEGER},
</if>
<if test="productId != null">
#{productId,jdbcType=INTEGER},
</if>
<if test="productName != null">
#{productName,jdbcType=VARCHAR},
</if>
<if test="skuId != null">
#{skuId,jdbcType=INTEGER},
</if>
<if test="skuName != null">
#{skuName,jdbcType=VARCHAR},
</if>
<if test="num != null">
#{num,jdbcType=INTEGER},
</if>
<if test="amount != null">
#{amount,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<insert id="batchInsert">
INSERT INTO tb_shop_user_duty_detail (id, duty_id, product_id,
product_name, sku_id, sku_name,
num, amount) VALUES
<foreach collection="list" separator="," item="item">
(#{item.id},#{item.dutyId},#{item.productId},#{item.productName},#{item.skuId},#{item.skuName},#{item.num},#{item.amount})
</foreach>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.chaozhanggui.system.cashierservice.entity.ShopUserDutyDetail">
update tb_shop_user_duty_detail
<set>
<if test="dutyId != null">
duty_id = #{dutyId,jdbcType=INTEGER},
</if>
<if test="productId != null">
product_id = #{productId,jdbcType=INTEGER},
</if>
<if test="productName != null">
product_name = #{productName,jdbcType=VARCHAR},
</if>
<if test="skuId != null">
sku_id = #{skuId,jdbcType=INTEGER},
</if>
<if test="skuName != null">
sku_name = #{skuName,jdbcType=VARCHAR},
</if>
<if test="num != null">
num = #{num,jdbcType=INTEGER},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.ShopUserDutyDetail">
update tb_shop_user_duty_detail
set duty_id = #{dutyId,jdbcType=INTEGER},
product_id = #{productId,jdbcType=INTEGER},
product_name = #{productName,jdbcType=VARCHAR},
sku_id = #{skuId,jdbcType=INTEGER},
sku_name = #{skuName,jdbcType=VARCHAR},
num = #{num,jdbcType=INTEGER},
amount = #{amount,jdbcType=DECIMAL}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>