shudonghui преди 1 година
родител
ревизия
319423e00c
променени са 1 файла, в които са добавени 38 реда и са изтрити 12 реда
  1. 38 12
      sop-business/src/main/resources/mapper/CrmAnalyseMapper.xml

+ 38 - 12
sop-business/src/main/resources/mapper/CrmAnalyseMapper.xml

@@ -2,9 +2,36 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.sop.business.mapper.CrmAnalyseMapper">
     <select id="region" resultType="com.qmth.sop.business.bean.result.CrmAnalyseResult">
+        <!--        SELECT-->
+        <!--        r.id,-->
+        <!--        r.region_name,-->
+        <!--        count( c.id ) count-->
+        <!--        FROM-->
+        <!--        t_b_crm c-->
+        <!--        LEFT JOIN sys_custom cu ON cu.id = c.custom_id-->
+        <!--        LEFT JOIN t_b_service s ON c.service_id = s.id-->
+        <!--        left join t_b_service_region r on r.service_id=s.id-->
+        <!--        <where>-->
+        <!--            and s.`status`='PUBLISH' and c.service_id is not null and r.id is not null-->
+        <!--            <if test="type != null and type != ''">-->
+        <!--                and cu.type = #{type}-->
+        <!--            </if>-->
+        <!--&lt;!&ndash;            <if test="year != null and year != ''">&ndash;&gt;-->
+        <!--&lt;!&ndash;                and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))=  #{year}&ndash;&gt;-->
+        <!--&lt;!&ndash;            </if>&ndash;&gt;-->
+        <!--            <if test="startTime != null">-->
+        <!--                AND s.start_time >= #{startTime}-->
+        <!--            </if>-->
+        <!--            <if test="endTime != null">-->
+        <!--                AND #{endTime} >= s.start_time-->
+        <!--            </if>-->
+        <!--        </where>-->
+        <!--        GROUP BY-->
+        <!--        r.id,-->
+        <!--        r.region_name-->
+        <!--        order by count( c.id )-->
         SELECT
-        r.id,
-        r.region_name,
+        cu.province name,
         count( c.id ) count
         FROM
         t_b_crm c
@@ -16,9 +43,9 @@
             <if test="type != null and type != ''">
                 and cu.type = #{type}
             </if>
-<!--            <if test="year != null and year != ''">-->
-<!--                and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))=  #{year}-->
-<!--            </if>-->
+            <!--            <if test="year != null and year != ''">-->
+            <!--                and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))=  #{year}-->
+            <!--            </if>-->
             <if test="startTime != null">
                 AND s.start_time >= #{startTime}
             </if>
@@ -27,15 +54,14 @@
             </if>
         </where>
         GROUP BY
-        r.id,
-        r.region_name
+        cu.province
         order by count( c.id )
     </select>
     <select id="project" resultType="com.qmth.sop.business.bean.result.CrmAnalyseResult">
         SELECT
         s.id,
         s.`name`,
-        sum(case when c.`status`='FINISH' then 1 else 0 end)/count( c.id )  count
+        sum(case when c.`status`='FINISH' then 1 else 0 end)/count( c.id ) count
         FROM
         t_b_crm c
         LEFT JOIN sys_custom cu ON cu.id = c.custom_id
@@ -136,8 +162,8 @@
         t_b_crm c
         LEFT JOIN t_b_service s ON c.service_id = s.id
         LEFT join sys_custom cu on cu.id=c.custom_id
-<!--        WHERE-->
-<!--        YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))=  #{year}-->
+        <!--        WHERE-->
+        <!--        YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))=  #{year}-->
         <where>
             <!--            <if test="year != null and year != ''">-->
             <!--                and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))=  #{year}-->
@@ -203,10 +229,10 @@
                 AND #{endTime} >= tbs.start_time
             </if>
             <if test="crmYear != null and crmYear != ''">
-                and YEAR ( FROM_UNIXTIME( a.begin_time / 1000 ))=  #{crmYear}
+                and YEAR ( FROM_UNIXTIME( a.begin_time / 1000 ))= #{crmYear}
             </if>
             <if test="month != null and month != ''">
-                and MONTH ( FROM_UNIXTIME( a.begin_time / 1000 ))=  #{month}
+                and MONTH ( FROM_UNIXTIME( a.begin_time / 1000 ))= #{month}
             </if>
         </where>