This commit is contained in:
2025-07-01 17:54:58 +08:00
commit 57dcd609e2
5136 changed files with 346184 additions and 0 deletions

View File

@@ -0,0 +1,194 @@
<?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.ticket.order.mapper.ZdyOrderInvoiceIssuanceMapper">
<resultMap type="ZdyOrderInvoiceIssuance" id="ZdyOrderInvoiceIssuanceResult">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="orderItemId" column="order_item_id"/>
<result property="ticketId" column="ticket_id"/>
<result property="ticketName" column="ticket_name"/>
<result property="quantity" column="quantity"/>
<result property="price" column="price"/>
<result property="buyQuantity" column="buy_quantity"/>
<result property="totalPrice" column="total_price"/>
<result property="paymentTime" column="payment_time"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectZdyOrderInvoiceIssuanceVo">
select id, order_id, order_item_id, ticket_id, ticket_name, quantity, price, buy_quantity, total_price, payment_time, create_time, create_by, update_time, update_by, remark
from zdy_order_invoice_issuance
</sql>
<select id="selectZdyOrderInvoiceIssuanceList" parameterType="ZdyOrderInvoiceIssuance" resultMap="ZdyOrderInvoiceIssuanceResult">
<include refid="selectZdyOrderInvoiceIssuanceVo"/>
<where>
<if test="orderId != null ">
and order_id = #{orderId}
</if>
<if test="orderItemId != null ">
and order_item_id = #{orderItemId}
</if>
<if test="ticketId != null ">
and ticket_id = #{ticketId}
</if>
<if test="ticketName != null and ticketName != ''">
and ticket_name like concat('%', #{ticketName}, '%')
</if>
<if test="quantity != null ">
and quantity = #{quantity}
</if>
<if test="price != null ">
and price = #{price}
</if>
<if test="buyQuantity != null ">
and buy_quantity = #{buyQuantity}
</if>
<if test="totalPrice != null ">
and total_price = #{totalPrice}
</if>
<if test="paymentTime != null ">
and payment_time = #{paymentTime}
</if>
</where>
order by create_time desc
</select>
<select id="selectZdyOrderInvoiceIssuanceById" parameterType="Long"
resultMap="ZdyOrderInvoiceIssuanceResult">
<include refid="selectZdyOrderInvoiceIssuanceVo"/>
where id = #{id}
</select>
<insert id="insertZdyOrderInvoiceIssuance" parameterType="ZdyOrderInvoiceIssuance" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_order_invoice_issuance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,
</if>
<if test="orderItemId != null">order_item_id,
</if>
<if test="ticketId != null">ticket_id,
</if>
<if test="ticketName != null and ticketName != ''">ticket_name,
</if>
<if test="quantity != null">quantity,
</if>
<if test="price != null">price,
</if>
<if test="buyQuantity != null">buy_quantity,
</if>
<if test="totalPrice != null">total_price,
</if>
<if test="paymentTime != null">payment_time,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},
</if>
<if test="orderItemId != null">#{orderItemId},
</if>
<if test="ticketId != null">#{ticketId},
</if>
<if test="ticketName != null and ticketName != ''">#{ticketName},
</if>
<if test="quantity != null">#{quantity},
</if>
<if test="price != null">#{price},
</if>
<if test="buyQuantity != null">#{buyQuantity},
</if>
<if test="totalPrice != null">#{totalPrice},
</if>
<if test="paymentTime != null">#{paymentTime},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateZdyOrderInvoiceIssuance" parameterType="ZdyOrderInvoiceIssuance">
update zdy_order_invoice_issuance
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id =
#{orderId},
</if>
<if test="orderItemId != null">order_item_id =
#{orderItemId},
</if>
<if test="ticketId != null">ticket_id =
#{ticketId},
</if>
<if test="ticketName != null and ticketName != ''">ticket_name =
#{ticketName},
</if>
<if test="quantity != null">quantity =
#{quantity},
</if>
<if test="price != null">price =
#{price},
</if>
<if test="buyQuantity != null">buy_quantity =
#{buyQuantity},
</if>
<if test="totalPrice != null">total_price =
#{totalPrice},
</if>
<if test="paymentTime != null">payment_time =
#{paymentTime},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyOrderInvoiceIssuanceById" parameterType="Long">
delete from zdy_order_invoice_issuance where id = #{id}
</delete>
<delete id="deleteZdyOrderInvoiceIssuanceByIds" parameterType="String">
delete from zdy_order_invoice_issuance where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,245 @@
<?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.ticket.order.mapper.ZdyTicketOrderDetailChildMapper">
<resultMap type="ZdyTicketOrderDetailChildVo" id="ZdyTicketOrderDetailChildResult">
<result property="id" column="id"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="verificationCode" column="verification_code"/>
<result property="ticketId" column="ticket_id"/>
<result property="ticketName" column="ticket_name"/>
<result property="verificationType" column="verification_type"/>
<result property="verificationTime" column="verification_time"/>
<result property="verificationNum" column="verification_num"/>
<result property="canVerificationNum" column="can_verification_num"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="dayVerificationNum" column="day_verification_num"/>
<result property="monthVerificationNum" column="month_verification_num"/>
<result property="salesRice" column="sales_rice"/>
<result property="childScenicId" column="scenic_id"/>
</resultMap>
<sql id="selectZdyTicketOrderDetailChildVo">
select odc.id,
odc.order_detail_id,
odc.verification_code,
odc.ticket_id,
odc.ticket_name,
odc.verification_type,
odc.verification_time,
odc.verification_num,
odc.can_verification_num,
odc.create_by,
odc.create_time,
odc.update_by,
odc.update_time,
odc.del_flag,
odc.day_verification_num,
odc.month_verification_num,
ti.sales_rice,
ti.scenic_id,
IFNULL(c.month_count, 0) AS monthCount,
IFNULL(d.day_count, 0) AS dayCount
from zdy_ticket_order_detail_child odc
left join zdy_ticket ti on ti.id = odc.ticket_id
LEFT JOIN (SELECT order_detail_child_id,DATE_FORMAT(create_time, '%Y-%m-01') AS event_date_month,
SUM(verification_num) AS month_count
FROM zdy_ticket_order_verification_history
WHERE create_time >= CURDATE() - INTERVAL DAY (CURDATE()) - 1 DAY
AND create_time &lt; CURDATE() + INTERVAL 1 MONTH - INTERVAL DAY (CURDATE()) - 1 DAY
AND order_detail_child_id IS NOT NULL
GROUP BY order_detail_child_id,event_date_month) c ON odc.id = c.order_detail_child_id
LEFT JOIN (SELECT order_detail_child_id,DATE_FORMAT(create_time, '%Y-%m-%d') AS event_date_day,
SUM(verification_num) AS day_count
FROM zdy_ticket_order_verification_history
WHERE DATE(create_time) = CURDATE() AND order_detail_child_id IS NOT NULL
GROUP BY order_detail_child_id,event_date_day) d ON odc.id = d.order_detail_child_id
</sql>
<select id="selectZdyTicketOrderDetailChildList" parameterType="ZdyTicketOrderDetailChild"
resultMap="ZdyTicketOrderDetailChildResult">
<include refid="selectZdyTicketOrderDetailChildVo"/>
<where>
<if test="orderDetailId != null ">
and odc.order_detail_id = #{orderDetailId}
</if>
<if test="verificationCode != null and verificationCode != ''">
and odc.verification_code = #{verificationCode}
</if>
<if test="ticketId != null ">
and odc.ticket_id = #{ticketId}
</if>
<if test="ticketName != null and ticketName != ''">
and odc.ticket_name like concat('%', #{ticketName}, '%')
</if>
<if test="verificationType != null and verificationType != ''">
and odc.verification_type = #{verificationType}
</if>
</where>
</select>
<select id="selectZdyTicketOrderDetailChildById" parameterType="Long"
resultMap="ZdyTicketOrderDetailChildResult">
<include refid="selectZdyTicketOrderDetailChildVo"/>
where odc.id = #{id}
</select>
<insert id="insertZdyTicketOrderDetailChild" parameterType="ZdyTicketOrderDetailChild" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_order_detail_child
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderDetailId != null">order_detail_id,
</if>
<if test="verificationCode != null and verificationCode != ''">verification_code,
</if>
<if test="ticketId != null">ticket_id,
</if>
<if test="ticketName != null">ticket_name,
</if>
<if test="verificationType != null">verification_type,
</if>
<if test="verificationTime != null">verification_time,
</if>
<if test="verificationNum != null">verification_num,
</if>
<if test="canVerificationNum != null">can_verification_num,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="dayVerificationNum != null">day_verification_num,
</if>
<if test="monthVerificationNum != null">month_verification_num,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderDetailId != null">#{orderDetailId},
</if>
<if test="verificationCode != null and verificationCode != ''">#{verificationCode},
</if>
<if test="ticketId != null">#{ticketId},
</if>
<if test="ticketName != null">#{ticketName},
</if>
<if test="verificationType != null">#{verificationType},
</if>
<if test="verificationTime != null">#{verificationTime},
</if>
<if test="verificationNum != null">#{verificationNum},
</if>
<if test="canVerificationNum != null">#{canVerificationNum},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="dayVerificationNum != null">#{dayVerificationNum},
</if>
<if test="monthVerificationNum != null">#{monthVerificationNum},
</if>
</trim>
</insert>
<update id="updateZdyTicketOrderDetailChild" parameterType="ZdyTicketOrderDetailChild">
update zdy_ticket_order_detail_child
<trim prefix="SET" suffixOverrides=",">
<if test="orderDetailId != null">order_detail_id =
#{orderDetailId},
</if>
<if test="verificationCode != null and verificationCode != ''">verification_code =
#{verificationCode},
</if>
<if test="ticketId != null">ticket_id =
#{ticketId},
</if>
<if test="ticketName != null">ticket_name =
#{ticketName},
</if>
<if test="verificationType != null">verification_type =
#{verificationType},
</if>
<if test="verificationTime != null">verification_time =
#{verificationTime},
</if>
<if test="verificationNum != null">verification_num =
#{verificationNum},
</if>
<if test="canVerificationNum != null">can_verification_num =
#{canVerificationNum},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="dayVerificationNum != null">day_verification_num =
#{dayVerificationNum},
</if>
<if test="monthVerificationNum != null">month_verification_num =
#{monthVerificationNum},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketOrderDetailChildById" parameterType="Long">
delete
from zdy_ticket_order_detail_child
where id = #{id}
</delete>
<delete id="deleteZdyTicketOrderDetailChildByIds" parameterType="String">
delete from zdy_ticket_order_detail_child where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectZdyChildListByOrderDetailId" parameterType="Long"
resultMap="ZdyTicketOrderDetailChildResult">
<include refid="selectZdyTicketOrderDetailChildVo"/>
where odc.order_detail_id =#{orderDetailId}
</select>
<select id="selectZdyChildListByDetailIdAndTicketId" resultMap="ZdyTicketOrderDetailChildResult">
<include refid="selectZdyTicketOrderDetailChildVo"/>
where odc.order_detail_id =#{orderDetailId}
and odc.can_verification_num > odc.verification_num
<if test="ticketList != null">
and odc.ticket_id in
<foreach item="ticketId" collection="ticketList" open="(" separator="," close=")">
#{ticketId}
</foreach>
</if>
</select>
</mapper>

View File

@@ -0,0 +1,159 @@
<?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.ticket.order.mapper.ZdyTicketOrderLogMapper">
<resultMap type="ZdyTicketOrderLog" id="ZdyTicketOrderLogResult">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="userId" column="user_id"/>
<result property="touristId" column="tourist_id"/>
<result property="verificationAdminId" column="verification_admin_id"/>
<result property="orderStatus" column="order_status"/>
<result property="content" column="content"/>
<result property="createTime" column="create_time"/>
<result property="serialNo" column="serial_no"/>
</resultMap>
<sql id="selectZdyTicketOrderLogVo">
SELECT a.id,
a.order_id,
e.order_code as orderCode,
a.user_id,
b.`name` as userName,
a.tourist_id,
c.`name` as touristName,
a.verification_admin_id,
d.nick_name as verificationName,
a.order_status,
a.content,
a.create_time,
a.serial_no
FROM zdy_ticket_order_log a
left join zdy_user b on b.id = a.user_id
left join zdy_user_tourist c on c.id = a.tourist_id
left join sys_user d on d.user_id = a.verification_admin_id
left join zdy_ticket_order e on e.id = a.order_id
</sql>
<select id="selectZdyTicketOrderLogList" parameterType="ZdyTicketOrderLog" resultMap="ZdyTicketOrderLogResult">
<include refid="selectZdyTicketOrderLogVo"/>
<where>
<if test="orderId != null ">
and a.order_id = #{orderId}
</if>
<if test="userId != null ">
and a.user_id = #{userId}
</if>
<if test="touristId != null ">
and a.tourist_id = #{touristId}
</if>
<if test="verificationAdminId != null ">
and a.verification_admin_id = #{verificationAdminId}
</if>
<if test="orderStatus != null and orderStatus != ''">
and a.order_status = #{orderStatus}
</if>
<if test="content != null and content != ''">
and a.content = #{content}
</if>
</where>
order by a.id desc
</select>
<select id="selectZdyTicketOrderLogById" parameterType="Long"
resultMap="ZdyTicketOrderLogResult">
<include refid="selectZdyTicketOrderLogVo"/>
where a.id = #{id}
</select>
<select id="selectZdyTicketOrderLogByOrderId" parameterType="Long"
resultMap="ZdyTicketOrderLogResult">
<include refid="selectZdyTicketOrderLogVo"/>
where a.order_id = #{orderId} order by a.id desc
</select>
<insert id="insertZdyTicketOrderLog" parameterType="ZdyTicketOrderLog" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_order_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,
</if>
<if test="userId != null">user_id,
</if>
<if test="touristId != null">tourist_id,
</if>
<if test="verificationAdminId != null">verification_admin_id,
</if>
<if test="orderStatus != null">order_status,
</if>
<if test="content != null">content,
</if>
<if test="serialNo != null">serial_no,
</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},
</if>
<if test="userId != null">#{userId},
</if>
<if test="touristId != null">#{touristId},
</if>
<if test="verificationAdminId != null">#{verificationAdminId},
</if>
<if test="orderStatus != null">#{orderStatus},
</if>
<if test="content != null">#{content},
</if>
<if test="serialNo != null">#{serialNo},
</if>
sysdate(),
</trim>
</insert>
<update id="updateZdyTicketOrderLog" parameterType="ZdyTicketOrderLog">
update zdy_ticket_order_log
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id =
#{orderId},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="touristId != null">tourist_id =
#{touristId},
</if>
<if test="verificationAdminId != null">verification_admin_id =
#{verificationAdminId},
</if>
<if test="orderStatus != null">order_status =
#{orderStatus},
</if>
<if test="content != null">content =
#{content},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="serialNo != null">serial_no =
#{serialNo},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketOrderLogById" parameterType="Long">
delete
from zdy_ticket_order_log
where id = #{id}
</delete>
<delete id="deleteZdyTicketOrderLogByIds" parameterType="String">
delete from zdy_ticket_order_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,102 @@
<?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.ticket.order.mapper.ZdyTicketOrderRefundDetailMapper">
<resultMap type="ZdyTicketOrderRefundDetail" id="ZdyTicketOrderRefundDetailResult">
<result property="id" column="id"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="refundItemId" column="refund_item_id"/>
</resultMap>
<sql id="selectZdyTicketOrderRefundDetailVo">
select id,
order_detail_id,
refund_item_id
from zdy_ticket_order_refund_detail
</sql>
<select id="selectZdyTicketOrderRefundDetailList" parameterType="ZdyTicketOrderRefundDetail"
resultMap="ZdyTicketOrderRefundDetailResult">
<include refid="selectZdyTicketOrderRefundDetailVo"/>
<where>
<if test="orderDetailId != null and orderDetailId != ''">
and order_detail_id = #{orderDetailId}
</if>
<if test="refundItemId != null">
and refund_item_id = #{refundItemId}
</if>
</where>
</select>
<select id="selectZdyTicketOrderRefundDetailById" parameterType="Long"
resultMap="ZdyTicketOrderRefundDetailResult">
<include refid="selectZdyTicketOrderRefundDetailVo"/>
where id = #{id}
</select>
<insert id="insertZdyTicketOrderRefundDetail" parameterType="ZdyTicketOrderRefundDetail" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_order_refund_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderDetailId != null and orderDetailId != ''">order_detail_id,
</if>
<if test="refundItemId != null">refund_item_id,
</if>
<if test="totalPrice != null">total_price,
</if>
<if test="totalFee != null">total_fee,
</if>
<if test="actualPrice != null">actual_price,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderDetailId != null and orderDetailId != ''">#{orderDetailId},
</if>
<if test="refundItemId != null">#{refundItemId},
</if>
<if test="totalPrice != null">#{totalPrice},
</if>
<if test="totalFee != null">#{totalFee},
</if>
<if test="actualPrice != null">#{actualPrice},
</if>
</trim>
</insert>
<update id="updateZdyTicketOrderRefundDetail" parameterType="ZdyTicketOrderRefundDetail">
update zdy_ticket_order_refund_detail
<trim prefix="SET" suffixOverrides=",">
<if test="orderDetailId != null and orderDetailId != ''">order_detail_id =
#{orderDetailId},
</if>
<if test="refundItemId != null">refund_item_id =
#{refundItemId},
</if>
<if test="totalPrice != null">total_price =
#{totalPrice},
</if>
<if test="totalFee != null">total_fee =
#{totalFee},
</if>
<if test="actualPrice != null">actual_price =
#{actualPrice},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketOrderRefundDetailById" parameterType="Long">
delete
from zdy_ticket_order_refund_detail
where id = #{id}
</delete>
<delete id="deleteZdyTicketOrderRefundDetailByIds" parameterType="String">
delete from zdy_ticket_order_refund_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,219 @@
<?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.ticket.order.mapper.ZdyTicketOrderRefundItemMapper">
<resultMap type="ZdyTicketOrderRefundItem" id="ZdyTicketOrderRefundItemResult">
<result property="id" column="id"/>
<result property="refundId" column="refund_id"/>
<result property="orderItemId" column="order_item_id"/>
<result property="ticketClassify" column="ticket_classify"/>
<result property="ticketId" column="ticket_id"/>
<result property="refundQuantity" column="refund_quantity"/>
<result property="totalPrice" column="total_price"/>
<result property="totalFee" column="total_fee"/>
<result property="actualPrice" column="actual_price"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="ticketName" column="ticket_name"/>
<result property="settlementPrice" column="settlement_price"/>
<result property="deptId" column="dept_id"/>
<collection property="refundDetailList" javaType="java.util.List" ofType="ZdyTicketOrderRefundDetail"
select="selectZdyTicketOrderRefundDetailByRefundId" column="id"/>
</resultMap>
<resultMap type="ZdyTicketOrderRefundDetail" id="ZdyTicketOrderRefundDetailResult">
<result property="id" column="id"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="refundItemId" column="refund_item_id"/>
</resultMap>
<select id="selectZdyTicketOrderRefundDetailByRefundId" parameterType="Long"
resultMap="ZdyTicketOrderRefundDetailResult">
select *
from zdy_ticket_order_refund_detail
where refund_item_id = #{id}
</select>
<sql id="selectZdyTicketOrderRefundItemVo">
SELECT tor.id,
tor.order_item_id,
tor.refund_id,
tor.ticket_id,
tor.refund_quantity,
tor.total_price,
tor.total_fee,
tor.actual_price,
tor.create_time,
tor.update_time,
tor.ticket_classify,
tor.ticket_name,
tor.dept_id
FROM zdy_ticket_order_refund_item tor
LEFT JOIN zdy_ticket_order_refund r ON r.id = tor.refund_id
</sql>
<select id="selectZdyTicketOrderRefundItemList" parameterType="ZdyTicketOrderRefundItem"
resultMap="ZdyTicketOrderRefundItemResult">
<include refid="selectZdyTicketOrderRefundItemVo"/>
<where>
tor.del_flag = '0'
<if test="ticketClassify != null and ticketClassify != ''">
and tor.ticket_classify = #{ticketClassify}
</if>
</where>
order by tor.create_time desc
</select>
<select id="selectZdyTicketOrderRefundItemById" parameterType="Long"
resultMap="ZdyTicketOrderRefundItemResult">
<include refid="selectZdyTicketOrderRefundItemVo"/>
where tor.id = #{id}
</select>
<insert id="insertZdyTicketOrderRefundItem" parameterType="ZdyTicketOrderRefundItem" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_order_refund_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="refundId != null">refund_id,
</if>
<if test="orderItemId != null">order_item_id,
</if>
<if test="ticketClassify != null">ticket_classify,
</if>
<if test="ticketId != null">ticket_id,
</if>
<if test="refundQuantity != null">refund_quantity,
</if>
<if test="totalPrice != null">total_price,
</if>
<if test="totalFee != null">total_fee,
</if>
<if test="actualPrice != null">actual_price,
</if>
<if test="delFlag != null and delFlag != ''">del_flag,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="ticketName != null">ticket_name,
</if>
<if test="deptId != null">dept_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="refundId != null">#{refundId},
</if>
<if test="orderItemId != null">#{orderItemId},
</if>
<if test="ticketClassify != null">#{ticketClassify},
</if>
<if test="ticketId != null">#{ticketId},
</if>
<if test="refundQuantity != null">#{refundQuantity},
</if>
<if test="totalPrice != null">#{totalPrice},
</if>
<if test="totalFee != null">#{totalFee},
</if>
<if test="actualPrice != null">#{actualPrice},
</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="ticketName != null">#{ticketName},
</if>
<if test="deptId != null">#{deptId},
</if>
</trim>
</insert>
<update id="updateZdyTicketOrderRefundItem" parameterType="ZdyTicketOrderRefundItem">
update zdy_ticket_order_refund_item
<trim prefix="SET" suffixOverrides=",">
<if test="refundId != null">refund_id =
#{refundId},
</if>
<if test="orderItemId != null">order_item_id =
#{orderItemId},
</if>
<if test="ticketClassify != null">ticket_classify =
#{ticketClassify},
</if>
<if test="ticketId != null">ticket_id =
#{ticketId},
</if>
<if test="refundQuantity != null">refund_quantity =
#{refundQuantity},
</if>
<if test="totalPrice != null">total_price =
#{totalPrice},
</if>
<if test="totalFee != null">total_fee =
#{totalFee},
</if>
<if test="actualPrice != null">actual_price =
#{actualPrice},
</if>
<if test="delFlag != null and delFlag != ''">del_flag =
#{delFlag},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="ticketName != null">ticket_name =
#{ticketName},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketOrderRefundItemById" parameterType="Long">
delete
from zdy_ticket_order_refund_item
where id = #{id}
</delete>
<delete id="deleteZdyTicketOrderRefundItemByIds" parameterType="String">
delete from zdy_ticket_order_refund_item where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectZdyTicketOrderRefundItemByRefundId" parameterType="Long"
resultMap="ZdyTicketOrderRefundItemResult">
<include refid="selectZdyTicketOrderRefundItemVo"/>
where tor.refund_id = #{refundId}
</select>
</mapper>

