|
@@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectFsCourseTrafficLogVo">
|
|
|
- select log_id, uu_id,user_id, video_id, create_time, qw_external_contact_id, internet_traffic, qw_user_id, company_user_id, company_id, course_id from fs_course_traffic_log
|
|
|
+ select log_id, uu_id,user_id, video_id, create_time, qw_external_contact_id, internet_traffic, qw_user_id, company_user_id, company_id, course_id, project from fs_course_traffic_log
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectFsCourseTrafficLogList" parameterType="FsCourseTrafficLog" resultMap="FsCourseTrafficLogResult">
|
|
@@ -40,6 +40,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<include refid="selectFsCourseTrafficLogVo"/>
|
|
|
where log_id = #{logId}
|
|
|
</select>
|
|
|
+ <select id="selectTrafficByCompany" resultType="com.fs.course.vo.FsCourseTrafficLogListVO">
|
|
|
+ select c.company_name, SUM(l.internet_traffic) AS total_internet_traffic
|
|
|
+ ,DATE_FORMAT(l.create_time, '%Y-%m') AS `month` from fs_course_traffic_log l
|
|
|
+ left join company c on c.company_id = l.company_id
|
|
|
+ where 1 = 1
|
|
|
+ <if test= 'maps.year != null '>
|
|
|
+ and YEAR(l.create_time) = #{maps.year}
|
|
|
+ </if>
|
|
|
+ <if test= 'maps.month != null '>
|
|
|
+ and MONTH(l.create_time) = #{maps.month}
|
|
|
+ </if>
|
|
|
+ <if test = ' maps.companyId !=null '>
|
|
|
+ and l.company_id = #{maps.companyId}
|
|
|
+ </if>
|
|
|
+ group by l.company_id,`month`
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="selectTrafficNew" resultType="com.fs.course.vo.FsCourseTrafficLogListVO">
|
|
|
+ select company_id,project,course_id,SUM(internet_traffic) AS total_internet_traffic
|
|
|
+ ,DATE_FORMAT(create_time, '%Y-%m') AS `month` from fs_course_traffic_log
|
|
|
+ <where>
|
|
|
+ <if test="startDate != null and endDate != null">
|
|
|
+ and create_time between #{startDate} AND #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test='companyId !=null'>
|
|
|
+ and company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="courseId != null">
|
|
|
+ and course_id = ${courseId}
|
|
|
+ </if>
|
|
|
+ <if test="project">
|
|
|
+ and project = ${project}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by company_id,`month`,project,course_id
|
|
|
+ </select>
|
|
|
|
|
|
<insert id="insertFsCourseTrafficLog" parameterType="FsCourseTrafficLog" useGeneratedKeys="true" keyProperty="logId">
|
|
|
insert into fs_course_traffic_log
|
|
@@ -54,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="companyId != null">company_id,</if>
|
|
|
<if test="courseId != null">course_id,</if>
|
|
|
<if test="uuId != null">uu_id,</if>
|
|
|
+ <if test="project != null">project,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="userId != null">#{userId},</if>
|
|
@@ -66,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="companyId != null">#{companyId},</if>
|
|
|
<if test="courseId != null">#{courseId},</if>
|
|
|
<if test="uuId != null">#{uuId},</if>
|
|
|
+ <if test="project != null">#{project},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
@@ -82,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="companyId != null">company_id,</if>
|
|
|
<if test="courseId != null">course_id,</if>
|
|
|
<if test="uuId != null">uu_id,</if>
|
|
|
+ <if test="project != null">project,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="userId != null">#{userId},</if>
|
|
@@ -94,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="companyId != null">#{companyId},</if>
|
|
|
<if test="courseId != null">#{courseId},</if>
|
|
|
<if test="uuId != null">#{uuId},</if>
|
|
|
+ <if test="project != null">#{project},</if>
|
|
|
</trim>
|
|
|
on duplicate key update
|
|
|
<trim suffixOverrides=",">
|
|
@@ -114,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="companyId != null">company_id = #{companyId},</if>
|
|
|
<if test="courseId != null">course_id = #{courseId},</if>
|
|
|
<if test="uuId != null">uu_id = #{uuId},</if>
|
|
|
+ <if test="project != null">project = #{project},</if>
|
|
|
</trim>
|
|
|
where log_id = #{logId}
|
|
|
</update>
|