393 lines
17 KiB
XML
393 lines
17 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.TbCashierCartMapper">
|
|
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
|
<result column="master_id" jdbcType="VARCHAR" property="masterId"/>
|
|
<result column="order_id" jdbcType="VARCHAR" property="orderId"/>
|
|
<result column="ref_order_id" jdbcType="VARCHAR" property="refOrderId"/>
|
|
<result column="total_amount" jdbcType="DECIMAL" property="totalAmount"/>
|
|
<result column="product_id" jdbcType="VARCHAR" property="productId"/>
|
|
<result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
|
|
<result column="is_sku" jdbcType="TINYINT" property="isSku"/>
|
|
<result column="sku_id" jdbcType="VARCHAR" property="skuId"/>
|
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
|
<result column="sale_price" jdbcType="DECIMAL" property="salePrice"/>
|
|
<result column="pack_fee" jdbcType="DECIMAL" property="packFee"/>
|
|
<result column="number" jdbcType="INTEGER" property="number"/>
|
|
<result column="total_number" jdbcType="INTEGER" property="totalNumber"/>
|
|
<result column="refund_number" jdbcType="INTEGER" property="refundNumber"/>
|
|
<result column="category_id" jdbcType="VARCHAR" property="categoryId"/>
|
|
<result column="status" jdbcType="VARCHAR" property="status"/>
|
|
<result column="type" jdbcType="TINYINT" property="type"/>
|
|
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId"/>
|
|
<result column="shop_id" jdbcType="VARCHAR" property="shopId"/>
|
|
<result column="created_at" jdbcType="BIGINT" property="createdAt"/>
|
|
<result column="updated_at" jdbcType="BIGINT" property="updatedAt"/>
|
|
<result column="user_id" jdbcType="INTEGER" property="userId"/>
|
|
<result column="table_id" jdbcType="VARCHAR" property="tableId"/>
|
|
<result column="pack_fee" jdbcType="DECIMAL" property="packFee"/>
|
|
<result column="trade_day" jdbcType="VARCHAR" property="tradeDay"/>
|
|
<result column="is_pack" jdbcType="VARCHAR" property="isPack"/>
|
|
<result column="is_gift" jdbcType="VARCHAR" property="isGift"/>
|
|
<result column="pending_at" jdbcType="BIGINT" property="pendingAt"/>
|
|
<result column="uuid" jdbcType="VARCHAR" property="uuid"/>
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, master_id, order_id, ref_order_id, total_amount, product_id, cover_img, is_sku,pack_fee,is_pack,is_gift,pending_at,
|
|
sku_id, name, sale_price, number, total_number, refund_number, category_id, status,
|
|
type, merchant_id, shop_id, created_at, updated_at, user_id, table_id,pack_fee,trade_day,uuid
|
|
</sql>
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from tb_cashier_cart
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<select id="selectALlByMasterId" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from tb_cashier_cart where master_id = #{masterId} and status = #{status}
|
|
</select>
|
|
<select id="selectByDetail" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from tb_cashier_cart where master_id = #{masterId} and product_id = #{productId} and shop_id = #{shopId} and
|
|
sku_id = #{skuId} and trade_day = #{day}
|
|
<if test="uuid != null">
|
|
and uuid = #{uuid}
|
|
</if>
|
|
</select>
|
|
<select id="selectByMaskerId" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
select *
|
|
from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId} and status = #{status} and trade_day = #{day} order by id desc
|
|
</select>
|
|
<select id="selectCartList" resultType="com.chaozhanggui.system.cashierservice.entity.po.CartPo">
|
|
select shop_Id as shopId,master_id as masterId,uuid,
|
|
TRIM(TRAILING ', ' FROM GROUP_CONCAT(name ORDER BY id SEPARATOR ', ')) AS productName,
|
|
pending_at as pendingAt,
|
|
ifnull(sum(total_amount),0) as totalAmount
|
|
from tb_cashier_cart where shop_id = #{shopId} and status = 'refund' group by shop_Id, master_id order by trade_day desc
|
|
</select>
|
|
<select id="selectAllCreateOrder" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId} and status = #{status}
|
|
<if test="uuid != null and uuid != ''">
|
|
and uuid = #{uuid}
|
|
</if>
|
|
<if test="day != null and day !=''">
|
|
and trade_day = #{day}
|
|
</if>
|
|
</select>
|
|
<select id="selectProductNumByMarketId" resultType="com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo">
|
|
select ifnull(count(*),0) as productNum,ifnull(sum(number),0)as productSum from (select count(*),number from tb_cashier_cart where trade_day = #{day} and master_id = #{masterId} and shop_id = #{shopId} group by product_id ) a
|
|
</select>
|
|
<select id="selectqgList" resultType="java.lang.Integer">
|
|
select count(*) from (select ifnull(count(*),0)
|
|
from tb_cashier_cart where status = 'refund' and shop_id = #{shopId} group by shop_id,master_id,trade_day) a
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
delete from tb_cashier_cart
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
<delete id="deleteByCartId">
|
|
delete from tb_cashier_cart where id = #{cartId} and master_id = #{masterId}
|
|
</delete>
|
|
<delete id="deleteBymasterId">
|
|
delete from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId}
|
|
and status = #{status} and trade_day = #{day}
|
|
<if test="uuid != null">
|
|
and uuid = #{uuid}
|
|
</if>
|
|
</delete>
|
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
insert into tb_cashier_cart (id, master_id, order_id,
|
|
ref_order_id, total_amount, product_id,
|
|
cover_img, is_sku, sku_id,
|
|
name, sale_price, number,
|
|
total_number, refund_number, category_id,
|
|
status, type, merchant_id,
|
|
shop_id, created_at, updated_at, pack_fee,trade_day,is_pack,is_gift,uuid
|
|
)
|
|
values (#{id,jdbcType=INTEGER}, #{masterId,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR},
|
|
#{refOrderId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{productId,jdbcType=VARCHAR},
|
|
#{coverImg,jdbcType=VARCHAR}, #{isSku,jdbcType=TINYINT}, #{skuId,jdbcType=VARCHAR},
|
|
#{name,jdbcType=VARCHAR}, #{salePrice,jdbcType=DECIMAL}, #{number,jdbcType=REAL},
|
|
#{totalNumber,jdbcType=REAL}, #{refundNumber,jdbcType=REAL}, #{categoryId,jdbcType=VARCHAR},
|
|
#{status,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR},
|
|
#{shopId,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{packFee,jdbcType=DECIMAL}
|
|
, #{tradeDay,jdbcType=VARCHAR}, #{isPack,jdbcType=VARCHAR}, #{isGift,jdbcType=VARCHAR}, #{uuid,jdbcType=VARCHAR}
|
|
)
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
insert into tb_cashier_cart
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="masterId != null">
|
|
master_id,
|
|
</if>
|
|
<if test="orderId != null">
|
|
order_id,
|
|
</if>
|
|
<if test="refOrderId != null">
|
|
ref_order_id,
|
|
</if>
|
|
<if test="totalAmount != null">
|
|
total_amount,
|
|
</if>
|
|
<if test="productId != null">
|
|
product_id,
|
|
</if>
|
|
<if test="coverImg != null">
|
|
cover_img,
|
|
</if>
|
|
<if test="isSku != null">
|
|
is_sku,
|
|
</if>
|
|
<if test="skuId != null">
|
|
sku_id,
|
|
</if>
|
|
<if test="name != null">
|
|
name,
|
|
</if>
|
|
<if test="salePrice != null">
|
|
sale_price,
|
|
</if>
|
|
<if test="number != null">
|
|
number,
|
|
</if>
|
|
<if test="totalNumber != null">
|
|
total_number,
|
|
</if>
|
|
<if test="refundNumber != null">
|
|
refund_number,
|
|
</if>
|
|
<if test="categoryId != null">
|
|
category_id,
|
|
</if>
|
|
<if test="status != null">
|
|
status,
|
|
</if>
|
|
<if test="type != null">
|
|
type,
|
|
</if>
|
|
<if test="merchantId != null">
|
|
merchant_id,
|
|
</if>
|
|
<if test="shopId != null">
|
|
shop_id,
|
|
</if>
|
|
<if test="createdAt != null">
|
|
created_at,
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
updated_at,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="masterId != null">
|
|
#{masterId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="orderId != null">
|
|
#{orderId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="refOrderId != null">
|
|
#{refOrderId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="totalAmount != null">
|
|
#{totalAmount,jdbcType=DECIMAL},
|
|
</if>
|
|
<if test="productId != null">
|
|
#{productId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="coverImg != null">
|
|
#{coverImg,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isSku != null">
|
|
#{isSku,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="skuId != null">
|
|
#{skuId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="name != null">
|
|
#{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="salePrice != null">
|
|
#{salePrice,jdbcType=DECIMAL},
|
|
</if>
|
|
<if test="number != null">
|
|
#{number,jdbcType=REAL},
|
|
</if>
|
|
<if test="totalNumber != null">
|
|
#{totalNumber,jdbcType=REAL},
|
|
</if>
|
|
<if test="refundNumber != null">
|
|
#{refundNumber,jdbcType=REAL},
|
|
</if>
|
|
<if test="categoryId != null">
|
|
#{categoryId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="status != null">
|
|
#{status,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="type != null">
|
|
#{type,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="merchantId != null">
|
|
#{merchantId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="shopId != null">
|
|
#{shopId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createdAt != null">
|
|
#{createdAt,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
#{updatedAt,jdbcType=BIGINT},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective"
|
|
parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
update tb_cashier_cart
|
|
<set>
|
|
<if test="masterId != null">
|
|
master_id = #{masterId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="orderId != null">
|
|
order_id = #{orderId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="refOrderId != null">
|
|
ref_order_id = #{refOrderId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="totalAmount != null">
|
|
total_amount = #{totalAmount,jdbcType=DECIMAL},
|
|
</if>
|
|
<if test="productId != null">
|
|
product_id = #{productId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="coverImg != null">
|
|
cover_img = #{coverImg,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isSku != null">
|
|
is_sku = #{isSku,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="skuId != null">
|
|
sku_id = #{skuId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="name != null">
|
|
name = #{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="salePrice != null">
|
|
sale_price = #{salePrice,jdbcType=DECIMAL},
|
|
</if>
|
|
<if test="packFee != null">
|
|
pack_fee = #{packFee,jdbcType=DECIMAL},
|
|
</if>
|
|
<if test="number != null">
|
|
number = #{number,jdbcType=REAL},
|
|
</if>
|
|
<if test="totalNumber != null">
|
|
total_number = #{totalNumber,jdbcType=REAL},
|
|
</if>
|
|
<if test="refundNumber != null">
|
|
refund_number = #{refundNumber,jdbcType=REAL},
|
|
</if>
|
|
<if test="categoryId != null">
|
|
category_id = #{categoryId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="status != null">
|
|
status = #{status,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="type != null">
|
|
type = #{type,jdbcType=TINYINT},
|
|
</if>
|
|
<if test="merchantId != null">
|
|
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="shopId != null">
|
|
shop_id = #{shopId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createdAt != null">
|
|
created_at = #{createdAt,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
updated_at = #{updatedAt,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="pendingAt != null">
|
|
pending_at = #{pendingAt,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="isGift != null">
|
|
is_gift = #{isGift,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="isPack != null">
|
|
is_pack = #{isPack,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="uuid != null">
|
|
uuid = #{uuid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="tableId != null">
|
|
table_id = #{tableId,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
update tb_cashier_cart
|
|
set master_id = #{masterId,jdbcType=VARCHAR},
|
|
order_id = #{orderId,jdbcType=VARCHAR},
|
|
ref_order_id = #{refOrderId,jdbcType=VARCHAR},
|
|
total_amount = #{totalAmount,jdbcType=DECIMAL},
|
|
product_id = #{productId,jdbcType=VARCHAR},
|
|
cover_img = #{coverImg,jdbcType=VARCHAR},
|
|
is_sku = #{isSku,jdbcType=TINYINT},
|
|
sku_id = #{skuId,jdbcType=VARCHAR},
|
|
name = #{name,jdbcType=VARCHAR},
|
|
sale_price = #{salePrice,jdbcType=DECIMAL},
|
|
number = #{number,jdbcType=REAL},
|
|
total_number = #{totalNumber,jdbcType=REAL},
|
|
refund_number = #{refundNumber,jdbcType=REAL},
|
|
category_id = #{categoryId,jdbcType=VARCHAR},
|
|
status = #{status,jdbcType=VARCHAR},
|
|
type = #{type,jdbcType=TINYINT},
|
|
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
|
shop_id = #{shopId,jdbcType=VARCHAR},
|
|
created_at = #{createdAt,jdbcType=BIGINT},
|
|
updated_at = #{updatedAt,jdbcType=BIGINT}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateStatus">
|
|
update tb_cashier_cart set status = #{status} where id = #{id}
|
|
</update>
|
|
<update id="updateStatusByMaster">
|
|
update tb_cashier_cart set status = #{status} , uuid = #{uuid}where shop_id = #{shopId} and master_id = #{masterId}
|
|
and trade_day = #{day} and status = 'refund'
|
|
</update>
|
|
|
|
<update id="updateByOrderId">
|
|
update tb_cashier_cart set `status`=#{status} where order_id=#{orderId} and `status`='create'
|
|
</update>
|
|
<update id="updateIsGift">
|
|
update tb_cashier_cart set is_pack = #{status} where master_id = #{maskerId} and trade_day = #{day} and shop_id = #{shopId}
|
|
</update>
|
|
|
|
<select id="selectByOrderId" resultMap="BaseResultMap">
|
|
select * from tb_cashier_cart where order_id=#{orderId}
|
|
<if test="status != null">
|
|
and `status`=#{status}
|
|
</if>
|
|
|
|
</select>
|
|
<select id="selectAllByMarketId" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
select * from tb_cashier_cart where master_id = #{masterId} and trade_day = #{day} and shop_id = #{shopId} and status = 'create'
|
|
</select>
|
|
|
|
|
|
</mapper> |