Commit 110db1b9 by jianan

导出运营报表2-经纪人日程管理,销售目标,活动量

parent 0f4c22d7
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
AND t.task_type = #{taskType,jdbcType=BIGINT} AND t.task_type = #{taskType,jdbcType=BIGINT}
</if> </if>
<if test="dropOptionName != null"> <if test="dropOptionName != null">
AND t.md_drop_option_id = #{dropOptionName,jdbcType=BIGINT} AND t.notice like concat(concat('%',#{dropOptionName,jdbcType=VARCHAR}),'%')
</if> </if>
AND t.is_active = 1 AND t.is_active = 1
</select> </select>
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
</when> </when>
<otherwise> <otherwise>
<if test="date != null"> <if test="date != null">
AND t.created_at &gt;= DATE #{date,jdbcType=VARCHAR} AND t.created_at &lt;= DATE #{date,jdbcType=VARCHAR} AND t.created_at &gt;= str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m') AND t.created_at &lt;= str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m')
</if> </if>
</otherwise> </otherwise>
</choose> </choose>
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
SELECT SELECT
p.name '1', p.name '1',
(CASE (t.statistic_time_unit) WHEN 1 THEN '年度目标' WHEN 3 THEN '月度目标' ELSE '其他' END) '2', (CASE (t.statistic_time_unit) WHEN 1 THEN '年度目标' WHEN 3 THEN '月度目标' ELSE '其他' END) '2',
t.seq_time '3', if(t.statistic_time_unit = 3, concat(year(t.created_at),'-',t.seq_time), t.seq_time) '3',
t.premium '4', t.premium '4',
t.commission '5', t.commission '5',
t.pieces '6', t.pieces '6',
...@@ -184,15 +184,28 @@ ...@@ -184,15 +184,28 @@
date_format(t.created_at, '%Y-%m-%d %H:%i:%s') '8' date_format(t.created_at, '%Y-%m-%d %H:%i:%s') '8'
FROM ag_mkt_leads_goals t,ag_acl_practitioner p FROM ag_mkt_leads_goals t,ag_acl_practitioner p
WHERE t.practitioner_id = p.id WHERE t.practitioner_id = p.id
<if test="date != null"> <choose>
AND t.created_at &gt;= DATE #{date,jdbcType=VARCHAR} AND t.created_at &lt;= DATE #{date,jdbcType=VARCHAR} <when test="type != null and date != null">
</if> AND t.statistic_time_unit = #{type,jdbcType=BIGINT}
<if test="type == 1">
AND year(t.created_at) = year(#{date,jdbcType=VARCHAR})
</if>
<if test="type == 3">
AND DATE_FORMAT(t.created_at, '%Y%m') = DATE_FORMAT(#{date,jdbcType=VARCHAR}, '%Y%m')
</if>
</when>
<when test="type != null and date == null">
AND t.statistic_time_unit = #{type,jdbcType=BIGINT}
</when>
<otherwise>
<if test="date != null">
AND t.created_at &gt;= str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m') AND t.created_at &lt;= str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m')
</if>
</otherwise>
</choose>
<if test="practitionerId != null"> <if test="practitionerId != null">
AND t.practitioner_id = #{practitionerId,jdbcType=BIGINT} AND t.practitioner_id = #{practitionerId,jdbcType=BIGINT}
</if> </if>
<if test="type != null">
AND t.t.statistic_time_unit = #{type,jdbcType=BIGINT}
</if>
AND t.is_active = 1 AND t.is_active = 1
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment