You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

82 lines
3.8 KiB

<?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="cc.hiver.mall.dao.mapper.MallOrderMapper">
<!-- 通用结果映射 -->
<resultMap id="mallOrderVOMap" type="cc.hiver.mall.entity.MallOrder">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="shop_id" property="shopId"/>
<result column="order_type" property="orderType"/>
<result column="delivery_type" property="deliveryType"/>
<result column="status" property="status"/>
<result column="total_amount" property="totalAmount"/>
<result column="goods_amount" property="goodsAmount"/>
<result column="delivery_fee" property="deliveryFee"/>
<result column="package_fee" property="packageFee"/>
<result column="address_id" property="addressId"/>
<result column="remark" property="remark"/>
<result column="receiver_name" property="receiverName"/>
<result column="receiver_phone" property="receiverPhone"/>
<result column="receiver_address" property="receiverAddress"/>
<result column="shop_name" property="shopName"/>
<result column="shop_phone" property="shopPhone"/>
<result column="shop_address" property="shopAddress"/>
<result column="create_time" property="createTime"/>
<result column="pay_time" property="payTime"/>
<result column="number_code" property="numberCode"/>
<result column="region_id" property="regionId"/>
</resultMap>
<!-- 分页查询订单(不挂载商品明细,由Service层补填) -->
<select id="selectPageVO" resultMap="mallOrderVOMap">
SELECT
o.id, o.user_id, o.shop_id, o.order_type, o.delivery_type,
o.status, o.total_amount, o.goods_amount, o.delivery_fee,
o.package_fee, o.address_id, o.remark, o.create_time, o.pay_time,
o.receiver_name, o.receiver_phone, o.receiver_address,
o.shop_name, o.shop_phone, o.shop_address,o.number_code,region_id
FROM mall_order o
<where>
<if test="q.userId != null and q.userId != ''">
AND o.user_id = #{q.userId}
</if>
<if test="q.shopId != null and q.shopId != ''">
AND o.shop_id = #{q.shopId}
</if>
<if test="q.status != null">
AND o.status = #{q.status}
</if>
<if test="q.orderType != null">
AND o.order_type = #{q.orderType}
</if>
<if test="q.deliveryType != null">
AND o.delivery_type = #{q.deliveryType}
</if>
<if test="q.startDate != null and q.startDate != ''">
AND DATE(o.create_time) &gt;= #{q.startDate}
</if>
<if test="q.endDate != null and q.endDate != ''">
AND DATE(o.create_time) &lt;= #{q.endDate}
</if>
</where>
ORDER BY o.create_time DESC
</select>
<select id="selectMallOrderByGroupId" resultMap="mallOrderVOMap">
SELECT
o.id, o.user_id, o.shop_id, o.order_type, o.delivery_type,
o.status, o.total_amount, o.goods_amount, o.delivery_fee,
o.package_fee, o.address_id, o.remark, o.create_time, o.pay_time,
o.receiver_name, o.receiver_phone, o.receiver_address,
o.shop_name, o.shop_phone, o.shop_address,o.number_code,o.region_id
FROM mall_order o LEFT JOIN mall_order_group og ON o.id = og.head_order_id
<where>
<if test="groupId != null and groupId != ''">
AND og.id = #{groupId}
</if>
</where>
</select>
</mapper>