82 lines
3.9 KiB
XML
82 lines
3.9 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.WxOrderMapper">
|
|
|
|
<!-- <resultMap id="BaseResultMap" type="cn.unizk.entity.po.WxOrder">
|
|
<result column="order_id" property="orderId" jdbcType="VARCHAR"/>
|
|
<result column="openid" property="openid" jdbcType="VARCHAR"/>
|
|
<result column="product_id" property="productId" jdbcType="VARCHAR"/>
|
|
<result column="combo_id" property="comboId" jdbcType="VARCHAR"/>
|
|
<result column="description" property="description" jdbcType="VARCHAR"/>
|
|
<result column="amount" property="amount" jdbcType="INTEGER"/>
|
|
<result column="total_price" property="totalPrice" jdbcType="DECIMAL"/>
|
|
<result column="status" property="status" jdbcType="VARCHAR"/>
|
|
<result column="store_id" property="storeId" jdbcType="INTEGER"/>
|
|
<result column="physio_id" property="physioId" jdbcType="INTEGER"/>
|
|
<result column="device_id" property="deviceId" jdbcType="INTEGER"/>
|
|
<result column="create_time" property="createTime" jdbcType="INTEGER"/>
|
|
<result column="pay_time" property="payTime" jdbcType="INTEGER"/>
|
|
<result column="recipient_phone" property="recipientPhone" jdbcType="VARCHAR"/>
|
|
<result column="recipient_name" property="recipientName" jdbcType="VARCHAR"/>
|
|
<result column="receiving_address" property="receivingAddress" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="OrderVOMap" type="cn.unizk.entity.vo.WxOrderVO" extends="BaseResultMap">
|
|
<result column="phoneNumber" property="ordererPhone"/>
|
|
<result column="productName" property="productName"/>
|
|
</resultMap>
|
|
|
|
<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="selectOrders" resultMap="OrderVOMap">
|
|
select o.order_id,o.description,o.amount,o.total_price,o.create_time,o.pay_time,o.status,
|
|
o.recipient_phone,o.recipient_name,o.receiving_address,u.phone_number as phoneNumber,
|
|
CASE
|
|
WHEN o.product_id is not null then p.product_name
|
|
else c.combo_name
|
|
end as productName
|
|
from wx_order o
|
|
left join jk_product p on p.product_id = o.product_id
|
|
left join combo c on o.product_id is null and o.combo_id = c.combo_id
|
|
left join wx_user u on o.openid = u.openid
|
|
<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>
|
|
</where>
|
|
</select>
|
|
|
|
<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}
|
|
</select>-->
|
|
|
|
</mapper>
|