128 lines
4.5 KiB
XML
128 lines
4.5 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.TbGroupOrderCouponMapper">
|
|
|
|
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon" id="TbGroupOrderCouponMap">
|
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
|
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
|
|
<result property="couponNo" column="coupon_no" jdbcType="VARCHAR"/>
|
|
<result property="isRefund" column="is_refund" jdbcType="INTEGER"/>
|
|
<result property="refundAmount" column="refund_amount" jdbcType="NUMERIC"/>
|
|
<result property="refundReason" column="refund_reason" jdbcType="VARCHAR"/>
|
|
<result property="refundDesc" column="refund_desc" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
id
|
|
, order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc </sql>
|
|
|
|
<!--查询单个-->
|
|
<select id="queryById" resultMap="TbGroupOrderCouponMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
|
|
from tb_group_order_coupon
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<select id="queryByCoupon" resultMap="TbGroupOrderCouponMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
|
|
from tb_group_order_coupon
|
|
where coupon_no = #{couponNo}
|
|
and is_refund = 0;
|
|
</select>
|
|
|
|
<select id="queryNoRefundByOrderId" resultMap="TbGroupOrderCouponMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
|
|
from tb_group_order_coupon
|
|
where order_id = #{orderId}
|
|
and is_refund = 0;
|
|
</select>
|
|
|
|
<!--查询指定行数据-->
|
|
<select id="queryAll" resultMap="TbGroupOrderCouponMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
|
|
from tb_group_order_coupon
|
|
<where>
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="orderId != null">
|
|
and order_id = #{orderId}
|
|
</if>
|
|
<if test="couponNo != null and couponNo != ''">
|
|
and coupon_no = #{couponNo}
|
|
</if>
|
|
<if test="isRefund != null">
|
|
and is_refund = #{isRefund}
|
|
</if>
|
|
<if test="refundAmount != null">
|
|
and refund_amount = #{refundAmount}
|
|
</if>
|
|
<if test="refundReason != null and refundReason != ''">
|
|
and refund_reason = #{refundReason}
|
|
</if>
|
|
<if test="refundDesc != null and refundDesc != ''">
|
|
and refund_desc = #{refundDesc}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<!--新增所有列-->
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
insert into tb_group_order_coupon(order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc)
|
|
values (#{orderId}, #{couponNo}, #{isRefund}, #{refundAmount}, #{refundReason}, #{refundDesc})
|
|
</insert>
|
|
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
|
insert into tb_group_order_coupon(order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc)
|
|
values
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
(#{entity.orderId}, #{entity.couponNo}, #{entity.isRefund}, #{entity.refundAmount}, #{entity.refundReason},
|
|
#{entity.refundDesc})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!--通过主键修改数据-->
|
|
<update id="update">
|
|
update tb_group_order_coupon
|
|
<set>
|
|
<if test="orderId != null">
|
|
order_id = #{orderId},
|
|
</if>
|
|
<if test="couponNo != null and couponNo != ''">
|
|
coupon_no = #{couponNo},
|
|
</if>
|
|
<if test="isRefund != null">
|
|
is_refund = #{isRefund},
|
|
</if>
|
|
<if test="refundAmount != null">
|
|
refund_amount = #{refundAmount},
|
|
</if>
|
|
<if test="refundReason != null and refundReason != ''">
|
|
refund_reason = #{refundReason},
|
|
</if>
|
|
<if test="refundDesc != null and refundDesc != ''">
|
|
refund_desc = #{refundDesc},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
delete
|
|
from tb_group_order_coupon
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
</mapper>
|
|
|