|
@@ -112,5 +112,57 @@
|
|
|
</foreach>
|
|
|
</where>
|
|
|
</select>
|
|
|
+ <resultMap id="LiveRoomGoodsOrderVo" type="com.ym.mec.biz.dal.vo.LiveRoomGoodsOrderVo">
|
|
|
+ <result property="userId" column="user_id_"/>
|
|
|
+ <result property="userName" column="username_"/>
|
|
|
+ <result property="phone" column="phone_"/>
|
|
|
+ <result property="goodsName" column="goods_name_"/>
|
|
|
+ <result property="actualPrice" column="actual_amount_"/>
|
|
|
+ <result property="expectPrice" column="expect_amount_"/>
|
|
|
+ <result property="balance" column="balance_payment_amount_"/>
|
|
|
+ <result property="couponRemitFee" column="coupon_remit_fee_"/>
|
|
|
+ <result property="payTime" column="pay_time_"/>
|
|
|
+ <result property="goodsName" column="goods_name_"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="queryLiveRoomGoodsOrderSql">
|
|
|
+ <where>
|
|
|
+ spo.group_type_ = 'LIVE_BUY' AND spo.type_ = 'LIVE_BUY'
|
|
|
+ AND spo.status_ = 'SUCCESS'
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ AND (su.id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="roomUid != null and roomUid != ''">
|
|
|
+ AND spo.music_group_id_ = #{roomUid}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ AND DATE_FORMAT(spo.pay_time_, '%Y-%m-%d') >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ AND DATE_FORMAT(spo.pay_time_, '%Y-%m-%d') <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <select id="queryLiveRoomGoodsOrderList" resultMap="LiveRoomGoodsOrderVo">
|
|
|
+ SELECT su.id_ user_id_,su.username_,su.phone_,spo.actual_amount_,spo.expect_amount_,
|
|
|
+ spo.balance_payment_amount_,spo.coupon_remit_fee_,spo.pay_time_,GROUP_CONCAT(lg.name_) goods_name_ FROM student_payment_order spo
|
|
|
+ LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
|
|
|
+ LEFT JOIN live_goods lg ON FIND_IN_SET(lg.id_,spod.goods_id_list_)
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = spo.user_id_
|
|
|
+ <include refid="queryLiveRoomGoodsOrderSql"/>
|
|
|
+ GROUP BY spo.id_
|
|
|
+ ORDER BY spo.pay_time_ DESC
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+ <select id="countLiveRoomGoodsOrderList" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(DISTINCT spo.id_) FROM student_payment_order spo
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = spo.user_id_
|
|
|
+ <include refid="queryLiveRoomGoodsOrderSql"/>
|
|
|
+ </select>
|
|
|
+ <select id="sumLiveRoomGoodsOrderList" resultType="java.util.Map">
|
|
|
+ SELECT COUNT(DISTINCT spo.user_id_) buyNum,SUM(spo.expect_amount_) totalAmount
|
|
|
+ FROM student_payment_order spo
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = spo.user_id_
|
|
|
+ <include refid="queryLiveRoomGoodsOrderSql"/>
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|