zhwl/zhwl-business/zhwl-scenic/target/classes/mapper/scenicSpotAudio/ScenicSpotAudioOrderMapper.xml
2025-07-01 17:54:58 +08:00

354 lines
13 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.zhwl.scenic.mapper.ScenicSpotAudioOrderMapper">
<resultMap type="ScenicSpotAudioOrder" id="ScenicSpotAudioOrderResult">
<result property="id" column="id"/>
<result property="spotId" column="spot_id"/>
<result property="scenicId" column="scenic_id"/>
<result property="orderCode" column="order_code"/>
<result property="audioPrice" column="audio_price"/>
<result property="payPrice" column="pay_price"/>
<result property="discountAmount" column="discount_amount"/>
<result property="status" column="status"/>
<result property="payOrderNo" column="pay_order_no"/>
<result property="payMethod" column="pay_method"/>
<result property="couponId" column="coupon_id"/>
<result property="zdyUserId" column="zdy_user_id"/>
<result property="createTime" column="create_time"/>
<result property="createName" column="create_name"/>
<result property="phone" column="phone"/>
<result property="payTime" column="pay_time"/>
<result property="refundTime" column="refund_time"/>
<result property="tradeSession" column="trade_session"/>
<result property="refundAmount" column="refund_amount"/>
<result property="payEndTime" column="pay_end_time"/>
<result property="buyNum" column="buy_num"/>
<result property="refundBy" column="refund_by"/>
<result property="refundReason" column="refund_reason"/>
<result property="refundCode" column="refund_code"/>
<result property="deptId" column="dept_id"/>
<result property="spotImage" column="spot_image"/>
<result property="paymentScene" column="payment_scene"/>
</resultMap>
<sql id="selectScenicSpotAudioOrderVo">
select id,
spot_id,
scenic_id,
order_code,
audio_price,
pay_price,
discount_amount,
status,
pay_order_no,
pay_method,
coupon_id,
zdy_user_id,
create_time,
create_name,
phone,
pay_time,
refund_time,
trade_session,
refund_amount,
pay_end_time,
buy_num,
refund_by,
refund_reason,
refund_code,
dept_id,
payment_scene,
spot_image
from zdy_scenic_spot_audio_order
</sql>
<select id="selectScenicSpotAudioOrderList" parameterType="ScenicSpotAudioOrder"
resultMap="ScenicSpotAudioOrderResult">
<include refid="selectScenicSpotAudioOrderVo"/>
<where>
<if test="spotId != null ">
and spot_id = #{spotId}
</if>
<if test="scenicId != null ">
and scenic_id = #{scenicId}
</if>
<if test="orderCode != null and orderCode != ''">
and order_code = #{orderCode}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="payMethod != null and payMethod != ''">
and pay_method = #{payMethod}
</if>
<if test="couponId != null ">
and coupon_id = #{couponId}
</if>
<if test="payOrderNo !=null">
and pay_order_no = #{payOrderNo}
</if>
<if test="createName != null">
and create_name like concat('%', #{createName}, '%')
</if>
<if test="phone != null">
and phone = #{phone}
</if>
<if test="refundCode !=null and refundCode!=''">
and refund_code = #{refundCode}
</if>
<if test="zdyUserId !=null and zdyUserId!=''">
and zdy_user_id = #{zdyUserId}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and DATE_FORMAT(create_time,'%Y-%m-%d') >= #{params.beginCreateTime}
and #{params.endCreateTime} >= DATE_FORMAT(create_time,'%Y-%m-%d')
</if>
${params.dataScope}
</where>
order by id desc
</select>
<select id="selectScenicSpotAudioOrderById" parameterType="Long"
resultMap="ScenicSpotAudioOrderResult">
<include refid="selectScenicSpotAudioOrderVo"/>
where id = #{id}
</select>
<select id="selectScenicSpotAudioOrderByOrderCode"
resultMap="ScenicSpotAudioOrderResult">
<include refid="selectScenicSpotAudioOrderVo"/>
where order_code = #{orderCode}
</select>
<select id="selectByRefundCode" resultMap="ScenicSpotAudioOrderResult">
<include refid="selectScenicSpotAudioOrderVo"/>
where refund_code = #{refundCode}
</select>
<insert id="insertScenicSpotAudioOrder" parameterType="ScenicSpotAudioOrder" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_scenic_spot_audio_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="spotId != null">spot_id,
</if>
<if test="scenicId != null">scenic_id,
</if>
<if test="orderCode != null">order_code,
</if>
<if test="audioPrice != null">audio_price,
</if>
<if test="payPrice != null">pay_price,
</if>
<if test="discountAmount != null">discount_amount,
</if>
<if test="status != null">status,
</if>
<if test="payOrderNo != null">pay_order_no,
</if>
<if test="payMethod != null">pay_method,
</if>
<if test="couponId != null">coupon_id,
</if>
<if test="zdyUserId != null">zdy_user_id,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createName != null">create_name,
</if>
<if test="phone != null">phone,
</if>
<if test="payTime != null">pay_time,
</if>
<if test="refundTime != null">refund_time,
</if>
<if test="tradeSession != null">trade_session,
</if>
<if test="refundAmount != null">refund_amount,
</if>
<if test="payEndTime != null">pay_end_time,
</if>
<if test="buyNum != null">buy_num,
</if>
<if test="refundBy != null">refund_by,
</if>
<if test="refundReason != null">refund_reason,
</if>
<if test="refundCode!=null"> refund_code,
</if>
<if test="deptId != null">dept_id,
</if>
<if test="paymentScene !=null">
payment_scene,
</if>
<if test="spotImage !=null">
spot_image,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="spotId != null">#{spotId},
</if>
<if test="scenicId != null">#{scenicId},
</if>
<if test="orderCode != null">#{orderCode},
</if>
<if test="audioPrice != null">#{audioPrice},
</if>
<if test="payPrice != null">#{payPrice},
</if>
<if test="discountAmount != null">#{discountAmount},
</if>
<if test="status != null">#{status},
</if>
<if test="payOrderNo != null">#{payOrderNo},
</if>
<if test="payMethod != null">#{payMethod},
</if>
<if test="couponId != null">#{couponId},
</if>
<if test="zdyUserId != null">#{zdyUserId},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createName != null">#{createName},
</if>
<if test="phone != null">#{phone},
</if>
<if test="payTime != null">#{payTime},
</if>
<if test="refundTime != null">#{refundTime},
</if>
<if test="tradeSession != null">#{tradeSession},
</if>
<if test="refundAmount != null">#{refundAmount},
</if>
<if test="payEndTime != null">#{payEndTime},
</if>
<if test="buyNum != null">#{buyNum},
</if>
<if test="refundBy != null">#{refundBy},
</if>
<if test="refundReason != null">#{refundReason},
</if>
<if test="refundCode!=null">#{refundCode},
</if>
<if test="deptId != null">#{deptId},
</if>
<if test="paymentScene !=null and paymentScene!=''">
#{paymentScene},
</if>
<if test="spotImage !=null">
#{spotImage},
</if>
</trim>
</insert>
<update id="updateScenicSpotAudioOrder" parameterType="ScenicSpotAudioOrder">
update zdy_scenic_spot_audio_order
<trim prefix="SET" suffixOverrides=",">
<if test="spotId != null">spot_id =
#{spotId},
</if>
<if test="scenicId != null">scenic_id =
#{scenicId},
</if>
<if test="orderCode != null">order_code =
#{orderCode},
</if>
<if test="audioPrice != null">audio_price =
#{audioPrice},
</if>
<if test="payPrice != null">pay_price =
#{payPrice},
</if>
<if test="discountAmount != null">discount_amount =
#{discountAmount},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="payOrderNo != null">pay_order_no =
#{payOrderNo},
</if>
<if test="payMethod != null">pay_method =
#{payMethod},
</if>
<if test="couponId != null">coupon_id =
#{couponId},
</if>
<if test="zdyUserId != null">zdy_user_id =
#{zdyUserId},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="createName != null">create_name =
#{createName},
</if>
<if test="phone != null">phone =
#{phone},
</if>
<if test="payTime != null">pay_time =
#{payTime},
</if>
<if test="refundTime != null">refund_time =
#{refundTime},
</if>
<if test="tradeSession != null">trade_session =
#{tradeSession},
</if>
<if test="refundAmount != null">refund_amount =
#{refundAmount},
</if>
<if test="payEndTime != null">pay_end_time =
#{payEndTime},
</if>
<if test="buyNum != null">buy_num =
#{buyNum},
</if>
<if test="refundBy != null">refund_by =
#{refundBy},
</if>
<if test="refundReason != null">refund_reason =
#{refundReason},
</if>
<if test="refundCode!=null">refund_code =
#{refundCode},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="paymentScene !=null">
payment_scene = #{paymentScene},
</if>
<if test="spotImage !=null">
spot_image = #{spotImage},
</if>
</trim>
where id = #{id}
</update>
<update id="updateOrderStatus">
update zdy_scenic_spot_audio_order
set status = #{status}
where order_code=#{orderCode}
</update>
<update id="updateOrderStatusById">
update zdy_scenic_spot_audio_order
set status = #{status}
where id=#{id}
</update>
<delete id="deleteScenicSpotAudioOrderById" parameterType="Long">
delete
from zdy_scenic_spot_audio_order
where id = #{id}
</delete>
<delete id="deleteScenicSpotAudioOrderByIds" parameterType="String">
delete from zdy_scenic_spot_audio_order where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>