|
|
@@ -216,4 +216,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<include refid="selectFsCourseRedPacketLogVo"/> where status != 1 and create_time >= #{maps.startTime} and create_time <= #{maps.endTime}
|
|
|
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectFsCourseRedPacketLogListCountVO"
|
|
|
+ resultType="com.fs.course.vo.FsCourseRedPacketLogListVO">
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ <if test="maps.changeType == 2">
|
|
|
+ l.company_user_id,
|
|
|
+ cu.nick_name,
|
|
|
+ cu.dept_id,
|
|
|
+ cd.dept_name,
|
|
|
+ </if>
|
|
|
+ c.company_name,
|
|
|
+ l.company_id,
|
|
|
+ sum(l.amount) AS amount,
|
|
|
+ l.create_time AS createTime
|
|
|
+ FROM
|
|
|
+ fs_course_red_packet_log l
|
|
|
+ INNER JOIN company c ON c.company_id = l.company_id
|
|
|
+ LEFT JOIN company_user cu on l.company_user_id=cu.user_id
|
|
|
+ LEFT JOIN company_dept cd on cu.dept_id=cd.dept_id
|
|
|
+ WHERE 1=1
|
|
|
+ and l.create_time >= #{maps.sTime}
|
|
|
+ AND l.create_time <#{maps.eTime}
|
|
|
+ AND l.STATUS = 1
|
|
|
+ <if test="maps.companyIds != null and maps.companyIds.size() > 0 and maps.changeType == 1 ">
|
|
|
+ AND l.company_id IN
|
|
|
+ <foreach collection="maps.companyIds" open="(" close=")" separator="," item="item">
|
|
|
+ ${item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="maps.courseId != null ">
|
|
|
+ AND l.course_id = #{maps.courseId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.courseId != null ">
|
|
|
+ AND l.videoId = #{maps.videoId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.status != null">
|
|
|
+ and l.status = #{maps.status}
|
|
|
+ </if>
|
|
|
+ <if test="maps.userIds != null and maps.userIds.size() > 0 and maps.changeType == 2 ">
|
|
|
+ AND l.company_user_id IN
|
|
|
+ <foreach collection="maps.userIds" open="(" close=")" separator="," item="item">
|
|
|
+ ${item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ <choose>
|
|
|
+ <when test="maps.companyIds != null and maps.changeType == 1 ">
|
|
|
+ l.company_id
|
|
|
+ </when>
|
|
|
+ <when test="maps.userIds != null and maps.userIds.size() > 0 and maps.changeType == 2 ">
|
|
|
+ l.company_id, l.company_user_id
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ l.company_id, l.company_user_id <!-- 默认分组方式 -->
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
</mapper>
|