|
@@ -182,19 +182,24 @@
|
|
|
r.region_name
|
|
|
FROM
|
|
|
t_b_crm c
|
|
|
- left join t_b_service_region r on r.id=c.region_id
|
|
|
-<!-- LEFT JOIN sys_user u ON u.id = c.region_coordinator_id-->
|
|
|
-<!-- LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number-->
|
|
|
-<!-- LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id-->
|
|
|
-<!-- LEFT JOIN sys_supplier su ON su.id = us.supplier_id-->
|
|
|
+ LEFT JOIN
|
|
|
+ t_b_service_region r ON r.id = c.region_id
|
|
|
+ LEFT JOIN
|
|
|
+ t_b_user_archives_allocation tbuaa on tbuaa.crm_no = c.crm_no
|
|
|
+ LEFT JOIN
|
|
|
+ t_b_user_archives ua ON ua.id = tbuaa.archives_id
|
|
|
+ LEFT JOIN
|
|
|
+ t_b_user_archives_supplier us ON us.user_archives_id = ua.id
|
|
|
+ LEFT JOIN
|
|
|
+ sys_supplier su ON su.id = us.supplier_id
|
|
|
<where>
|
|
|
and r.id IS NOT NULL
|
|
|
<if test="serviceUnitId != null and serviceUnitId != ''">
|
|
|
and c.service_id = #{serviceUnitId}
|
|
|
</if>
|
|
|
-<!-- <if test="supplierId != null and supplierId != ''">-->
|
|
|
-<!-- and us.supplier_id = #{supplierId}-->
|
|
|
-<!-- </if>-->
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
+ and us.supplier_id = #{supplierId}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|