|
@@ -182,4 +182,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="selectFsCourseRedPacketLogHourseByCompany" resultType="com.fs.company.vo.RedPacketMoneyVO">
|
|
|
SELECT a.company_id, SUM(amount) as money FROM fs_course_red_packet_log a WHERE a.create_time >= #{startTime} AND a.create_time <= #{endTime} GROUP BY a.company_id
|
|
|
</select>
|
|
|
+ <!-- 看客红包统计 -->
|
|
|
+ <select id="statistics" resultType="com.fs.course.dto.CourseRedPacketStatisticsDTO">
|
|
|
+ select c.company_name,cu.nick_name,pl.company_user_id,cu.company_id,sum(pl.amount) as redPacketTotalMoney,count(pl.log_id) as redPacketNum from fs_course_red_packet_log pl
|
|
|
+ left join company_user cu on pl.company_user_id = cu.user_id
|
|
|
+ left join company c on cu.company_id=c.company_id
|
|
|
+ <where>
|
|
|
+ <if test="companyId != null">
|
|
|
+ and cu.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="companyUserId != null">
|
|
|
+ and pl.company_user_id = #{companyUserId}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and pl.status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ and date_format(pl.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ and date_format(pl.create_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by pl.company_user_id order by c.company_name
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|