You've already forked FrameTour-BE
77 lines
3.2 KiB
XML
77 lines
3.2 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.ycwl.basic.profitsharing.mapper.ProfitSharingRecordMapper" >
|
|
<insert id="batchInsert">
|
|
INSERT INTO profit_sharing_record (scenic_id, order_id, user_id, user_name, amount, wx_amount, manual_amount, rate_mode, wx_rate, real_rate, order_amount, create_time)
|
|
VALUES
|
|
<foreach collection="records" item="record" separator=",">
|
|
(#{record.scenicId}, #{record.orderId}, #{record.userId}, #{record.userName}, #{record.amount}, #{record.wxAmount}, #{record.manualAmount}, #{record.rateMode}, #{record.wxRate}, #{record.realRate}, #{record.orderAmount}, #{record.createTime})
|
|
</foreach>
|
|
</insert>
|
|
<update id="deleteByScenicIdAndOrderId">
|
|
UPDATE profit_sharing_record
|
|
SET delete_time = now(), delete_reason = #{reason}
|
|
WHERE scenic_id = #{scenicId} AND order_id = #{orderId}
|
|
</update>
|
|
<select id="list" resultType="com.ycwl.basic.profitsharing.dto.ProfitSharingRecordRespVO">
|
|
SELECT r.*, s.name as scenic_name
|
|
FROM profit_sharing_record r
|
|
LEFT JOIN scenic s ON s.id = r.scenic_id
|
|
<where>
|
|
<if test="withDeleted != true">
|
|
delete_time is null
|
|
</if>
|
|
<if test="scenicId != null">
|
|
AND r.scenic_id = #{scenicId}
|
|
</if>
|
|
<if test="status != null">
|
|
AND r.status = #{status}
|
|
</if>
|
|
<if test="rateMode != null">
|
|
AND r.rate_mode = #{rateMode}
|
|
</if>
|
|
<if test="startTime != null">
|
|
AND r.create_time >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
AND r.create_time <= #{endTime}
|
|
</if>
|
|
</where>
|
|
ORDER BY r.create_time desc
|
|
</select>
|
|
<select id="listGroupByOrderId" resultType="com.ycwl.basic.profitsharing.dto.ProfitSharingRecordGroupVO">
|
|
SELECT order_id, min(create_time) as create_time
|
|
FROM profit_sharing_record r
|
|
<where>
|
|
<if test="withDeleted != true">
|
|
delete_time is null
|
|
</if>
|
|
<if test="scenicId != null">
|
|
AND r.scenic_id = #{scenicId}
|
|
</if>
|
|
<if test="status != null">
|
|
AND r.status = #{status}
|
|
</if>
|
|
<if test="rateMode != null">
|
|
AND r.rate_mode = #{rateMode}
|
|
</if>
|
|
<if test="startTime != null">
|
|
AND r.create_time >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
AND r.create_time <= #{endTime}
|
|
</if>
|
|
</where>
|
|
GROUP BY order_id
|
|
</select>
|
|
<select id="listByOrderIds" resultType="com.ycwl.basic.profitsharing.dto.ProfitSharingRecordRespVO">
|
|
SELECT r.*, s.name as scenic_name
|
|
FROM profit_sharing_record r
|
|
LEFT JOIN scenic s ON s.id = r.scenic_id
|
|
WHERE r.order_id IN
|
|
<foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
|
|
#{orderId}
|
|
</foreach>
|
|
ORDER BY r.create_time desc
|
|
</select>
|
|
</mapper> |