View File

@@ -0,0 +1,147 @@
<?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.ticket.order.mapper.ZdyTicketOrderRefundLogMapper">
<resultMap type="ZdyTicketOrderRefundLog" id="ZdyTicketOrderDetailLogResult">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="refundId" column="refund_id"/>
<result property="userId" column="user_id"/>
<result property="orderStatus" column="order_status"/>
<result property="content" column="content"/>
<result property="createTime" column="create_time"/>
<result property="userName" column="user_name"/>
<result property="remark" column="remark"/>
<result property="type" column="type"/>
</resultMap>
<sql id="selectZdyTicketOrderRefundLogVo">
SELECT id,
order_id,
refund_id,
user_id,
order_status,
content,
create_time,
user_name,
remark,
type
FROM zdy_ticket_order_refund_log
</sql>
<select id="selectZdyTicketOrderRefundLogList" parameterType="ZdyTicketOrderRefundLog"
resultMap="ZdyTicketOrderDetailLogResult">
<include refid="selectZdyTicketOrderRefundLogVo"/>
<where>
<if test="orderId != null ">
and order_id = #{orderId}
</if>
<if test="refundId != null ">
and refund_id = #{refundId}
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
</where>
order by id desc
</select>
<select id="selectZdyTicketOrderRefundLogById" parameterType="Long"
resultMap="ZdyTicketOrderDetailLogResult">
<include refid="selectZdyTicketOrderRefundLogVo"/>
where id = #{id}
</select>
<insert id="insertZdyTicketOrderRefundLog" parameterType="ZdyTicketOrderRefundLog" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_order_refund_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,
</if>
<if test="refundId != null">refund_id,
</if>
<if test="userId != null">user_id,
</if>
<if test="orderStatus != null">order_status,
</if>
<if test="content != null">content,
</if>
<if test="userName != null">user_name,
</if>
<if test="remark != null">remark,
</if>
<if test="type != null">type,
</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},
</if>
<if test="refundId != null">#{refundId},
</if>
<if test="userId != null">#{userId},
</if>
<if test="orderStatus != null">#{orderStatus},
</if>
<if test="content != null">#{content},
</if>
<if test="userName != null">#{userName},
</if>
<if test="remark != null">#{remark},
</if>
<if test="type != null">#{type},
</if>
sysdate(),
</trim>
</insert>
<update id="updateZdyTicketOrderRefundLog" parameterType="ZdyTicketOrderRefundLog">
update zdy_ticket_order_refund_log
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id =
#{orderId},
</if>
<if test="refundId != null">refund_id =
#{refundId},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="orderStatus != null">order_status =
#{orderStatus},
</if>
<if test="content != null">content =
#{content},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="userName != null">user_name =
#{userName},
</if>
<if test="remark != null">remark =
#{remark},
</if>
<if test="type != null">type =
#{type},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketOrderRefundLogById" parameterType="Long">
delete
from zdy_ticket_order_refund_log
where id = #{id}
</delete>
<delete id="deleteZdyTicketOrderRefundLogByIds" parameterType="String">
delete from zdy_ticket_order_refund_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,442 @@
<?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.ticket.order.mapper.ZdyTicketOrderRefundMapper">
<resultMap type="ZdyTicketOrderRefundVo" id="ZdyTicketOrderRefundResult">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="refundCode" column="refund_code"/>
<result property="orderPrepayId" column="order_prepay_id"/>
<result property="userId" column="user_id"/>
<result property="refundQuantity" column="refund_quantity"/>
<result property="totalPrice" column="total_price"/>
<result property="totalFee" column="total_fee"/>
<result property="actualPrice" column="actual_price"/>
<result property="refundStatus" column="refund_status"/>
<result property="refundTime" column="refund_time"/>
<result property="personalRefundType" column="personal_refund_type"/>
<result property="businessRefundType" column="business_refund_type"/>
<result property="refundDescribe" column="refund_describe"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="userName" column="userName"/>
<result property="userPhone" column="userPhone"/>
<result property="tourId" column="tour_id"/>
<result property="refundSource" column="refund_source"/>
<result property="travelAgencyId" column="travel_agency_id"/>
<result property="orderTime" column="orderTime"/>
<result property="orderCode" column="orderCode"/>
<result property="ticketSupplier" column="ticket_supplier"/>
<collection property="orderRefundItemList" javaType="java.util.List" ofType="ZdyTicketOrderRefundItem"
select="selectZdyTicketOrderRefundItemByRefundId" column="id"/>
</resultMap>
<resultMap type="ZdyTicketOrderRefundItem" id="ZdyTicketOrderRefundItemResult">
<result property="id" column="id"/>
<result property="refundId" column="refund_id"/>
<result property="orderItemId" column="order_item_id"/>
<result property="ticketClassify" column="ticket_classify"/>
<result property="ticketId" column="ticket_id"/>
<result property="refundQuantity" column="refund_quantity"/>
<result property="totalPrice" column="total_price"/>
<result property="totalFee" column="total_fee"/>
<result property="actualPrice" column="actual_price"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="ticketName" column="ticket_name"/>
<result property="settlementPrice" column="settlement_price"/>
<result property="deptId" column="dept_id"/>
<collection property="refundDetailList" javaType="java.util.List" ofType="ZdyTicketOrderRefundDetail"
select="selectZdyTicketOrderRefundDetailByRefundId" column="id"/>
</resultMap>
<resultMap type="ZdyTicketOrderRefundDetail" id="ZdyTicketOrderRefundDetailResult">
<result property="id" column="id"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="refundItemId" column="refund_item_id"/>
</resultMap>
<resultMap type="ZdyTicketOrderDetailRefundSuccessVo" id="ZdyTicketOrderDetailRefundSuccessVoResult">
<result property="personalRefundType" column="personal_refund_type"/>
<result property="businessRefundType" column="business_refund_type"/>
<result property="remark" column="remark"/>
<result property="payableAmount" column="payable_amount"/>
<result property="actualPrice" column="actual_price"/>
<result property="refundTime" column="refund_time"/>
<result property="operaUserName" column="opera_user_name"/>
</resultMap>
<select id="selectZdyTicketOrderRefundDetailByRefundId" parameterType="Long"
resultMap="ZdyTicketOrderRefundDetailResult">
select *
from zdy_ticket_order_refund_detail
where refund_item_id = #{id}
</select>
<select id="selectZdyTicketOrderRefundItemByRefundId" parameterType="Long"
resultMap="ZdyTicketOrderRefundItemResult">
SELECT tor.id,
tor.order_item_id,
tor.refund_id,
tor.ticket_id,
tor.refund_quantity,
tor.total_price,
tor.total_fee,
tor.actual_price,
tor.create_time,
tor.update_time,
tor.ticket_classify,
tor.ticket_name,
tor.dept_id,
o.order_code as orderCode
FROM zdy_ticket_order_refund_item tor
LEFT JOIN zdy_ticket_order_item o ON o.id = tor.order_item_id
where tor.refund_id = #{id}
</select>
<sql id="selectZdyTicketOrderRefundVo">
SELECT
tor.id,
tor.order_id,
tor.refund_code,
tor.order_prepay_id,
tor.user_id,
tor.refund_quantity,
tor.total_price,
tor.total_fee,
tor.actual_price,
tor.refund_status,
tor.refund_time,
tor.personal_refund_type,
tor.business_refund_type,
tor.refund_describe,
tor.create_time,
tor.update_time,
tor.create_by,
tor.tour_id,
tor.ticket_supplier,
o.order_code as orderCode,
tor.refund_source,
o.travel_agency_id,
o.create_time orderTime,
CASE WHEN ( us.NAME IS NULL OR us.NAME = '' ) THEN
us.nickname ELSE us.NAME
END AS userName,
us.mobile AS userPhone
FROM
zdy_ticket_order_refund tor
LEFT JOIN zdy_ticket_order o ON o.id = tor.order_id
LEFT JOIN zdy_user us ON us.id = tor.user_id
</sql>
<select id="selectZdyTicketOrderRefundList" parameterType="com.zhwl.ticket.order.dto.ZdyTicketOrderRefundDto"
resultMap="ZdyTicketOrderRefundResult">
<include refid="selectZdyTicketOrderRefundVo"/>
<where>
tor.del_flag = '0'
<if test="orderId != null and orderId != ''">
and tor.order_id = #{orderId}
</if>
<if test="refundCode != null and refundCode != ''">
and tor.refund_code = #{refundCode}
</if>
<if test="orderPrepayId != null ">
and tor.order_prepay_id = #{orderPrepayId}
</if>
<if test="userId != null ">
and tor.user_id = #{userId}
</if>
<if test="refundStatus != null and refundStatus != ''">
and tor.refund_status = #{refundStatus}
</if>
<if test="orderCode != null and orderCode != ''">
and o.order_code = #{orderCode}
</if>
<if test="userName != null and userName != ''">
and (us.name like concat('%',#{userName},'%') or us.nickname like concat('%',#{userName},'%'))
</if>
<if test="refundStartTime != null and refundEndTime != null">
and tor.create_time between #{refundStartTime} and #{refundEndTime}
</if>
<if test="tourId != null">
and tor.tour_id = #{tourId}
</if>
<if test="refundSource != null and refundSource != ''">
and tor.refund_source = #{refundSource}
</if>
<if test="travelAgencyId != null">
and o.travel_agency_id = #{travelAgencyId}
</if>
AND tor.id IN (SELECT DISTINCT item.refund_id
FROM
zdy_ticket_order_refund_item item
left join sys_dept d on d.dept_id = item.dept_id
<where>
${params.dataScope}
</where>
)
</where>
order by tor.create_time desc
</select>
<select id="selectZdyTicketOrderRefundById" parameterType="Long"
resultMap="ZdyTicketOrderRefundResult">
<include refid="selectZdyTicketOrderRefundVo"/>
where tor.id = #{id}
</select>
<insert id="insertZdyTicketOrderRefund" parameterType="ZdyTicketOrderRefund" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_order_refund
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null and orderId != ''">order_id,
</if>
<if test="refundCode != null and refundCode != ''">refund_code,
</if>
<if test="orderPrepayId != null">order_prepay_id,
</if>
<if test="refundSource != null">refund_source,
</if>
<if test="userId != null">user_id,
</if>
<if test="refundQuantity != null">refund_quantity,
</if>
<if test="totalPrice != null">total_price,
</if>
<if test="totalFee != null">total_fee,
</if>
<if test="actualPrice != null">actual_price,
</if>
<if test="refundStatus != null and refundStatus != ''">refund_status,
</if>
<if test="refundTime != null">refund_time,
</if>
<if test="personalRefundType != null">personal_refund_type,
</if>
<if test="businessRefundType != null">business_refund_type,
</if>
<if test="refundDescribe != null">refund_describe,
</if>
<if test="delFlag != null and delFlag != ''">del_flag,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="tourId != null">tour_id,
</if>
<if test="remark != null">remark,
</if>
<if test="operaType != null">opera_type,
</if>
<if test="ticketSupplier != null and ticketSupplier != ''">ticket_supplier,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null and orderId != ''">#{orderId},
</if>
<if test="refundCode != null and refundCode != ''">#{refundCode},
</if>
<if test="orderPrepayId != null">#{orderPrepayId},
</if>
<if test="refundSource != null">#{refundSource},
</if>
<if test="userId != null">#{userId},
</if>
<if test="refundQuantity != null">#{refundQuantity},
</if>
<if test="totalPrice != null">#{totalPrice},
</if>
<if test="totalFee != null">#{totalFee},
</if>
<if test="actualPrice != null">#{actualPrice},
</if>
<if test="refundStatus != null and refundStatus != ''">#{refundStatus},
</if>
<if test="refundTime != null">#{refundTime},
</if>
<if test="personalRefundType != null">#{personalRefundType},
</if>
<if test="businessRefundType != null">#{businessRefundType},
</if>
<if test="refundDescribe != null">#{refundDescribe},
</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="tourId != null">#{tourId},
</if>
<if test="remark != null">#{remark},
</if>
<if test="operaType != null">#{operaType},
</if>
<if test="ticketSupplier != null and ticketSupplier != ''">#{ticketSupplier},
</if>
</trim>
</insert>
<update id="updateZdyTicketOrderRefund" parameterType="ZdyTicketOrderRefund">
update zdy_ticket_order_refund
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null and orderId != ''">order_id =
#{orderId},
</if>
<if test="refundCode != null and refundCode != ''">refund_code =
#{refundCode},
</if>
<if test="orderPrepayId != null">order_prepay_id =
#{orderPrepayId},
</if>
<if test="refundSource != null">refund_source =
#{refundSource},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="refundQuantity != null">refund_quantity =
#{refundQuantity},
</if>
<if test="totalPrice != null">total_price =
#{totalPrice},
</if>
<if test="totalFee != null">total_fee =
#{totalFee},
</if>
<if test="actualPrice != null">actual_price =
#{actualPrice},
</if>
<if test="refundStatus != null and refundStatus != ''">refund_status =
#{refundStatus},
</if>
<if test="refundTime != null">refund_time =
#{refundTime},
</if>
<if test="personalRefundType != null">personal_refund_type =
#{personalRefundType},
</if>
<if test="businessRefundType != null">business_refund_type =
#{businessRefundType},
</if>
<if test="refundDescribe != null">refund_describe =
#{refundDescribe},
</if>
<if test="delFlag != null and delFlag != ''">del_flag =
#{delFlag},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="tourId != null">tour_id =
#{tourId},
</if>
<if test="remark != null">remark =
#{remark},
</if>
<if test="operaType != null">opera_type =
#{operaType},
</if>
<if test="ticketSupplier != null and ticketSupplier != ''">ticket_supplier =
#{ticketSupplier},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketOrderRefundById" parameterType="Long">
delete
from zdy_ticket_order_refund
where id = #{id}
</delete>
<delete id="deleteZdyTicketOrderRefundByIds" parameterType="String">
delete from zdy_ticket_order_refund where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectZdyTicketOrderRefundByOrderId" parameterType="Long"
resultMap="ZdyTicketOrderRefundResult">
<include refid="selectZdyTicketOrderRefundVo"/>
where tor.order_id = #{orderId}
</select>
<select id="selectZdyTicketOrderRefundByOrderCode"
resultMap="ZdyTicketOrderRefundResult">
<include refid="selectZdyTicketOrderRefundVo"/>
where o.order_code = #{orderCode}
</select>
<select id="selectZdyTicketOrderRefundByRefundCode" parameterType="String"
resultMap="ZdyTicketOrderRefundResult">
<include refid="selectZdyTicketOrderRefundVo"/>
where tor.refund_code = #{refundCode}
</select>
<select id="selectZdyTicketOrderRefundByOrderDetailId" parameterType="Long"
resultMap="ZdyTicketOrderRefundResult">
SELECT
*
FROM
zdy_ticket_order_refund
WHERE
id IN (
SELECT
refund_id
FROM
zdy_ticket_order_refund_item
WHERE
id IN ( SELECT refund_item_id FROM zdy_ticket_order_refund_detail WHERE order_detail_id = #{orderDetailId} ))
AND refund_source = '4'
limit 1
</select>
<select id="selectRefundSuccessDetailByDetailId" resultMap="ZdyTicketOrderDetailRefundSuccessVoResult">
SELECT IF((ztor.create_by IS NULL OR ztor.create_by = ''),
zu.nickname,
su.nick_name
) AS opera_user_name,
ztod.payable_amount as payable_amount,
ztord.actual_price,
ztor.personal_refund_type,
ztor.business_refund_type,
ztor.remark,
ztor.refund_time
FROM zdy_ticket_order_refund_detail ztord
LEFT JOIN zdy_ticket_order_refund_item ztori ON ztori.id = ztord.refund_item_id
LEFT JOIN zdy_ticket_order_refund ztor ON ztor.id = ztori.refund_id
LEFT JOIN zdy_ticket_order_detail ztod on ztod.id = ztord.order_detail_id
LEFT JOIN zdy_user zu ON zu.id = ztor.user_id
LEFT JOIN sys_user su ON su.user_id = ztor.create_by
WHERE ztord.order_detail_id = #{detailId}
AND ztor.refund_time IS NOT NULL
</select>
</mapper>

View File

@@ -0,0 +1,433 @@
<?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.ticket.order.mapper.ZdyTicketOrderVerificationHistoryMapper">
<resultMap type="ZdyTicketOrderVerificationHistory" id="ZdyTicketOrderVerificationHistoryResult">
<result property="id" column="id"/>
<result property="orderItemId" column="order_item_id"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="touristId" column="tourist_id"/>
<result property="usedUserId" column="used_user_id"/>
<result property="createTime" column="create_time"/>
<result property="verificationNum" column="verification_num"/>
<result property="verificationAdminId" column="verification_admin_id"/>
<result property="updateTime" column="update_time"/>
<result property="scenicName" column="scenicName"/>
<result property="ticketName" column="ticketName"/>
<result property="userName" column="userName"/>
<result property="mobile" column="mobile"/>
<result property="idCard" column="idCard"/>
<result property="ticketId" column="ticket_id"/>
<result property="scenicId" column="scenic_id"/>
<result property="scenicImage" column="scenicImage"/>
<result property="verificationName" column="verificationName"/>
<result property="verificationClassify" column="verification_classify"/>
<result property="type" column="type"/>
<result property="verificationCode" column="verification_code"/>
<result property="image11" column="image11"/>
<result property="orderDetailChildId" column="order_detail_child_id"/>
<result property="serialNo" column="serial_no"/>
<result property="verificationMode" column="verification_mode"/>
<result property="childTicketId" column="child_ticket_id"/>
<result property="deptId" column="dept_id"/>
</resultMap>
<sql id="selectZdyTicketOrderVerificationHistoryVo">
SELECT
his.id,
his.order_item_id,
his.order_detail_id,
his.tourist_id,
his.used_user_id,
his.create_time,
his.verification_num,
his.verification_admin_id,
his.update_time,
his.ticket_id,
his.scenic_id,
his.verification_classify,
his.type,
his.verification_code,
sc.scenic_name AS scenicName,
sc.image AS scenicImage,
tou.`name` AS userName,
tou.mobile,
tou.id_card idCard,
u.nick_name AS verificationName,
his.order_detail_child_id,
his.serial_no,
his.verification_mode,
his.child_ticket_id,
his.dept_id
FROM
zdy_ticket_order_verification_history his
LEFT JOIN zdy_scenic sc ON sc.id = his.scenic_id
LEFT JOIN zdy_user_tourist tou ON tou.id = his.tourist_id
LEFT JOIN sys_user u ON u.user_id = his.verification_admin_id
</sql>
<sql id="selectScenicTicketOrderVerificationHistoryVo">
SELECT
his.id,
his.order_item_id,
his.order_detail_id,
his.tourist_id,
his.used_user_id,
his.create_time,
his.verification_num,
his.verification_admin_id,
his.update_time,
his.ticket_id,
his.scenic_id,
his.verification_classify,
his.type,
his.verification_code,
sc.scenic_name AS scenicName,
sc.image AS scenicImage,
tou.`name` AS userName,
tou.mobile,
tou.id_card idCard,
u.nick_name AS verificationName,
act.name as ticketName,
act.image11 as image11,
his.order_detail_child_id,
his.serial_no,
his.verification_mode,
his.child_ticket_id,
his.dept_id
FROM
zdy_ticket_order_verification_history his
LEFT JOIN zdy_ticket act ON act.id = his.ticket_id
LEFT JOIN zdy_scenic sc ON sc.id = his.scenic_id
LEFT JOIN zdy_user_tourist tou ON tou.id = his.tourist_id
LEFT JOIN sys_user u ON u.user_id = his.verification_admin_id
</sql>
<select id="selectScenicTicketOrderVerificationHistoryList" parameterType="ZdyTicketOrderVerificationHistory"
resultMap="ZdyTicketOrderVerificationHistoryResult">
<include refid="selectScenicTicketOrderVerificationHistoryVo"/>
left join sys_dept d on d.dept_id = his.dept_id
<where>
<if test="orderItemId != null ">
and his.order_item_id = #{orderItemId}
</if>
<if test="orderDetailId != null ">
and his.order_detail_id = #{orderDetailId}
</if>
<if test="touristId != null ">
and his.tourist_id = #{touristId}
</if>
<if test="usedUserId != null ">
and his.used_user_id = #{usedUserId}
</if>
<if test="verificationNum != null ">
and his.verification_num = #{verificationNum}
</if>
<if test="verificationAdminId != null ">
and his.verification_admin_id = #{verificationAdminId}
</if>
<if test="verificationClassify != null ">
and his.verification_classify = #{verificationClassify}
</if>
<if test="ticketName != null ">
and act.name like concat('%',#{ticketName},'%')
</if>
<if test="params.startTime != null and params.endTime != null">
and his.update_time between #{params.startTime} and #{params.endTime}
</if>
<if test="verificationMode != null ">
and his.verification_mode = #{verificationMode}
</if>
<if test="orderDetailChildId != null ">
and his.order_detail_child_id = #{orderDetailChildId}
</if>
<if test="ticketId != null ">
and his.ticket_id = #{ticketId}
</if>
and his.update_time is not null and his.type = '2'
${params.dataScope}
</where>
order by his.create_time desc
</select>
<select id="selectZdyTicketOrderVerificationHistoryById" parameterType="Long"
resultMap="ZdyTicketOrderVerificationHistoryResult">
<include refid="selectZdyTicketOrderVerificationHistoryVo"/>
where his.id = #{id}
</select>
<insert id="insertZdyTicketOrderVerificationHistory" parameterType="ZdyTicketOrderVerificationHistory"
useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_order_verification_history
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderItemId != null">order_item_id,
</if>
<if test="orderDetailId != null">order_detail_id,
</if>
<if test="touristId != null">tourist_id,
</if>
<if test="usedUserId != null">used_user_id,
</if>
<if test="createTime != null">create_time,
</if>
<if test="verificationNum != null">verification_num,
</if>
<if test="verificationAdminId != null">verification_admin_id,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="ticketId != null">ticket_id,
</if>
<if test="scenicId != null">scenic_id,
</if>
<if test="verificationClassify != null">verification_classify,
</if>
<if test="type != null">type,
</if>
<if test="verificationCode != null">verification_code,
</if>
<if test="orderDetailChildId != null">order_detail_child_id,
</if>
<if test="serialNo != null">serial_no,
</if>
<if test="verificationMode != null">verification_mode,
</if>
<if test="childTicketId != null">child_ticket_id,
</if>
<if test="deptId != null">dept_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderItemId != null">#{orderItemId},
</if>
<if test="orderDetailId != null">#{orderDetailId},
</if>
<if test="touristId != null">#{touristId},
</if>
<if test="usedUserId != null">#{usedUserId},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="verificationNum != null">#{verificationNum},
</if>
<if test="verificationAdminId != null">#{verificationAdminId},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="ticketId != null">#{ticketId},
</if>
<if test="scenicId != null">#{scenicId},
</if>
<if test="verificationClassify != null">#{verificationClassify},
</if>
<if test="type != null">#{type},
</if>
<if test="verificationCode != null">#{verificationCode},
</if>
<if test="orderDetailChildId != null">#{orderDetailChildId},
</if>
<if test="serialNo != null">#{serialNo},
</if>
<if test="verificationMode != null">#{verificationMode},
</if>
<if test="childTicketId != null">#{childTicketId},
</if>
<if test="deptId != null">#{deptId},
</if>
</trim>
</insert>
<update id="updateZdyTicketOrderVerificationHistory" parameterType="ZdyTicketOrderVerificationHistory">
update zdy_ticket_order_verification_history
<trim prefix="SET" suffixOverrides=",">
<if test="orderItemId != null">order_item_id =
#{orderItemId},
</if>
<if test="orderDetailId != null">order_detail_id =
#{orderDetailId},
</if>
<if test="touristId != null">tourist_id =
#{touristId},
</if>
<if test="usedUserId != null">used_user_id =
#{usedUserId},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="verificationNum != null">verification_num =
#{verificationNum},
</if>
<if test="verificationAdminId != null">verification_admin_id =
#{verificationAdminId},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="ticketId != null">ticket_id =
#{ticketId},
</if>
<if test="scenicId != null">scenic_id =
#{scenicId},
</if>
<if test="verificationClassify != null">verification_classify =
#{verificationClassify},
</if>
<if test="type != null">type =
#{type},
</if>
<if test="verificationCode != null">verification_code =
#{verificationCode},
</if>
<if test="orderDetailChildId != null">order_detail_child_id =
#{orderDetailChildId},
</if>
<if test="serialNo != null">serial_no =
#{serialNo},
</if>
<if test="verificationMode != null">verification_mode =
#{verificationMode},
</if>
<if test="childTicketId != null">child_ticket_id =
#{childTicketId},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketOrderVerificationHistoryById" parameterType="Long">
delete
from zdy_ticket_order_verification_history
where id = #{id} and update_time is null
</delete>
<delete id="deleteZdyTicketOrderVerificationHistoryByIds" parameterType="String">
delete from zdy_ticket_order_verification_history where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectTicketOrderVerificationHistoryApp" parameterType="Long"
resultMap="ZdyTicketOrderVerificationHistoryResult">
SELECT
his.id,
his.order_item_id,
his.order_detail_id,
his.tourist_id,
his.used_user_id,
his.create_time,
his.verification_num,
his.verification_admin_id,
his.update_time,
his.ticket_id,
his.scenic_id,
his.verification_classify,
his.verification_code,
his.type,
sc.scenic_name AS scenicName,
tou.NAME AS userName,
tou.mobile,
tou.id_card AS idCard,
his.order_detail_child_id,
his.serial_no,
his.verification_mode,
his.child_ticket_id,
his.dept_id
FROM
zdy_ticket_order_verification_history his
LEFT JOIN zdy_scenic sc ON sc.id = his.scenic_id
LEFT JOIN zdy_user_tourist tou ON tou.id = his.tourist_id
where his.order_detail_id = #{orderDetailId} and his.type = '1'
order by his.update_time desc
</select>
<select id="selectZdyTicketOrderVerificationHistoryByCode" parameterType="String"
resultMap="ZdyTicketOrderVerificationHistoryResult">
<include refid="selectZdyTicketOrderVerificationHistoryVo"/>
where his.verification_code = #{verificationCode}
</select>
<select id="selectZdyTicketOrderVerificationHistoryByDetailId" parameterType="Long"
resultMap="ZdyTicketOrderVerificationHistoryResult">
SELECT
his.id,
his.create_time,
his.order_detail_child_id,
ch.ticket_id,
ch.ticket_name ticketName
FROM
zdy_ticket_order_verification_history his
LEFT JOIN zdy_ticket_order_detail_child ch ON ch.id = his.order_detail_child_id
where his.order_detail_id = #{orderDetailId}
order by his.create_time desc
</select>
<select id="selectHistoryCountByChildDetailId" parameterType="Long" resultType="int">
select count(1) as num from zdy_ticket_order_verification_history where order_detail_child_id = #{orderDetailChildId}
</select>
<select id="selectVerifyCount" resultType="com.zhwl.ticket.order.domain.vo.VerifiyLogCountVo$ChildCountVo">
SELECT
zt.id AS childTicketId,
SUM(CASE WHEN vh.ticket_id IS NOT NULL THEN 1 ELSE 0 END) AS num
FROM
zdy_ticket zt
LEFT JOIN
zdy_ticket_order_verification_history vh
ON
zt.id = vh.child_ticket_id
<if test="ticketId!=null">
AND vh.ticket_id =#{ticketId}
</if>
<if test="verfiyStartTime!=null and verfiyStartTime!=''">
and DATE(vh.create_time) >= DATE( #{verfiyStartTime})
</if>
<if test="verfiyEndTime!=null and verfiyEndTime!=''">
AND DATE( #{verfiyEndTime})>= DATE( vh.create_time)
</if>
<where>
<choose>
<when test="scenicId!=null">
and zt.scenic_id=#{scenicId}
</when>
<when test="childTicketIdList!=null and childTicketIdList.size()>0">
and zt.id IN
<foreach collection="childTicketIdList" item="ticketId" open="(" separator="," close=")">
#{ticketId}
</foreach>
</when>
<otherwise>
and 0=1
</otherwise>
</choose>
</where>
GROUP BY
zt.id
</select>
<select id="selectVerifyCountByClassify" resultType="java.lang.Integer">
SELECT
COUNT( 1 ) count
FROM
zdy_ticket_order_verification_history h
LEFT JOIN zdy_ticket t ON ( h.child_ticket_id = t.id OR h.ticket_id = t.id )
WHERE
t.classify = #{classify}
<if test="startTime!=null">
AND h.create_time >= #{startTime}
</if>
<if test="endTime!=null">
AND #{endTime} >= h.create_time
</if>
</select>
</mapper>