You've already forked FrameTour-BE
修改mapper文件路径
添加“MessageRecordMapper”
This commit is contained in:
321
src/main/resources/mapper/OrderMapper.xml
Normal file
321
src/main/resources/mapper/OrderMapper.xml
Normal file
@ -0,0 +1,321 @@
|
||||
<?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.OrderMapper">
|
||||
<resultMap id="PCBaseResultMap" type="com.ycwl.basic.model.pc.order.resp.OrderRespVO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="scenic_id" property="scenicId"/>
|
||||
<result column="scenic_name" property="scenicName"/>
|
||||
<result column="member_id" property="memberId"/>
|
||||
<result column="nickname" property="memberNickname"/>
|
||||
<result column="real_name" property="memberRealName"/>
|
||||
<result column="openid" property="openId"/>
|
||||
<result column="price" property="price"/>
|
||||
<result column="pay_price" property="payPrice"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="broker_id" property="brokerId"/>
|
||||
<result column="promo_code" property="promoCode"/>
|
||||
<result column="goods_type" property="goodsType"/>
|
||||
<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" select="getOrderItemList" column="id" ofType="com.ycwl.basic.model.pc.order.resp.OrderItemVO">
|
||||
<result column="oiId" property="id"/>
|
||||
<result column="orderId" property="orderId"/>
|
||||
<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"/>
|
||||
<result column="createTime" property="createTime"/>
|
||||
</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="goods_type" property="goodsType"/>
|
||||
<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"/>
|
||||
<result column="coverUrl" property="coverUrl"/>
|
||||
<collection property="orderItemList" select="getOrderItemList" column="id" ofType="com.ycwl.basic.model.pc.order.resp.OrderItemVO">
|
||||
<result column="oiId" property="id"/>
|
||||
<result column="orderId" property="orderId"/>
|
||||
<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>
|
||||
<select id="getOrderItemList" parameterType="java.lang.Long" resultType="com.ycwl.basic.model.pc.order.resp.OrderItemVO">
|
||||
select oi.id oiId,oi.order_id orderId,oi.goods_id,
|
||||
sc.name scenicName,t.cover_url coverUrl,
|
||||
if(oi.goods_type='1',t.name,(select count(1) from order_item oi2 where oi2.order_id=oi.order_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,
|
||||
if(oi.goods_type='1',vd.create_time,sr.create_time) createTime
|
||||
from order_item oi
|
||||
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 oi.order_id=#{id}
|
||||
</select>
|
||||
|
||||
<insert id="add">
|
||||
insert into `order`(id, member_id, openid,price, pay_price, remark, broker_id, promo_code,goods_type,scenic_id)
|
||||
VALUES (#{id}, #{memberId}, #{openid},#{price}, #{payPrice}, #{remark}, #{brokerId}, #{promoCode},#{goodsType},#{scenicId})
|
||||
</insert>
|
||||
<insert id="addOrderItems">
|
||||
insert into order_item(id, order_id,goods_type, goods_id) VALUES
|
||||
<foreach collection="orderItems" item="item" index="index" separator=",">
|
||||
(#{item.id}, #{item.orderId}, #{item.goodsType},#{item.goodsId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="update">
|
||||
update `order`
|
||||
<set>
|
||||
<if test="price!= null ">
|
||||
price = #{price},
|
||||
</if>
|
||||
<if test="payPrice!= null ">
|
||||
pay_price = #{payPrice},
|
||||
</if>
|
||||
<if test="remark!= null and remark!= ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="refundReason!= null and refundReason!= ''">
|
||||
refund_reason = #{refundReason},
|
||||
</if>
|
||||
<if test="refundStatus!= null ">
|
||||
refund_status = #{refundStatus},
|
||||
</if>
|
||||
<if test="status!= null ">
|
||||
`status` = #{status},
|
||||
</if>
|
||||
<if test="refundAt!= null ">
|
||||
refund_at = #{refundAt},
|
||||
</if>
|
||||
<if test="payAt!= null ">
|
||||
pay_at = #{payAt},
|
||||
</if>
|
||||
<if test="cancelAt!= null ">
|
||||
cancel_at = #{cancelAt},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="deleteById">
|
||||
delete from `order` where id = #{id}
|
||||
</delete>
|
||||
<select id="list" resultMap="PCBaseResultMap">
|
||||
select distinct o.id, o.scenic_id, s.name as scenic_name, 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, o.goods_type, oi.goods_id
|
||||
from `order` AS o
|
||||
left join member m on o.member_id = m.id
|
||||
left join scenic s on o.scenic_id = s.id
|
||||
left join order_item oi on o.id = oi.order_id
|
||||
left join source sr on o.goods_type='2' and oi.goods_id = sr.id
|
||||
left join video vd on o.goods_type='1' and oi.goods_id = vd.id
|
||||
<where>
|
||||
<if test="id!= null ">
|
||||
and o.id = #{id}
|
||||
</if>
|
||||
<if test="scenicId != null">
|
||||
and o.scenic_id = #{scenicId}
|
||||
</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 <= #{endCreateTime}
|
||||
</if>
|
||||
<if test="startPayTime!= null ">
|
||||
and pay_at >= #{startPayTime}
|
||||
</if>
|
||||
<if test="endPayTime!= null ">
|
||||
and pay_at <= #{endPayTime}
|
||||
</if>
|
||||
<if test="startRefundTime!= null ">
|
||||
and refund_at >= #{startRefundTime}
|
||||
</if>
|
||||
<if test="endRefundTime!= null ">
|
||||
and refund_at <= #{endRefundTime}
|
||||
</if>
|
||||
<if test="startCancelTime!= null ">
|
||||
and cancel_at >= #{startCancelTime}
|
||||
</if>
|
||||
<if test="endCancelTime!= null ">
|
||||
and cancel_at <= #{endCancelTime}
|
||||
</if>
|
||||
</where>
|
||||
order by o.create_at desc
|
||||
</select>
|
||||
<select id="getById" resultMap="PCBaseResultMap">
|
||||
select o.id, o.scenic_id, s.name as scenic_name, 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 scenic s on o.scenic_id = s.id
|
||||
left join order_item oi on o.id = oi.order_id
|
||||
left join template t on o.goods_type='3' and oi.goods_id = t.id
|
||||
left join source sr on o.goods_type='2' and oi.goods_id = sr.id
|
||||
left join video vd on o.goods_type='1' and oi.goods_id = vd.id
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
<select id="getOrderCount" resultType="java.lang.Integer">
|
||||
select count(1) num
|
||||
from `order` o
|
||||
left join member m on o.member_id = m.id
|
||||
<where>
|
||||
<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>
|
||||
<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 <= #{endCreateTime}
|
||||
</if>
|
||||
<if test="startPayTime!= null ">
|
||||
and pay_at >= #{startPayTime}
|
||||
</if>
|
||||
<if test="endPayTime!= null ">
|
||||
and pay_at <= #{endPayTime}
|
||||
</if>
|
||||
<if test="startRefundTime!= null ">
|
||||
and refund_at >= #{startRefundTime}
|
||||
</if>
|
||||
<if test="endRefundTime!= null ">
|
||||
and refund_at <= #{endRefundTime}
|
||||
</if>
|
||||
<if test="startCancelTime!= null ">
|
||||
and cancel_at >= #{startCancelTime}
|
||||
</if>
|
||||
<if test="endCancelTime!= null ">
|
||||
and cancel_at <= #{endCancelTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="appList" resultMap="AppBaseResultMap">
|
||||
select DISTINCT 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, o.goods_type,
|
||||
t.cover_url coverUrl
|
||||
from `order` AS 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 o.goods_type='2' and oi.goods_id = sr.id
|
||||
left join video vd on o.goods_type='1' and oi.goods_id = vd.id
|
||||
left join template t on o.goods_type='1' and vd.template_id=t.id
|
||||
|
||||
<where>
|
||||
<if test="memberId!=null">
|
||||
and o.member_id=#{memberId}
|
||||
</if>
|
||||
<if test="type!= null ">
|
||||
<if test="type== 0 ">
|
||||
and o.goods_type = 1
|
||||
</if>
|
||||
<if test="type== 1 ">
|
||||
and o.goods_type = 2 and sr.type = 1
|
||||
</if>
|
||||
<if test="type== 2 ">
|
||||
and o.goods_type = 2 and sr.type = 2
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
order by o.create_at desc
|
||||
</select>
|
||||
<select id="appDetail" resultMap="AppBaseResultMap">
|
||||
select distinct 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,o.goods_type
|
||||
,t.cover_url coverUrl
|
||||
from `order` AS 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 o.goods_type='2' and oi.goods_id = sr.id
|
||||
left join video vd on o.goods_type='1' and oi.goods_id = vd.id
|
||||
left join template t on o.goods_type='1' and vd.template_id=t.id
|
||||
left join scenic sc on (o.goods_type='1' and vd.scenic_id=sc.id) or (o.goods_type='2' and sr.scenic_id=sc.id)
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user