Browse Source

营销时段统计BUG修复

anderx 7 years ago
parent
commit
be762c70a9

+ 4 - 4
src/main/java/com/goafanti/common/mapper/DailySalesReportMapper.xml

@@ -544,6 +544,9 @@ select a.id,a.name,d.id as departmentId,d.name as departmentName,role_name as ro
 	left join user_role c on b.id = c.uid
 	 left join role d on c.rid = d.id
 	  where d.role_name in ('营销员','营销经理','营销管理员')
+	  	<if test="depId != null">
+	and a.id=#{depId,jdbcType=VARCHAR}
+		</if>
 	  group by a.id) z  left join (select b.department_id as departmentId,sum(a.followNo) as followNo,sum(a.visitNo)as visitNo,sum(a.telNo)as telNo
 			from (select
 		aid,
@@ -566,9 +569,6 @@ select a.id,a.name,d.id as departmentId,d.name as departmentName,role_name as ro
 	GROUP BY aid)a left join admin b on a.aid=b.id
 	left join department_management c on b.department_id=c.id
 	where b.department_id is not null  and b.department_id !=''
-	<if test="depId != null">
-	and b.department_id=#{depId,jdbcType=VARCHAR}
-	</if>
 	GROUP by b.department_id
 ) x  on x.departmentId=z.id
 	left join admin y on z.manager_id=y.id
@@ -602,7 +602,7 @@ select a.id,a.name,d.id as departmentId,d.name as departmentName,role_name as ro
 		and a.create_time &lt;  #{endTime,jdbcType=VARCHAR}
 		</if>
 		<if test="depId != null">
-		and a.department_id= #{depId,jdbcType=VARCHAR}
+		and b.department_id= #{depId,jdbcType=VARCHAR}
 		</if>
 	</select>