Преглед на файлове

修改电销数据统计问题

hxl13994548489 преди 2 години
родител
ревизия
82d5a07d8b

+ 10 - 11
src/main/resources/mapper/modules/admin/SysDeptInternalAgentMapper.xml

@@ -38,21 +38,20 @@
     </select>
 
     <select id="queryGroupListByDeptId" resultType="com.ydtech.modules.admin.model.dto.GroupDto">
-        select
-            p.id AS deptId,
-            CONCAT( dept.NAME, "-", ppp.NAME, "-", p.NAME ) AS deptName
-       from
-           sys_dept_internal_agent p
-           LEFT JOIN sys_dept_internal_agent pp ON p.parent_id = pp.id
-           LEFT JOIN sys_dept_internal_agent ppp ON pp.parent_id = ppp.id
-           LEFT JOIN sys_dept dept ON ppp.bind_dept_id = dept.id
+        SELECT
+            t4.id AS deptId,
+            t4.NAME  AS deptName
+        FROM
+        sys_dept_internal_agent t3
+        LEFT JOIN sys_dept_internal_agent t4 ON t4.parent_id = t3.id
+        LEFT JOIN  sys_dept  dept  on t3.bind_dept_id = dept.id
         <where>
-             dept.id  is not null
+            t3.bind_dept_id  is not null
             <if test="comtype != null and comtype != ''">
-                AND p.comtype = #{comtype}
+                AND t4.comtype = #{comtype}
             </if>
             <if test="deptId != null and deptId != ''">
-                AND dept.id  like concat(#{deptId},'%')
+                AND t3.bind_dept_id  like concat(#{deptId},'%')
             </if>
         </where>
     </select>

+ 33 - 28
src/main/resources/mapper/modules/admin/SysTelemarketingWechatDataMapper.xml

@@ -24,21 +24,24 @@
             t1.mobile AS mobile,
             t2.id AS deptId,
             t2.`name` AS deptName,
-            t3.NAME AS groupName,
-            t3.id AS groupId,
+            t5.NAME AS groupName,
+            t5.id AS groupId,
             zgd.zgd_user_id AS zgdUserId,
             zzb.zzb_user_id AS zzdUserId,
-            dx.dial_username AS  dxUserId
+            dx.dial_username AS dxUserId
         FROM
-        sys_user t1
+            sys_user t1
         LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
-        LEFT JOIN sys_user_is_dial  dx  ON t1.id =dx.user_id
+        LEFT JOIN sys_user_is_dial dx ON t1.id = dx.user_id
         LEFT JOIN sys_user_link_dept_internal_agent t4 ON t4.user_id = t1.id
-        LEFT JOIN sys_dept_internal_agent t3 ON t2.id = t3.bind_dept_id
         LEFT JOIN sys_user_link_zgd_user_id zgd ON t2.id = zgd.user_id
         LEFT JOIN sys_user_link_zzb_user_id zzb ON t2.id = zzb.user_id
+        LEFT JOIN
+        (select t3.bind_dept_id,t4.id,t4.name from  sys_dept_internal_agent t3   left join sys_dept_internal_agent t4  on t4.parent_id =t3.id ) t5
+        ON t2.parent_id = t5.bind_dept_id
         WHERE
-        t1.`status` = 1
+         t1.`status` = 1
+          and  t2.management_source = 3
         <if test='vo !=null  '>
             <if test='vo.userName !=null and vo.userName!="" '>
                 and t1.name like CONCAT('%', #{vo.userName}, '%')
@@ -53,7 +56,7 @@
                 and t1.mobile = #{vo.mobile}
             </if>
             <if test='vo.groupId !=null and vo.groupId!=""  '>
-                and t3.id like CONCAT('', #{vo.groupId}, '%')
+                and t5.id like CONCAT('', #{vo.groupId}, '%')
             </if>
         </if>
         order by t1.id
@@ -93,26 +96,28 @@
 
     <select id="findDataByUserId" resultType="com.ydtech.modules.admin.model.dto.DxReportDataDto">
         SELECT
-        t1.id AS userId,
-        t1.NAME AS userName,
-        t1.mobile AS mobile,
-        t2.id AS deptId,
-        t2.`name` AS deptName,
-        t3.NAME AS groupName,
-        t3.id AS groupId,
-        zgd.zgd_user_id AS zgdUserId,
-        zzb.zzb_user_id AS zzdUserId,
-        dx.dial_username AS  dxUserId
+            t1.id AS userId,
+            t1.NAME AS userName,
+            t1.mobile AS mobile,
+            t2.id AS deptId,
+            t2.`name` AS deptName,
+            t5.NAME AS groupName,
+            t5.id AS groupId,
+            zgd.zgd_user_id AS zgdUserId,
+            zzb.zzb_user_id AS zzdUserId,
+            dx.dial_username AS dxUserId
         FROM
-        sys_user t1
-        LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
-        LEFT JOIN sys_user_is_dial  dx  ON t1.id =dx.user_id
-        LEFT JOIN sys_user_link_dept_internal_agent t4 ON t4.user_id = t1.id
-        LEFT JOIN sys_dept_internal_agent t3 ON t2.id = t3.bind_dept_id
-        LEFT JOIN sys_user_link_zgd_user_id zgd ON t2.id = zgd.user_id
-        LEFT JOIN sys_user_link_zzb_user_id zzb ON t2.id = zzb.user_id
-        WHERE
-        t1.`status` = 1
-        and t1.id = #{userId}
+            sys_user t1
+                LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
+                LEFT JOIN sys_user_is_dial dx ON t1.id = dx.user_id
+                LEFT JOIN sys_user_link_dept_internal_agent t4 ON t4.user_id = t1.id
+                LEFT JOIN sys_user_link_zgd_user_id zgd ON t2.id = zgd.user_id
+                LEFT JOIN sys_user_link_zzb_user_id zzb ON t2.id = zzb.user_id
+                LEFT JOIN
+            (select t3.bind_dept_id,t4.id,t4.name from  sys_dept_internal_agent t3   left join sys_dept_internal_agent t4  on t4.parent_id =t3.id ) t5
+            ON t2.parent_id = t5.bind_dept_id
+         WHERE
+            t1.`status` = 1
+           and t1.id = #{userId}
     </select>
 </mapper>

+ 0 - 1
src/main/resources/mapper/modules/admin/SysUserLinkDeptInternalAgentMapper.xml

@@ -69,7 +69,6 @@
         LEFT JOIN sys_dept sd2 ON sd2.id = t2.parent_id
         WHERE
         t1.`status` = 1
-        AND t1.id NOT LIKE '%M%'
         <if test='user !=null  '>
             <if test='user.name !=null and user.name!="" '>
                 and t1.name like CONCAT('%', #{user.name}, '%')