|
|
@@ -35,6 +35,18 @@
|
|
|
<result property="goodsNameJoin" column="goods_name_join"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap id="CouponReportExcelMap" type="org.springblade.salesPart.coupon.excel.CouponReportExcel">
|
|
|
+ <result property="orderNo" column="ord_no"/>
|
|
|
+ <result property="customerName" column="customer_name"/>
|
|
|
+ <result property="numberRows" column="number_rows"/>
|
|
|
+ <result property="goodsTotalNum" column="goods_total_num"/>
|
|
|
+ <result property="totalMoney" column="total_money"/>
|
|
|
+ <result property="redPacketAmount" column="red_packet_amount"/>
|
|
|
+ <result property="businessDate" column="busines_date"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <result property="goodsNameJoin" column="goods_name_join"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
|
|
|
<insert id="saveBatch">
|
|
|
INSERT INTO tire_user_coupon (
|
|
|
@@ -192,4 +204,35 @@
|
|
|
and u.corps_id = #{customerId}
|
|
|
group by po.id
|
|
|
</select>
|
|
|
+ <select id="getExportCouponReportData" resultMap="CouponReportExcelMap"
|
|
|
+ parameterType="org.springblade.salesPart.coupon.vo.CouponReportVo">
|
|
|
+ SELECT DISTINCT po.ord_no,
|
|
|
+ po.customer_name,
|
|
|
+ po.number_rows,
|
|
|
+ po.goods_total_num,
|
|
|
+ po.total_money,
|
|
|
+ po.busines_date,
|
|
|
+ po.goods_name_join,
|
|
|
+ po.status,
|
|
|
+ sum(tc.value) as red_packet_amount
|
|
|
+ FROM tire_user_coupon u
|
|
|
+ INNER JOIN pjpf_order po ON u.order_id = po.id
|
|
|
+ inner join tire_coupon tc on u.coupon_id = tc.id
|
|
|
+ WHERE u.acquire_time IS NOT NULL
|
|
|
+ AND u.STATUS = 1
|
|
|
+ and po.status != '录入'
|
|
|
+ AND po.returns_status = '无'
|
|
|
+ and u.tenant_id = #{tenantId}
|
|
|
+ and po.tenant_id = #{tenantId}
|
|
|
+ <if test="storeName != null and storeName != ''">
|
|
|
+ AND po.customer_name LIKE CONCAT('%', #{storeName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">
|
|
|
+ AND DATE(u.acquire_time) >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ AND DATE(u.acquire_time) <= #{endDate}
|
|
|
+ </if>
|
|
|
+ group by po.id
|
|
|
+ </select>
|
|
|
</mapper>
|