提交
This commit is contained in:
241
src/main/resources/mapper/TbOrderDetailMapper.xml
Normal file
241
src/main/resources/mapper/TbOrderDetailMapper.xml
Normal file
@@ -0,0 +1,241 @@
|
||||
<?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.TbOrderDetailMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbOrderDetail">
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="order_id" jdbcType="INTEGER" property="orderId"/>
|
||||
<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="num" jdbcType="INTEGER" property="num"/>
|
||||
<result column="product_name" jdbcType="VARCHAR" property="productName"/>
|
||||
<result column="product_sku_name" jdbcType="VARCHAR" property="productSkuName"/>
|
||||
<result column="product_img" jdbcType="VARCHAR" property="productImg"/>
|
||||
<result column="status" jdbcType="VARCHAR" property="status"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="price" jdbcType="DECIMAL" property="price"/>
|
||||
<result column="price_amount" jdbcType="DECIMAL" property="priceAmount"/>
|
||||
<result column="pack_amount" jdbcType="DECIMAL" property="packAmount"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, order_id, shop_id, product_id, product_sku_id, num, product_name, product_sku_name,
|
||||
product_img, create_time, update_time, price, price_amount,status,pack_amount
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from tb_order_detail
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<select id="selectAllByOrderId" resultType="com.chaozhanggui.system.cashierservice.entity.TbOrderDetail">
|
||||
select * from tb_order_detail where order_id = #{id}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_order_detail
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<delete id="deleteByOUrderId">
|
||||
delete from tb_order_detail where order_id = #{orderId}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderDetail">
|
||||
insert into tb_order_detail (id, order_id, shop_id,
|
||||
product_id, product_sku_id, num,
|
||||
product_name, product_sku_name, product_img,
|
||||
create_time, update_time, price,
|
||||
price_amount,pack_amount,status)
|
||||
values (#{id,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER},
|
||||
#{productId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER}, #{num,jdbcType=INTEGER},
|
||||
#{productName,jdbcType=VARCHAR}, #{productSkuName,jdbcType=VARCHAR}, #{productImg,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{price,jdbcType=DECIMAL},
|
||||
#{priceAmount,jdbcType=DECIMAL},#{packAmount,jdbcType=DECIMAL},#{status,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderDetail">
|
||||
insert into tb_order_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="orderId != null">
|
||||
order_id,
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
product_id,
|
||||
</if>
|
||||
<if test="productSkuId != null">
|
||||
product_sku_id,
|
||||
</if>
|
||||
<if test="num != null">
|
||||
num,
|
||||
</if>
|
||||
<if test="productName != null">
|
||||
product_name,
|
||||
</if>
|
||||
<if test="productSkuName != null">
|
||||
product_sku_name,
|
||||
</if>
|
||||
<if test="productImg != null">
|
||||
product_img,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="price != null">
|
||||
price,
|
||||
</if>
|
||||
<if test="priceAmount != null">
|
||||
price_amount,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orderId != null">
|
||||
#{orderId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
#{productId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productSkuId != null">
|
||||
#{productSkuId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="num != null">
|
||||
#{num,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productName != null">
|
||||
#{productName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productSkuName != null">
|
||||
#{productSkuName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productImg != null">
|
||||
#{productImg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="price != null">
|
||||
#{price,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="priceAmount != null">
|
||||
#{priceAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective"
|
||||
parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderDetail">
|
||||
update tb_order_detail
|
||||
<set>
|
||||
<if test="orderId != null">
|
||||
order_id = #{orderId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
product_id = #{productId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productSkuId != null">
|
||||
product_sku_id = #{productSkuId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="num != null">
|
||||
num = #{num,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productName != null">
|
||||
product_name = #{productName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sstatus != null">
|
||||
sstatus = #{sstatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productSkuName != null">
|
||||
product_sku_name = #{productSkuName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="productImg != null">
|
||||
product_img = #{productImg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="price != null">
|
||||
price = #{price,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="priceAmount != null">
|
||||
price_amount = #{priceAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="packAmount != null">
|
||||
pack_amount = #{packAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderDetail">
|
||||
update tb_order_detail
|
||||
set order_id = #{orderId,jdbcType=INTEGER},
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
product_id = #{productId,jdbcType=INTEGER},
|
||||
product_sku_id = #{productSkuId,jdbcType=INTEGER},
|
||||
num = #{num,jdbcType=INTEGER},
|
||||
product_name = #{productName,jdbcType=VARCHAR},
|
||||
product_sku_name = #{productSkuName,jdbcType=VARCHAR},
|
||||
product_img = #{productImg,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
price = #{price,jdbcType=DECIMAL},
|
||||
price_amount = #{priceAmount,jdbcType=DECIMAL}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateStatusByOrderId">
|
||||
update tb_order_detail set status = #{status} where order_id = #{orderId}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateBatchOrderDetail" parameterType="com.chaozhanggui.system.cashierservice.entity.po.OrderDetailPo">
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
update tb_order_detail
|
||||
set status= #{item.status}
|
||||
where id = #{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="selectAllByOrderIdAndStatus" resultMap="BaseResultMap">
|
||||
select * from tb_order_detail where status='closed' and order_id=#{orderId} and id in
|
||||
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectByOrderId" resultType="java.math.BigDecimal">
|
||||
select IFNULL(sum(price_amount),0) from tb_order_detail where order_id=#{orderId} and `status`='refund'
|
||||
</select>
|
||||
|
||||
<update id="updateStatusByOrderIdAndStatus">
|
||||
update tb_order_detail set status = #{status} where order_id = #{orderId} and status='unpaid'
|
||||
</update>
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into tb_order_detail (order_id, shop_id,
|
||||
product_id, product_sku_id, num,
|
||||
product_name, product_sku_name, product_img,
|
||||
create_time, update_time, price,
|
||||
price_amount,pack_amount,status) values
|
||||
<foreach collection="list" separator="," item="item">
|
||||
(#{orderId},#{item.shopId},#{item.productId},#{item.productSkuId},#{item.num},#{item.productName},#{item.productSkuName},#{item.productImg},#{item.createTime},#{item.updateTime},#{item.price},#{item.priceAmount},#{item.packAmount},#{item.status})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user