electripper/electripper-system/src/main/resources/mapper/system/EtRefundMapper.xml
2024-07-08 14:18:58 +08:00

150 lines
7.7 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.ruoyi.system.mapper.EtRefundMapper">
<resultMap type="EtRefund" id="EtRefundResult">
<result property="id" column="id" />
<result property="refundNo" column="refund_no" />
<result property="orderNo" column="order_no" />
<result property="userId" column="user_id" />
<result property="amount" column="amount" />
<result property="dispatchFee" column="dispatch_fee" />
<result property="manageFee" column="manage_fee" />
<result property="ridingFee" column="riding_fee" />
<result property="appointmentFee" column="appointment_fee" />
<result property="type" column="type" />
<result property="reason" column="reason" />
<result property="createTime" column="create_time" />
<result property="itemDesc" column="item_desc" />
<result property="refundResult" column="refund_result" />
</resultMap>
<sql id="selectEtRefundVo">
select id, refund_no, order_no, user_id, amount, dispatch_fee, manage_fee, riding_fee, appointment_fee, type, reason, create_time, item_desc,refund_result from et_refund
</sql>
<select id="selectEtRefundList" parameterType="EtRefund" resultMap="EtRefundResult">
select r.id, r.refund_no, o.area_id areaId,oa.area_name areaName,r.order_no, r.user_id, u.user_name userName, r.amount, r.dispatch_fee, r.manage_fee,
r.riding_fee, r.appointment_fee, r.type, r.reason, r.create_time, r.item_desc,r.refund_result from et_refund r
INNER JOIN et_order o on o.order_no = r.order_no
left join et_user u on u.user_id = r.user_id
LEFT JOIN et_operating_area oa ON o.area_id = oa.area_id
LEFT join et_area_dept ad on ad.area_id = oa.area_id
LEFT join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
<if test="refundNo != null and refundNo != ''"> and r.refund_no = #{refundNo}</if>
<if test="orderNo != null and orderNo != ''"> and r.order_no like concat('%', #{orderNo}, '%')</if>
<if test="userId != null "> and r.user_id like concat('%', #{userId}, '%')</if>
<if test="amount != null "> and r.amount = #{amount}</if>
<if test="areaId != null"> and o.area_id = #{areaId}</if>
<if test="itemDesc != null and itemDesc != ''"> and r.item_desc like concat('%', #{itemDesc}, '%')</if>
<if test="refundResult != null "> and r.refund_result = #{refundResult}</if>
<if test="type != null "> and r.type = #{type}</if>
<if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by o.create_time desc
</select>
<select id="selectEtRefundById" parameterType="Long" resultMap="EtRefundResult">
<include refid="selectEtRefundVo"/>
where id = #{id}
</select>
<select id="selectEtRefundByOrderNo" resultMap="EtRefundResult">
<include refid="selectEtRefundVo"/>
where order_no = #{orderNo}
</select>
<select id="selectEtRefundByRefundNo" resultMap="EtRefundResult">
<include refid="selectEtRefundVo"/>
where refund_no = #{refundNo}
</select>
<insert id="insertEtRefund" parameterType="EtRefund">
insert into et_refund
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="refundNo != null">refund_no,</if>
<if test="orderNo != null and orderNo != ''">order_no,</if>
<if test="userId != null">user_id,</if>
<if test="amount != null">amount,</if>
<if test="dispatchFee != null">dispatch_fee,</if>
<if test="manageFee != null">manage_fee,</if>
<if test="ridingFee != null">riding_fee,</if>
<if test="appointmentFee != null">appointment_fee,</if>
<if test="type != null">type,</if>
<if test="reason != null">reason,</if>
<if test="createTime != null">create_time,</if>
<if test="itemDesc != null">item_desc,</if>
<if test="refundResult != null">refund_result,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="refundNo != null">#{refundNo},</if>
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
<if test="userId != null">#{userId},</if>
<if test="amount != null">#{amount},</if>
<if test="dispatchFee != null">#{dispatchFee},</if>
<if test="manageFee != null">#{manageFee},</if>
<if test="ridingFee != null">#{ridingFee},</if>
<if test="appointmentFee != null">#{appointmentFee},</if>
<if test="type != null">#{type},</if>
<if test="reason != null">#{reason},</if>
<if test="createTime != null">#{createTime},</if>
<if test="itemDesc != null">#{itemDesc},</if>
<if test="refundResult != null">#{refund_result},</if>
</trim>
</insert>
<update id="updateEtRefund" parameterType="EtRefund">
update et_refund
<trim prefix="SET" suffixOverrides=",">
<if test="refundNo != null">refund_no = #{refundNo},</if>
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
<if test="manageFee != null">manage_fee = #{manageFee},</if>
<if test="ridingFee != null">riding_fee = #{ridingFee},</if>
<if test="appointmentFee != null">appointment_fee = #{appointmentFee},</if>
<if test="type != null">type = #{type},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="itemDesc != null">item_desc = #{itemDesc},</if>
<if test="refundResult != null">refund_result = #{refundResult},</if>
</trim>
where id = #{id}
</update>
<update id="updateEtRefundByRefundNo">
update et_refund
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
<if test="manageFee != null">manage_fee = #{manageFee},</if>
<if test="ridingFee != null">riding_fee = #{ridingFee},</if>
<if test="appointmentFee != null">appointment_fee = #{appointmentFee},</if>
<if test="type != null">type = #{type},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="itemDesc != null">item_desc = #{itemDesc},</if>
<if test="refundResult != null">refund_result = #{refundResult},</if>
</trim>
where refund_no = #{refundNo}
</update>
<delete id="deleteEtRefundById" parameterType="Long">
delete from et_refund where id = #{id}
</delete>
<delete id="deleteEtRefundByIds" parameterType="String">
delete from et_refund where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>