179 lines
8.6 KiB
XML
179 lines
8.6 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="cn.unizk.mapper.MobileOrderMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="cn.unizk.entity.po.MobileOrder">
|
|
<id column="order_id" property="orderId" />
|
|
<result column="out_trade_no" property="outTradeNo" />
|
|
<result column="mobile_user_id" property="mobileUserId" />
|
|
<result column="product_id" property="productId" />
|
|
<result column="combo_id" property="comboId" />
|
|
<result column="course_id" property="courseId" />
|
|
<result column="description" property="description" />
|
|
<result column="total_price" property="totalPrice" />
|
|
<result column="status" property="status" />
|
|
<result column="store_id" property="storeId" />
|
|
<result column="physio_id" property="physioId" />
|
|
<result column="device_id" property="deviceId" />
|
|
<result column="create_time" property="createTime" />
|
|
<result column="pay_time" property="payTime" />
|
|
<result column="recipient_phone" property="recipientPhone" />
|
|
<result column="recipient_name" property="recipientName" />
|
|
<result column="receiving_address" property="receivingAddress" />
|
|
<result column="apply_fz_flag" property="applyFzFlag" />
|
|
<result column="delivery_way" property="deliveryWay" />
|
|
<result column="hf_seq_id" property="hfSeqId" />
|
|
<result column="reject_reason" property="rejectReason" />
|
|
<result column="refund_finish_time" property="refundFinishTime" />
|
|
<result column="apply_refund_time" property="applyRefundTime" />
|
|
<result column="refund_tracking_number" property="refundTrackingNumber" />
|
|
<result column="refund_reason" property="refundReason" />
|
|
<result column="after_sale_status" property="afterSaleStatus" />
|
|
<result column="order_type" property="orderType" />
|
|
<result column="platform_type" property="platformType" />
|
|
</resultMap>
|
|
|
|
<resultMap id="OrderVOMap" type="cn.unizk.entity.vo.MobileOrderVO" extends="BaseResultMap">
|
|
<result column="phoneNumber" property="ordererPhone"/>
|
|
<result column="chineseOrderStatus" property="chineseOrderStatus" />
|
|
<collection property="orderItemVOS" ofType="cn.unizk.entity.vo.MobileOrderItemVO">
|
|
<!--<result column="order_id" property="orderId" />-->
|
|
<result column="productName" property="productName" />
|
|
<result column="productId" property="productId" />
|
|
<result column="quantity" property="quantity" />
|
|
<result column="price" property="price" />
|
|
<result column="image" property="image" />
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<resultMap id="OrderVO" type="cn.unizk.entity.vo.MobileOrderVO" extends="BaseResultMap">
|
|
<result property="ordererPhone" column="phoneNumber" />
|
|
<result property="productName" column="productName" />
|
|
<result property="chineseOrderStatus" column="chineseOrderStatus" />
|
|
<result property="image" column="image" />
|
|
<collection property="orderItemVOS" ofType="cn.unizk.entity.vo.MobileOrderItemVO">
|
|
<id property="id" column="item_id" />
|
|
<result property="productName" column="itemName" />
|
|
<result property="quantity" column="quantity" />
|
|
<result property="price" column="price" />
|
|
<result property="storeId" column="store_id" />
|
|
</collection>
|
|
</resultMap>
|
|
|
|
|
|
<select id="selectOrderByIdAndPhone" resultMap="BaseResultMap">
|
|
select o.* from wx_order o join wx_user u
|
|
on o.openid = u.openid
|
|
where o.order_id = #{orderId} and u.phone_number = #{phone} and o.combo_id is not null
|
|
</select>
|
|
|
|
<update id="updateStatusToPaid">
|
|
update wx_order set status = 'paid',pay_time = NOW() where order_id = #{orderId} and status = 'unpaid'
|
|
</update>
|
|
|
|
<update id="updateStatusToCanceled">
|
|
update wx_order set status = 'canceled' where order_id = #{orderId} and status = 'unpaid'
|
|
</update>
|
|
|
|
<!--<select id="selectOrderVO" resultMap="OrderVO">
|
|
select o.order_id,
|
|
</select>-->
|
|
|
|
<select id="selectOrders" resultMap="OrderVOMap">
|
|
select o.order_id,o.platform_type,o.description,o.total_price,o.create_time,o.pay_time,o.status,woi.product_id as productId,
|
|
o.recipient_phone,o.recipient_name,o.receiving_address,u.phone_number as phoneNumber,woi.quantity,woi.price,o.store_id,
|
|
CASE
|
|
WHEN woi.product_id is not null then p.product_name
|
|
else c.combo_name
|
|
end as productName,
|
|
case
|
|
when woi.product_id is not null then p.product_image
|
|
else c.image
|
|
end as image
|
|
from mobile_order o
|
|
left join mobile_order_item woi on o.order_id = woi.mobile_order_id
|
|
left join jk_product p on p.product_id = woi.product_id
|
|
left join combo c on woi.product_id is null and woi.combo_id = c.combo_id
|
|
left join mobile_app_user u on o.mobile_user_id = u.id
|
|
<where>
|
|
<if test="vo.status != null and vo.status != ''">
|
|
and o.status = #{vo.status}
|
|
</if>
|
|
<if test="vo.storeId != null">
|
|
and o.store_id = #{vo.storeId}
|
|
</if>
|
|
<if test="vo.searchStartTimeDt != null">
|
|
and o.create_time >= #{vo.searchStartTimeDt}
|
|
</if>
|
|
<if test="vo.searchEndTimeDt != null">
|
|
and o.create_time <= #{vo.searchEndTimeDt}
|
|
</if>
|
|
<if test="vo.keyword != null and vo.keyword != ''">
|
|
and (o.order_id = #{vo.keyword} or u.phone_number = #{vo.keyword} or p.product_name = #{vo.keyword} or c.combo_name = #{vo.keyword})
|
|
</if>
|
|
<if test='vo.orderType != null and vo.orderType.equals("P")'>
|
|
and o.store_id is null
|
|
</if>
|
|
<if test='vo.orderType != null and vo.orderType == "S"'>
|
|
and o.store_id is not null
|
|
</if>
|
|
<if test="vo.deliveryWay != null and vo.deliveryWay != ''">
|
|
and o.delivery_way = #{vo.deliveryWay}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="selectAfterSaleOrders" resultMap="OrderVOMap">
|
|
select o.order_id,o.platform_type,o.description,o.total_price,o.create_time,o.pay_time,o.status,woi.product_id as productId,
|
|
o.recipient_phone,o.recipient_name,o.receiving_address,u.phone_number as phoneNumber,woi.quantity,woi.price,
|
|
o.reject_reason,o.refund_finish_time,o.apply_refund_time,o.refund_tracking_number,o.refund_reason,
|
|
o.after_sale_status,o.delivery_way,
|
|
CASE
|
|
WHEN woi.product_id is not null then p.product_name
|
|
else c.combo_name
|
|
end as productName,
|
|
case
|
|
when woi.product_id is not null then p.product_image
|
|
else c.image
|
|
end as image
|
|
from mobile_order o
|
|
left join mobile_order_item woi on o.order_id = woi.mobile_order_id
|
|
left join jk_product p on p.product_id = woi.product_id
|
|
left join combo c on woi.product_id is null and woi.combo_id = c.combo_id
|
|
left join mobile_app_user u on o.mobile_user_id = u.id
|
|
<where>
|
|
o.after_sale_status != 0
|
|
<if test="vo.afterSaleStatusList.size != 0">
|
|
and o.after_sale_status in
|
|
<foreach collection="vo.afterSaleStatusList" open="(" separator="," close=")" item="item">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="vo.storeId != null">
|
|
and o.store_id = #{vo.storeId}
|
|
</if>
|
|
<if test="vo.searchStartTimeDt != null">
|
|
and o.refund_finish_time >= #{vo.searchStartTimeDt}
|
|
</if>
|
|
<if test="vo.searchEndTimeDt != null">
|
|
and o.refund_finish_time <= #{vo.searchEndTimeDt}
|
|
</if>
|
|
<if test="vo.keyword != null and vo.keyword != ''">
|
|
and (o.order_id = #{vo.keyword} or u.phone_number = #{vo.keyword} or p.product_name = #{vo.keyword} or c.combo_name = #{vo.keyword})
|
|
</if>
|
|
<if test='vo.orderType != null and vo.orderType.equals("P")'>
|
|
and o.store_id is null
|
|
</if>
|
|
<if test='vo.orderType != null and vo.orderType == "S"'>
|
|
and o.store_id is not null
|
|
</if>
|
|
<if test="vo.deliveryWay != null and vo.deliveryWay != ''">
|
|
and o.delivery_way = #{vo.deliveryWay}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
</mapper>
|