<?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.order.mapper.OrderItemInfoMapper">
|
<select id="findByOrderIdAndTypes" resultType="com.xzx.gc.entity.OrderItemInfo">
|
SELECT
|
DISTINCT b.item_type "itemType",b.amount,b.money
|
FROM
|
xzx_order_detail_info a
|
INNER JOIN xzx_order_item_info b ON a.order_id = b.order_id
|
WHERE
|
a.order_id = #{orderId} and CAST(b.money as DECIMAL(9,2))>0
|
and b.item_type in
|
<foreach collection="childItemTypeByType" index="index" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
|
</select>
|
<select id="findByUserIdAndTypesWithComplete" resultType="com.xzx.gc.entity.OrderItemInfo">
|
SELECT
|
DISTINCT b.item_type "itemType",b.amount,b.money
|
FROM
|
xzx_order_info a
|
INNER JOIN xzx_order_item_info b ON a.order_id = b.order_id
|
WHERE
|
CAST(b.money as DECIMAL(9,2))>0 and a.create_user_id=#{userId} and a.order_status in('4','5','7')
|
and b.item_type in
|
<foreach collection="childItemTypeByType" index="index" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
<select id="findByTypeAndPartnerAndTime" resultType="com.xzx.gc.model.order.ItemDto">
|
SELECT
|
sum( ifnull( a.weight, 0 ) ) "weight",
|
sum( ifnull( a.money, 0 ) ) "money",
|
sum( ifnull( a.amount, 0 ) ) "amount"
|
FROM
|
xzx_order_item_info a
|
INNER JOIN xzx_order_info b ON a.order_id = b.order_id
|
INNER JOIN xzx_order_detail_info e ON b.order_id = e.order_id
|
INNER JOIN xzx_partner_fence c ON b.town_id = c.fence_id
|
AND c.del_flag = 0
|
WHERE
|
a.item_type = #{itemType}
|
AND c.partner_id = #{partnerId}
|
<if test="startTime != null and startTime != ''">
|
AND e.complete_time >= #{startTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
and e.complete_time<=#{endTime}
|
</if>
|
</select>
|
|
<insert id="addOrderItem">
|
INSERT INTO `xzx_order_item_info` (`order_id`, `item_type`, `weight`,
|
`amount`, `money`)
|
VALUES
|
<foreach collection="list" index="index" item="info" separator=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
#{info.orderId}, #{info.itemType}, null, null, null
|
</trim>
|
</foreach>
|
|
</insert>
|
</mapper>
|