实现移动端订单列表和订单详情接口

This commit is contained in:
longbinbin
2024-12-05 14:46:07 +08:00
parent 4822174c5e
commit 3114fc7046
10 changed files with 374 additions and 22 deletions

View File

@ -1,7 +1,7 @@
<?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.mapper.pc.OrderMapper">
<resultMap id="BaseResultMap" type="com.ycwl.basic.model.pc.order.resp.OrderRespVO">
<resultMap id="PCBaseResultMap" type="com.ycwl.basic.model.pc.order.resp.OrderRespVO">
<id column="id" property="id"/>
<result column="member_id" property="memberId"/>
<result column="nickname" property="memberNickname"/>
@ -25,6 +25,36 @@
<result column="id" property="orderId"/>
<result column="goods_type" property="goodsType"/>
<result column="goods_id" property="goodsId"/>
<result column="scenicName" property="scenicName"/>
<result column="goodsName" property="goodsName"/>
<result column="videoUrl" property="videoUrl"/>
<result column="imgUrl" property="imgUrl"/>
<result column="sourceType" property="sourceType"/>
</collection>
</resultMap>
<resultMap id="AppBaseResultMap" type="com.ycwl.basic.model.pc.order.resp.OrderAppRespVO">
<id column="id" property="id"/>
<result column="price" property="price"/>
<result column="pay_price" property="payPrice"/>
<result column="remark" property="remark"/>
<result column="refund_reason" property="refundReason"/>
<result column="refund_status" property="refundStatus"/>
<result column="status" property="status"/>
<result column="refund_at" property="refundAt"/>
<result column="pay_at" property="payAt"/>
<result column="cancel_at" property="cancelAt"/>
<result column="create_at" property="createAt"/>
<result column="update_at" property="updateAt"/>
<collection property="orderItemList" ofType="com.ycwl.basic.model.pc.order.resp.OrderItemVO">
<result column="oiId" property="id"/>
<result column="id" property="orderId"/>
<result column="goods_type" property="goodsType"/>
<result column="goods_id" property="goodsId"/>
<result column="scenicName" property="scenicName"/>
<result column="goodsName" property="goodsName"/>
<result column="videoUrl" property="videoUrl"/>
<result column="imgUrl" property="imgUrl"/>
<result column="sourceType" property="sourceType"/>
</collection>
</resultMap>
<insert id="add">
@ -73,12 +103,92 @@
<delete id="deleteById">
delete from `order` where id = #{id}
</delete>
<select id="list" resultMap="BaseResultMap">
select o.id, o.member_id,m.nickname ,m.real_name , o.openid, price, pay_price, remark, o.broker_id, o.promo_code,
<select id="list" resultMap="PCBaseResultMap">
select o.id, o.member_id,m.nickname ,m.real_name , o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at,oi.id oiId, oi.goods_type, oi.goods_id
from `order` o
left join member m on o.member_id = m.id
left join order_item oi on o.id = oi.order_id
left join source sr on oi.goods_type='2' and oi.goods_id = sr.id
left join video vd on oi.goods_type='1' and oi.goods_id = vd.id
<where>
<if test="id!= null ">
and o.id = #{id}
</if>
<if test="memberNickname!= null and memberNickname!=''">
and m.nickname like concat('%',#{memberNickname},'%')
</if>
<if test="memberRealName!= null and memberRealName!=''">
and m.real_name like concat('%',#{memberRealName},'%')
</if>
<if test="price!= null ">
and o.price = #{price}
</if>
<if test="payPrice!= null ">
and pay_price = #{payPrice}
</if>
<if test="remark!= null and remark!= ''">
and remark like concat('%',#{remark},'%')
</if>
<if test="brokerId!= null ">
and o.broker_id = #{brokerId}
</if>
<if test="promoCode!= null and promoCode!= ''">
and o.promo_code like concat('%',#{promoCode},'%')
</if>
<if test="refundReason!= null and refundReason!= ''">
and refund_reason like concat('%',#{refundReason},'%')
</if>
<if test="refundStatus!= null ">
and refund_status = #{refundStatus}
</if>
<if test="status!= null ">
and o.`status` = #{status}
</if>
<if test="startCreateTime!= null ">
and o.create_at >= #{startCreateTime}
</if>
<if test="endCreateTime!= null ">
and o.create_at &lt;= #{endCreateTime}
</if>
<if test="startPayTime!= null ">
and pay_at &gt;= #{startPayTime}
</if>
<if test="endPayTime!= null ">
and pay_at &lt;= #{endPayTime}
</if>
<if test="startRefundTime!= null ">
and refund_at &gt;= #{startRefundTime}
</if>
<if test="endRefundTime!= null ">
and refund_at &lt;= #{endRefundTime}
</if>
<if test="startCancelTime!= null ">
and cancel_at &gt;= #{startCancelTime}
</if>
<if test="endCancelTime!= null ">
and cancel_at &lt;= #{endCancelTime}
</if>
</where>
order by o.create_at desc
</select>
<select id="getById" resultMap="PCBaseResultMap">
select o.id, o.member_id, o.openid, o.price, o.pay_price, o.remark, o.broker_id, o.promo_code, o.refund_reason,
o.refund_status, o.status, o.create_at, o.update_at, o.pay_at, o.cancel_at, o.refund_at,
m.nickname , m.real_name
from `order` o
left join member m on m.id = o.member_id
left join order_item oi on o.id = oi.order_id
left join template t on oi.goods_type='3' and oi.goods_id = t.id
left join source sr on oi.goods_type='2' and oi.goods_id = sr.id
left join video vd on oi.goods_type='1' and oi.goods_id = vd.id
where o.id = #{id}
</select>
<select id="getOrderCount" resultType="com.ycwl.basic.utils.ApiResponse">
select count(1) num
from `order` o
left join member m on o.member_id = m.id
left join order_item oi on o.id = oi.order_id
left join template t on oi.goods_type='3' and oi.goods_id = t.id
left join source sr on oi.goods_type='2' and oi.goods_id = sr.id
left join video vd on oi.goods_type='1' and oi.goods_id = vd.id
@ -86,6 +196,9 @@
<if test="id!= null ">
and o.id = #{id}
</if>
<if test="memberId!= null ">
and o.member_id = #{memberId}
</if>
<if test="memberNickname!= null and memberNickname!=''">
and m.nickname like concat('%',#{memberNickname},'%')
</if>
@ -141,18 +254,95 @@
and cancel_at &lt;= #{endCancelTime}
</if>
</where>
order by o.create_at desc
</select>
<select id="getById" resultMap="BaseResultMap">
select o.id, o.member_id, o.openid, o.price, o.pay_price, o.remark, o.broker_id, o.promo_code, o.refund_reason,
o.refund_status, o.status, o.create_at, o.update_at, o.pay_at, o.cancel_at, o.refund_at,
m.nickname , m.real_name
from `order` o
left join member m on m.id = o.member_id
<select id="appList" resultMap="AppBaseResultMap">
select o.id, o.member_id,m.nickname ,m.real_name , o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at,oi.id oiId, oi.goods_type, oi.goods_id,
sc.name scenicName,
if(oi.goods_type='1',t.name,(select count(1) from order_item oi2 where oi2.order_id=o.id)) as goodsName,
if(oi.goods_type='1',vd.video_url,sr.video_url) videoUrl,
if(oi.goods_type='2',sr.url,null) imgUrl,
if(oi.goods_type='2',sr.type,null) sourceType
from `order` o
left join member m on o.member_id = m.id
left join order_item oi on o.id = oi.order_id
left join template t on oi.goods_type='3' and oi.goods_id = t.id
left join source sr on oi.goods_type='2' and oi.goods_id = sr.id
left join video vd on oi.goods_type='1' and oi.goods_id = vd.id
left join template t on oi.goods_type='1' and vd.template_id=t.id
left join scenic sc on (oi.goods_type='1' and vd.scenic_id=sc.id) or (oi.goods_type='2' and sr.scenic_id=sc.id)
<where>
<if test="memberNickname!= null and memberNickname!=''">
and m.nickname like concat('%',#{memberNickname},'%')
</if>
<if test="memberRealName!= null and memberRealName!=''">
and m.real_name like concat('%',#{memberRealName},'%')
</if>
<if test="price!= null ">
and o.price = #{price}
</if>
<if test="payPrice!= null ">
and pay_price = #{payPrice}
</if>
<if test="remark!= null and remark!= ''">
and remark like concat('%',#{remark},'%')
</if>
<if test="brokerId!= null ">
and o.broker_id = #{brokerId}
</if>
<if test="promoCode!= null and promoCode!= ''">
and o.promo_code like concat('%',#{promoCode},'%')
</if>
<if test="refundReason!= null and refundReason!= ''">
and refund_reason like concat('%',#{refundReason},'%')
</if>
<if test="refundStatus!= null ">
and refund_status = #{refundStatus}
</if>
<if test="status!= null ">
and o.`status` = #{status}
</if>
<if test="startCreateTime!= null ">
and o.create_at >= #{startCreateTime}
</if>
<if test="endCreateTime!= null ">
and o.create_at &lt;= #{endCreateTime}
</if>
<if test="startPayTime!= null ">
and pay_at &gt;= #{startPayTime}
</if>
<if test="endPayTime!= null ">
and pay_at &lt;= #{endPayTime}
</if>
<if test="startRefundTime!= null ">
and refund_at &gt;= #{startRefundTime}
</if>
<if test="endRefundTime!= null ">
and refund_at &lt;= #{endRefundTime}
</if>
<if test="startCancelTime!= null ">
and cancel_at &gt;= #{startCancelTime}
</if>
<if test="endCancelTime!= null ">
and cancel_at &lt;= #{endCancelTime}
</if>
</where>
order by o.create_at desc
</select>
<select id="appDetail" resultMap="AppBaseResultMap">
select o.id, o.member_id,m.nickname ,m.real_name , o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at,oi.id oiId, oi.goods_type, oi.goods_id,
sc.name scenicName,
if(oi.goods_type='1',t.name,(select count(1) from order_item oi2 where oi2.order_id=o.id)) as goodsName,
if(oi.goods_type='1',vd.video_url,sr.video_url) videoUrl,
if(oi.goods_type='2',sr.url,null) imgUrl,
if(oi.goods_type='2',sr.type,null) sourceType
from `order` o
left join member m on o.member_id = m.id
left join order_item oi on o.id = oi.order_id
left join source sr on oi.goods_type='2' and oi.goods_id = sr.id
left join video vd on oi.goods_type='1' and oi.goods_id = vd.id
left join template t on oi.goods_type='1' and vd.template_id=t.id
left join scenic sc on (oi.goods_type='1' and vd.scenic_id=sc.id) or (oi.goods_type='2' and sr.scenic_id=sc.id)
where o.id = #{id}
</select>
</mapper>