<?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.xzx.gc.pay.mapper.OrderMapper">
|
|
<select id="findHistoryByReceiverWithMonth" resultType="com.xzx.gc.entity.OrderInfo">
|
SELECT LEFT
|
( b.complete_time, 10 ) as completeTime,
|
sum(cast(c.weight as DECIMAL(9,3))) as weight,
|
sum(cast(c.money as DECIMAL(9,2))) as money
|
FROM
|
xzx_order_info a
|
INNER JOIN xzx_order_detail_info b ON a.order_id = b.order_id
|
INNER JOIN xzx_order_item_info c ON b.order_id = c.order_id
|
WHERE
|
a.order_status IN ( '4', '5', '7' )
|
AND a.receiver = #{receiver}
|
GROUP BY
|
LEFT ( b.complete_time, 7 )
|
<if test="yearMonth != null and yearMonth != ''">
|
HAVING LEFT ( completeTime, 7 )=#{yearMonth}
|
</if>
|
ORDER BY b.complete_time desc
|
</select>
|
|
<select id="queryUserOrderList" parameterType="com.xzx.gc.model.admin.PayRequestInfoModel" resultType="com.xzx.gc.model.admin.PayRequestInfoModel">
|
select a.order_id as orderId,c.complete_time as completeTime,
|
sum(b.money) as money,sum(b.weight) as weight,
|
a.create_time as createTime,a.rela_phone as phone from xzx_order_info a
|
inner join xzx_order_detail_info c on a.order_id=c.order_id
|
left join xzx_order_item_info b on a.order_id=b.order_id
|
where a.del_flag=0
|
and a.order_status in ('4','5','7')
|
and a.order_id=c.order_id
|
<if test="userId != null and userId != ''">
|
and a.create_user_id=#{userId}
|
</if>
|
<if test="otherUserId != null and otherUserId != ''">
|
and a.receiver=#{otherUserId}
|
</if>
|
group by a.order_id
|
</select>
|
|
|
<select id="queryUserOrderMoneyAndWeight" parameterType="com.xzx.gc.model.admin.PayRequestInfoModel" resultType="java.util.HashMap">
|
select
|
IFNULL(sum(b.money),0) as money,IFNULL(sum(b.weight),0) as weight
|
from xzx_order_info a
|
left join xzx_order_detail_info c on a.order_id=c.order_id
|
left join xzx_order_item_info b on a.order_id=b.order_id
|
where a.del_flag=0
|
and a.order_status in ('4','5','7')
|
and a.order_id=c.order_id
|
<if test="userId != null and userId != ''">
|
and a.create_user_id=#{userId}
|
</if>
|
<if test="otherUserId != null and otherUserId != ''">
|
and a.receiver=#{otherUserId}
|
</if>
|
group by a.order_id
|
</select>
|
|
<select id="queryStorageMoneyDetailApi" resultType="com.xzx.gc.model.admin.PayRequestInfoModel">
|
select a.order_id as orderId,c.complete_time as completeTime,
|
sum(b.money) as money,sum(b.weight) as weight,
|
a.create_time as createTime,a.rela_phone as phone from xzx_order_info a
|
left join xzx_order_detail_info c on a.order_id=c.order_id
|
left join xzx_order_item_info b on a.order_id=b.order_id
|
where a.del_flag=0
|
and a.order_status in (4,5)
|
and a.order_id=c.order_id
|
and a.order_id in
|
<foreach collection="orderIds" index="index" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
group by a.order_id
|
</select>
|
|
<select id="queryMoneyAndWeightByOrderIds" resultType="java.util.HashMap" parameterType="java.util.List">
|
select
|
IFNULL(sum(b.money),0) as money,IFNULL(sum(b.weight),0) as weight
|
from xzx_order_info a
|
left join xzx_order_detail_info c on a.order_id=c.order_id
|
left join xzx_order_item_info b on a.order_id=b.order_id
|
where a.del_flag=0
|
and a.order_status in (4,5)
|
and a.order_id=c.order_id
|
and a.order_id in
|
<foreach collection="orderIds" index="index" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
group by a.order_id
|
</select>
|
|
<select id="quotaDetail" parameterType="com.xzx.gc.model.admin.StorageUserModel" resultType="com.xzx.gc.model.admin.StorageUserModel">
|
select IFNULL(sum(c.money),0) as money,IFNULL(sum(c.weight),0) as weight,b.receive_time as storageTime from xzx_order_info a
|
left join xzx_order_detail_info b on a.order_id=b.order_id
|
left join xzx_order_item_info c on a.order_id=c.order_id
|
where a.receiver=#{userId} and c.order_id is not null
|
<if test="startTime!= null and startTime!=''">
|
and b.receive_time<![CDATA[>= ]]>#{startTime}
|
</if>
|
<if test="endTime!= null and endTime!=''">
|
and b.receive_time<![CDATA[<= ]]>#{endTime}
|
</if>
|
group by a.order_id
|
</select>
|
</mapper>
|