|
@@ -60,60 +60,56 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
<select id="servicePersonnelTotal" resultType="java.lang.Integer">
|
|
|
-<!-- SELECT-->
|
|
|
-<!-- count( sd.region_user_id )+-->
|
|
|
-<!-- count( sd.engineer_user_id )+-->
|
|
|
-<!-- SUM( length( sd.assistant_engineer_user_ids )- length( REPLACE ( sd.assistant_engineer_user_ids, ',', '' ))+ 1 )-->
|
|
|
-<!-- FROM-->
|
|
|
-<!-- t_b_service s-->
|
|
|
-<!-- LEFT JOIN t_b_sop_info sop ON sop.service_id = s.id-->
|
|
|
-<!-- LEFT JOIN t_b_sop_info_detail sd ON sd.sop_info_id = sop.id-->
|
|
|
-<!-- SELECT-->
|
|
|
-<!-- count(DISTINCT s.user_id)-->
|
|
|
-<!-- FROM-->
|
|
|
-<!-- t_b_user_archives_allocation s-->
|
|
|
+ SELECT count( DISTINCT region_user_id )+ count( DISTINCT user_id ) from
|
|
|
|
|
|
- SELECT count(DISTINCT id) FROM sys_user WHERE
|
|
|
- id IN (
|
|
|
- SELECT a.lead_id FROM t_b_sop_info_detail a
|
|
|
- left join t_b_sop_info i on a.sop_info_id=i.id
|
|
|
+ t_b_user_archives_allocation
|
|
|
+ <where>
|
|
|
+ <if test="serviceUnitId != null and serviceUnitId != ''">
|
|
|
+ and service_id = #{serviceUnitId}
|
|
|
+ </if>
|
|
|
|
|
|
- LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no
|
|
|
- LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
|
|
|
- <where>
|
|
|
- and tffa.status!='FINISH'
|
|
|
- <if test="serviceUnitId != null and serviceUnitId != ''">
|
|
|
- and i.service_id = #{serviceUnitId}
|
|
|
- </if>
|
|
|
+ </where>
|
|
|
+<!-- SELECT count(DISTINCT id) FROM sys_user WHERE-->
|
|
|
+<!-- id IN (-->
|
|
|
+<!-- SELECT a.lead_id FROM t_b_sop_info_detail a-->
|
|
|
+<!-- left join t_b_sop_info i on a.sop_info_id=i.id-->
|
|
|
|
|
|
- </where>
|
|
|
- UNION ALL
|
|
|
- SELECT a.region_user_id FROM t_b_sop_info_detail a
|
|
|
- left join t_b_sop_info i on a.sop_info_id=i.id
|
|
|
+<!-- LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no-->
|
|
|
+<!-- LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- and tffa.status!='FINISH'-->
|
|
|
+<!-- <if test="serviceUnitId != null and serviceUnitId != ''">-->
|
|
|
+<!-- and i.service_id = #{serviceUnitId}-->
|
|
|
+<!-- </if>-->
|
|
|
|
|
|
- LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no
|
|
|
- LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
|
|
|
- <where>
|
|
|
- and tffa.status!='FINISH'
|
|
|
- <if test="serviceUnitId != null and serviceUnitId != ''">
|
|
|
- and i.service_id = #{serviceUnitId}
|
|
|
- </if>
|
|
|
+<!-- </where>-->
|
|
|
+<!-- UNION ALL-->
|
|
|
+<!-- SELECT a.region_user_id FROM t_b_sop_info_detail a-->
|
|
|
+<!-- left join t_b_sop_info i on a.sop_info_id=i.id-->
|
|
|
|
|
|
- </where>
|
|
|
- UNION ALL
|
|
|
- SELECT a.engineer_user_id FROM t_b_sop_info_detail a
|
|
|
- left join t_b_sop_info i on a.sop_info_id=i.id
|
|
|
+<!-- LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no-->
|
|
|
+<!-- LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- and tffa.status!='FINISH'-->
|
|
|
+<!-- <if test="serviceUnitId != null and serviceUnitId != ''">-->
|
|
|
+<!-- and i.service_id = #{serviceUnitId}-->
|
|
|
+<!-- </if>-->
|
|
|
|
|
|
- LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no
|
|
|
- LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
|
|
|
- <where>
|
|
|
- and tffa.status!='FINISH'
|
|
|
- <if test="serviceUnitId != null and serviceUnitId != ''">
|
|
|
- and i.service_id = #{serviceUnitId}
|
|
|
- </if>
|
|
|
+<!-- </where>-->
|
|
|
+<!-- UNION ALL-->
|
|
|
+<!-- SELECT a.engineer_user_id FROM t_b_sop_info_detail a-->
|
|
|
+<!-- left join t_b_sop_info i on a.sop_info_id=i.id-->
|
|
|
|
|
|
- </where>
|
|
|
- )
|
|
|
+<!-- LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = i.sop_no-->
|
|
|
+<!-- LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- and tffa.status!='FINISH'-->
|
|
|
+<!-- <if test="serviceUnitId != null and serviceUnitId != ''">-->
|
|
|
+<!-- and i.service_id = #{serviceUnitId}-->
|
|
|
+<!-- </if>-->
|
|
|
+
|
|
|
+<!-- </where>-->
|
|
|
+<!-- )-->
|
|
|
</select>
|
|
|
<select id="projectCount" resultType="java.lang.Integer">
|
|
|
SELECT
|
|
@@ -192,12 +188,47 @@
|
|
|
a.create_time DESC
|
|
|
</select>
|
|
|
<select id="supplierRole" resultType="java.util.Map">
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- r.NAME,-->
|
|
|
+<!-- count( DISTINCT ua.archives_id ) count-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- t_b_user_archives_allocation ua-->
|
|
|
+<!-- LEFT JOIN sys_role r ON r.id = ua.role_id-->
|
|
|
+<!-- LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.archives_id-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- and us.authentication_valid_time > UNIX_TIMESTAMP()* 1000-->
|
|
|
+<!-- <if test="supplierId != null and supplierId != ''">-->
|
|
|
+<!-- and us.supplier_id = #{supplierId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- GROUP BY-->
|
|
|
+<!-- r.NAME-->
|
|
|
+
|
|
|
+
|
|
|
SELECT
|
|
|
r.NAME,
|
|
|
- count( DISTINCT ua.archives_id ) count
|
|
|
+ count( DISTINCT ua.user_id ) count
|
|
|
FROM
|
|
|
t_b_user_archives_allocation ua
|
|
|
LEFT JOIN sys_role r ON r.id = ua.role_id
|
|
|
+ LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.archives_id
|
|
|
+ <where>
|
|
|
+ and us.authentication_valid_time > UNIX_TIMESTAMP()* 1000
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
+ and us.supplier_id = #{supplierId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ r.NAME
|
|
|
+
|
|
|
+ UNION all
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ '区域协调人' as NAME,
|
|
|
+ count( DISTINCT ua.region_user_id ) count
|
|
|
+
|
|
|
+ FROM
|
|
|
+ t_b_user_archives_allocation ua
|
|
|
LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.archives_id
|
|
|
<where>
|
|
|
and us.authentication_valid_time > UNIX_TIMESTAMP()* 1000
|
|
@@ -205,8 +236,6 @@
|
|
|
and us.supplier_id = #{supplierId}
|
|
|
</if>
|
|
|
</where>
|
|
|
- GROUP BY
|
|
|
- r.NAME
|
|
|
</select>
|
|
|
<select id="supplierRegion" resultType="java.util.Map">
|
|
|
SELECT DISTINCT
|