|
@@ -4,302 +4,195 @@
|
|
|
|
|
|
<select id="findDingSubmitPage" resultType="com.qmth.sop.business.bean.result.DingSubmitResult">
|
|
<select id="findDingSubmitPage" resultType="com.qmth.sop.business.bean.result.DingSubmitResult">
|
|
SELECT
|
|
SELECT
|
|
- *
|
|
|
|
|
|
+ sta.service_id AS serviceUnitId,
|
|
|
|
+ tbs.name AS serviceUnitName,
|
|
|
|
+ sta.sop_no AS sopNo,
|
|
|
|
+ sta.crm_no AS crmNo,
|
|
|
|
+ sta.custom_name AS customName,
|
|
|
|
+ sta.province AS province,
|
|
|
|
+ sta.city AS city,
|
|
|
|
+ sta.user_archives_code AS archivesCode,
|
|
|
|
+ sta.user_archives_name AS archivesName,
|
|
|
|
+ CONCAT(sta.user_archives_name,
|
|
|
|
+ '(',
|
|
|
|
+ sta.user_archives_code,
|
|
|
|
+ ')') AS archivesInfo,
|
|
|
|
+ sta.scan_start_time AS scanStartTime,
|
|
|
|
+ sta.scan_end_time AS scanEndTime,
|
|
|
|
+ sta.mark_paper_start_time AS markPaperStartTime,
|
|
|
|
+ sta.mark_paper_end_time AS markPaperEndTime,
|
|
|
|
+ sta.sop_role_type AS roleType,
|
|
|
|
+ sta.supplier_name AS supplierName,
|
|
|
|
+ sta.actual_days AS actualDays,
|
|
|
|
+ sta.weekdays AS weekdays,
|
|
|
|
+ sta.weekends AS weekends,
|
|
|
|
+ sta.legal_holidays AS legalHolidays,
|
|
|
|
+ sta.violation_days AS violationDays,
|
|
|
|
+ sta.ding_exception_count AS dingExceptionCount,
|
|
|
|
+ sta.remain_count AS remainCount,
|
|
|
|
+ sta.exception_count AS exceptionCount,
|
|
|
|
+ IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
|
|
|
|
+ tbds.submit_user_id AS submitUserId,
|
|
|
|
+ su.real_name AS submitUserName,
|
|
|
|
+ tbds.submit_time AS submitTime
|
|
FROM
|
|
FROM
|
|
- (SELECT
|
|
|
|
- tbd.service_id AS serviceUnitId,
|
|
|
|
- tbs.name AS serviceUnitName,
|
|
|
|
- tbd.sop_no AS sopNo,
|
|
|
|
- tbd.crm_no AS crmNo,
|
|
|
|
- sc.name AS customName,
|
|
|
|
- sc.province AS province,
|
|
|
|
- sc.city AS city,
|
|
|
|
- tbd.approach_time AS approachTime,
|
|
|
|
- tbd.departure_time AS departureTime,
|
|
|
|
- tbd.user_id AS userId,
|
|
|
|
- tbua.id AS archivesId,
|
|
|
|
- tbua.code AS archivesCode,
|
|
|
|
- tbua.name AS archivesName,
|
|
|
|
- CONCAT(tbua.name, '(', tbua.code, ')') AS archivesInfo,
|
|
|
|
- tbd.role_type AS roleType,
|
|
|
|
- ss.id AS supplierId,
|
|
|
|
- ss.name AS supplierName,
|
|
|
|
- tbd.actual_days AS actualDays,
|
|
|
|
- tbd.weekdays AS weekdays,
|
|
|
|
- tbd.weekends AS weekends,
|
|
|
|
- tbd.legal_holidays AS legalHolidays,
|
|
|
|
- tbd.work_hours AS workHours,
|
|
|
|
- tbd.violation_days AS violationDays,
|
|
|
|
- IFNULL(ec.cnt,0) AS exceptionCount,
|
|
|
|
- tbds.id AS submitId,
|
|
|
|
- IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
|
|
|
|
- tbds.submit_user_id AS submitUserId,
|
|
|
|
- su.real_name AS submitUserName,
|
|
|
|
- tbds.submit_time AS submitTime,
|
|
|
|
- tbs.service_lead_id AS serviceUnitLeaderId,
|
|
|
|
- tbc.lead_id AS regionManagerId,
|
|
|
|
- tbc.region_coordinator_id AS coordinatorId,
|
|
|
|
- tbs.update_time AS serviceUpdateTime,
|
|
|
|
- tbs.status AS serviceStatus,
|
|
|
|
- tbc.update_time AS crmUpdateTime,
|
|
|
|
- tbd.sign_in_exception_count + tbd.sign_out_exception_count AS dingExceptionCount
|
|
|
|
- FROM
|
|
|
|
- (SELECT
|
|
|
|
- service_id,
|
|
|
|
- sop_no,
|
|
|
|
- crm_no,
|
|
|
|
- user_archives_id,
|
|
|
|
- MAX(user_id) AS user_id,
|
|
|
|
- MAX(role_type) AS role_type,
|
|
|
|
- MIN(sign_in_time) AS approach_time,
|
|
|
|
- MAX(sign_out_time) AS departure_time,
|
|
|
|
- SUM(IF((sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS actual_days,
|
|
|
|
- SUM(IF(date_type = 'WEEKDAY' AND (sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS weekdays,
|
|
|
|
- SUM(IF(date_type = 'WEEKEND' AND (sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS weekends,
|
|
|
|
- SUM(IF(date_type = 'LEGAL_HOLIDAYS' AND (sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS legal_holidays,
|
|
|
|
- ROUND(SUM(IF(sign_out_time IS NOT NULL AND sign_in_time IS NOT NULL, TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(SUBSTRING(sign_in_time, 1, 10), '%Y-%m-%d %H:%i:%s'), FROM_UNIXTIME(SUBSTRING(sign_out_time, 1, 10), '%Y-%m-%d %H:%i:%s')), 0)) / 60, 1) AS work_hours,
|
|
|
|
- SUM(IF((sign_in_time IS NULL OR sign_out_time IS NULL) AND (sign_in_time IS NOT NULL OR sign_out_time IS NOT NULL), 1, 0)) AS violation_days,
|
|
|
|
- SUM(IF(sign_in_time IS NULL, 1, 0)) AS sign_in_exception_count,
|
|
|
|
- SUM(IF(sign_out_time IS NULL, 1, 0)) AS sign_out_exception_count
|
|
|
|
- FROM
|
|
|
|
- t_b_ding
|
|
|
|
- GROUP BY service_id , sop_no , crm_no , user_archives_id) tbd
|
|
|
|
- LEFT JOIN (SELECT
|
|
|
|
- COUNT(*) AS cnt, sop_no, crm_no, create_id
|
|
|
|
- FROM
|
|
|
|
- t_b_ding_apply
|
|
|
|
- GROUP BY sop_no , crm_no , create_id) sec ON sec.sop_no = tbd.sop_no
|
|
|
|
- AND sec.crm_no = tbd.crm_no
|
|
|
|
- AND sec.create_id = tbd.user_id
|
|
|
|
- LEFT JOIN (SELECT
|
|
|
|
- COUNT(*) AS cnt, sop_no, crm_no, create_id
|
|
|
|
- FROM
|
|
|
|
- t_b_ding_apply
|
|
|
|
- WHERE approve IS NULL
|
|
|
|
- GROUP BY sop_no , crm_no , create_id) ec ON ec.sop_no = tbd.sop_no
|
|
|
|
- AND ec.crm_no = tbd.crm_no
|
|
|
|
- AND ec.create_id = tbd.user_id
|
|
|
|
- LEFT JOIN t_b_ding_submit tbds ON tbd.sop_no = tbds.sop_no
|
|
|
|
- AND tbd.user_archives_id = tbds.user_archives_id
|
|
|
|
- LEFT JOIN t_b_service tbs ON tbd.service_id = tbs.id AND tbs.enable
|
|
|
|
- LEFT JOIN t_b_crm tbc ON tbd.crm_no = tbc.crm_no
|
|
|
|
- LEFT JOIN sys_custom sc ON tbc.custom_id = sc.id
|
|
|
|
- LEFT JOIN t_b_user_archives tbua ON tbd.user_archives_id = tbua.id
|
|
|
|
- LEFT JOIN t_b_user_archives_supplier tbuas ON tbuas.user_archives_id = tbua.id
|
|
|
|
- LEFT JOIN sys_supplier ss ON tbuas.supplier_id = ss.id
|
|
|
|
- LEFT JOIN sys_user su ON tbds.submit_user_id = su.id
|
|
|
|
- LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.code = tbd.sop_no
|
|
|
|
- LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
|
|
|
|
- ) main
|
|
|
|
|
|
+ t_b_ding_statistic sta
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ t_b_service tbs ON sta.service_id = tbs.id
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ t_b_crm tbc ON sta.crm_no = tbc.crm_no
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ t_b_ding_submit tbds ON sta.sop_no = tbds.sop_no
|
|
|
|
+ AND sta.user_archives_id = tbds.user_archives_id
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ sys_user su ON tbds.submit_user_id = su.id
|
|
<where>
|
|
<where>
|
|
- AND main.serviceStatus = 'PUBLISH'
|
|
|
|
|
|
+ AND tbs.status = 'PUBLISH'
|
|
<if test="serviceUnitId != null">
|
|
<if test="serviceUnitId != null">
|
|
- AND main.serviceUnitId = #{serviceUnitId}
|
|
|
|
|
|
+ AND sta.service_id = #{serviceUnitId}
|
|
</if>
|
|
</if>
|
|
<if test="dingSubmitStatusList != null and dingSubmitStatusList != '' and dingSubmitStatusList.size > 0">
|
|
<if test="dingSubmitStatusList != null and dingSubmitStatusList != '' and dingSubmitStatusList.size > 0">
|
|
- AND main.submitStatus IN
|
|
|
|
|
|
+ AND IFNULL(tbds.submit_status, 'WILL_SUBMIT') IN
|
|
<foreach collection="dingSubmitStatusList" item="item" index="index" open="(" separator="," close=")">
|
|
<foreach collection="dingSubmitStatusList" item="item" index="index" open="(" separator="," close=")">
|
|
#{item}
|
|
#{item}
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
<if test="submitUserId != null">
|
|
<if test="submitUserId != null">
|
|
- AND main.submitUserId = #{serviceUnitId}
|
|
|
|
|
|
+ AND tbds.submit_user_id = #{serviceUnitId}
|
|
</if>
|
|
</if>
|
|
<if test="archivesName != null and archivesName != ''">
|
|
<if test="archivesName != null and archivesName != ''">
|
|
- AND main.archivesName LIKE CONCAT('%',#{archivesName},'%')
|
|
|
|
|
|
+ AND sta.user_archives_name LIKE CONCAT('%',#{archivesName},'%')
|
|
</if>
|
|
</if>
|
|
<if test="supplierId != null">
|
|
<if test="supplierId != null">
|
|
- AND main.supplierId = #{supplierId}
|
|
|
|
|
|
+ AND sta.supplier_id = #{supplierId}
|
|
</if>
|
|
</if>
|
|
<if test="customName != null and customName != ''">
|
|
<if test="customName != null and customName != ''">
|
|
- AND main.customName LIKE CONCAT('%',#{customName},'%')
|
|
|
|
|
|
+ AND sta.custom_name LIKE CONCAT('%',#{customName},'%')
|
|
</if>
|
|
</if>
|
|
<if test="sopNo != null and sopNo != ''">
|
|
<if test="sopNo != null and sopNo != ''">
|
|
- AND main.sopNo = #{sopNo}
|
|
|
|
|
|
+ AND sta.sop_no = #{sopNo}
|
|
</if>
|
|
</if>
|
|
<if test="violationHoursLimit != null">
|
|
<if test="violationHoursLimit != null">
|
|
- AND main.violationDays > #{violationHoursLimit}
|
|
|
|
|
|
+ AND sta.violation_days > #{violationHoursLimit}
|
|
</if>
|
|
</if>
|
|
<if test="dingExceptionLimit != null">
|
|
<if test="dingExceptionLimit != null">
|
|
- AND main.dingExceptionCount > #{dingExceptionLimit}
|
|
|
|
|
|
+ AND sta.ding_exception_count > #{dingExceptionLimit}
|
|
</if>
|
|
</if>
|
|
<if test="exceptionLimit != null">
|
|
<if test="exceptionLimit != null">
|
|
- AND main.exceptionCount > #{exceptionLimit}
|
|
|
|
|
|
+ AND sta.exception_count > #{exceptionLimit}
|
|
</if>
|
|
</if>
|
|
<if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
|
|
<if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
|
|
<choose>
|
|
<choose>
|
|
<when test="dpr.hasBusiness">
|
|
<when test="dpr.hasBusiness">
|
|
- AND main.serviceUnitLeaderId = #{dpr.requestUserId}
|
|
|
|
|
|
+ AND tbs.service_lead_id = #{dpr.requestUserId}
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
<choose>
|
|
<choose>
|
|
<when test="dpr.hasRegionManager">
|
|
<when test="dpr.hasRegionManager">
|
|
- AND main.regionManagerId = #{dpr.requestUserId}
|
|
|
|
|
|
+ AND tbc.lead_id = #{dpr.requestUserId}
|
|
</when>
|
|
</when>
|
|
- <otherwise>
|
|
|
|
- <choose>
|
|
|
|
- <when test="dpr.hasRegionCoordinator">
|
|
|
|
- AND main.coordinatorId = #{dpr.requestUserId}
|
|
|
|
- </when>
|
|
|
|
- </choose>
|
|
|
|
- </otherwise>
|
|
|
|
</choose>
|
|
</choose>
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
- ORDER BY main.serviceUpdateTime DESC,main.crmUpdateTime DESC
|
|
|
|
|
|
+ ORDER BY tbs.update_time DESC,tbc.update_time DESC
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findDingSubmitList" resultType="com.qmth.sop.business.bean.result.DingSubmitResult">
|
|
<select id="findDingSubmitList" resultType="com.qmth.sop.business.bean.result.DingSubmitResult">
|
|
SELECT
|
|
SELECT
|
|
- *
|
|
|
|
|
|
+ sta.service_id AS serviceUnitId,
|
|
|
|
+ tbs.name AS serviceUnitName,
|
|
|
|
+ sta.sop_no AS sopNo,
|
|
|
|
+ sta.crm_no AS crmNo,
|
|
|
|
+ sta.custom_name AS customName,
|
|
|
|
+ sta.province AS province,
|
|
|
|
+ sta.city AS city,
|
|
|
|
+ sta.user_archives_code AS archivesCode,
|
|
|
|
+ sta.user_archives_name AS archivesName,
|
|
|
|
+ CONCAT(sta.user_archives_name,
|
|
|
|
+ '(',
|
|
|
|
+ sta.user_archives_code,
|
|
|
|
+ ')') AS archivesInfo,
|
|
|
|
+ sta.scan_start_time AS scanStartTime,
|
|
|
|
+ sta.scan_end_time AS scanEndTime,
|
|
|
|
+ sta.mark_paper_start_time AS markPaperStartTime,
|
|
|
|
+ sta.mark_paper_end_time AS markPaperEndTime,
|
|
|
|
+ sta.sop_role_type AS roleType,
|
|
|
|
+ sta.supplier_name AS supplierName,
|
|
|
|
+ sta.actual_days AS actualDays,
|
|
|
|
+ sta.weekdays AS weekdays,
|
|
|
|
+ sta.weekends AS weekends,
|
|
|
|
+ sta.legal_holidays AS legalHolidays,
|
|
|
|
+ sta.violation_days AS violationDays,
|
|
|
|
+ sta.ding_exception_count AS dingExceptionCount,
|
|
|
|
+ sta.remain_count AS remainCount,
|
|
|
|
+ sta.exception_count AS exceptionCount,
|
|
|
|
+ IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
|
|
|
|
+ tbds.submit_user_id AS submitUserId,
|
|
|
|
+ su.real_name AS submitUserName,
|
|
|
|
+ tbds.submit_time AS submitTime
|
|
FROM
|
|
FROM
|
|
- (SELECT
|
|
|
|
- tbd.service_id AS serviceUnitId,
|
|
|
|
- tbs.name AS serviceUnitName,
|
|
|
|
- tbd.sop_no AS sopNo,
|
|
|
|
- tbd.crm_no AS crmNo,
|
|
|
|
- sc.name AS customName,
|
|
|
|
- sc.province AS province,
|
|
|
|
- sc.city AS city,
|
|
|
|
- tbd.approach_time AS approachTime,
|
|
|
|
- tbd.departure_time AS departureTime,
|
|
|
|
- tbd.user_id AS userId,
|
|
|
|
- tbua.id AS archivesId,
|
|
|
|
- tbua.code AS archivesCode,
|
|
|
|
- tbua.name AS archivesName,
|
|
|
|
- CONCAT(tbua.name, '(', tbua.code, ')') AS archivesInfo,
|
|
|
|
- tbd.role_type AS roleType,
|
|
|
|
- ss.id AS supplierId,
|
|
|
|
- ss.name AS supplierName,
|
|
|
|
- tbd.actual_days AS actualDays,
|
|
|
|
- tbd.weekdays AS weekdays,
|
|
|
|
- tbd.weekends AS weekends,
|
|
|
|
- tbd.legal_holidays AS legalHolidays,
|
|
|
|
- tbd.work_hours AS workHours,
|
|
|
|
- tbd.violation_days AS violationDays,
|
|
|
|
- IFNULL(ec.cnt,0) AS exceptionCount,
|
|
|
|
- tbds.id AS submitId,
|
|
|
|
- IFNULL(tbds.submit_status, 'WILL_SUBMIT') AS submitStatus,
|
|
|
|
- tbds.submit_user_id AS submitUserId,
|
|
|
|
- su.real_name AS submitUserName,
|
|
|
|
- tbds.submit_time AS submitTime,
|
|
|
|
- tbs.service_lead_id AS serviceUnitLeaderId,
|
|
|
|
- tbc.lead_id AS regionManagerId,
|
|
|
|
- tbc.region_coordinator_id AS coordinatorId,
|
|
|
|
- tbs.update_time AS serviceUpdateTime,
|
|
|
|
- tbs.status AS serviceStatus,
|
|
|
|
- tbc.update_time AS crmUpdateTime,
|
|
|
|
- tbd.sign_in_exception_count + tbd.sign_out_exception_count AS dingExceptionCount
|
|
|
|
- FROM
|
|
|
|
- (SELECT
|
|
|
|
- service_id,
|
|
|
|
- sop_no,
|
|
|
|
- crm_no,
|
|
|
|
- user_archives_id,
|
|
|
|
- MAX(user_id) AS user_id,
|
|
|
|
- MAX(role_type) AS role_type,
|
|
|
|
- MIN(sign_in_time) AS approach_time,
|
|
|
|
- MAX(sign_out_time) AS departure_time,
|
|
|
|
- SUM(IF((sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS actual_days,
|
|
|
|
- SUM(IF(date_type = 'WEEKDAY' AND (sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS weekdays,
|
|
|
|
- SUM(IF(date_type = 'WEEKEND' AND (sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS weekends,
|
|
|
|
- SUM(IF(date_type = 'LEGAL_HOLIDAYS' AND (sign_in_time IS NOT NULL AND sign_out_time IS NOT NULL), 1, 0)) AS legal_holidays,
|
|
|
|
- ROUND(SUM(IF(sign_out_time IS NOT NULL AND sign_in_time IS NOT NULL, TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(SUBSTRING(sign_in_time, 1, 10), '%Y-%m-%d %H:%i:%s'), FROM_UNIXTIME(SUBSTRING(sign_out_time, 1, 10), '%Y-%m-%d %H:%i:%s')), 0)) / 60, 1) AS work_hours,
|
|
|
|
- SUM(IF((sign_in_time IS NULL OR sign_out_time IS NULL) AND (sign_in_time IS NOT NULL OR sign_out_time IS NOT NULL), 1, 0)) AS violation_days,
|
|
|
|
- SUM(IF(sign_in_time IS NULL, 1, 0)) AS sign_in_exception_count,
|
|
|
|
- SUM(IF(sign_out_time IS NULL, 1, 0)) AS sign_out_exception_count
|
|
|
|
- FROM
|
|
|
|
- t_b_ding
|
|
|
|
- GROUP BY service_id , sop_no , crm_no , user_archives_id) tbd
|
|
|
|
- LEFT JOIN (SELECT
|
|
|
|
- COUNT(*) AS cnt, sop_no, crm_no, create_id
|
|
|
|
- FROM
|
|
|
|
- t_b_ding_apply
|
|
|
|
- GROUP BY sop_no , crm_no , create_id) sec ON sec.sop_no = tbd.sop_no
|
|
|
|
- AND sec.crm_no = tbd.crm_no
|
|
|
|
- AND sec.create_id = tbd.user_id
|
|
|
|
- LEFT JOIN (SELECT
|
|
|
|
- COUNT(*) AS cnt, sop_no, crm_no, create_id
|
|
|
|
- FROM
|
|
|
|
- t_b_ding_apply
|
|
|
|
- WHERE approve IS NULL
|
|
|
|
- GROUP BY sop_no , crm_no , create_id) ec ON ec.sop_no = tbd.sop_no
|
|
|
|
- AND ec.crm_no = tbd.crm_no
|
|
|
|
- AND ec.create_id = tbd.user_id
|
|
|
|
- LEFT JOIN t_b_ding_submit tbds ON tbd.sop_no = tbds.sop_no
|
|
|
|
- AND tbd.user_archives_id = tbds.user_archives_id
|
|
|
|
- LEFT JOIN t_b_service tbs ON tbd.service_id = tbs.id AND tbs.enable
|
|
|
|
- LEFT JOIN t_b_crm tbc ON tbd.crm_no = tbc.crm_no
|
|
|
|
- LEFT JOIN sys_custom sc ON tbc.custom_id = sc.id
|
|
|
|
- LEFT JOIN t_b_user_archives tbua ON tbd.user_archives_id = tbua.id
|
|
|
|
- LEFT JOIN t_b_user_archives_supplier tbuas ON tbuas.user_archives_id = tbua.id
|
|
|
|
- LEFT JOIN sys_supplier ss ON tbuas.supplier_id = ss.id
|
|
|
|
- LEFT JOIN sys_user su ON tbds.submit_user_id = su.id
|
|
|
|
- LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.code = tbd.sop_no
|
|
|
|
- LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
|
|
|
|
- ) main
|
|
|
|
|
|
+ t_b_ding_statistic sta
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ t_b_service tbs ON sta.service_id = tbs.id
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ t_b_crm tbc ON sta.crm_no = tbc.crm_no
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ t_b_ding_submit tbds ON sta.sop_no = tbds.sop_no
|
|
|
|
+ AND sta.user_archives_id = tbds.user_archives_id
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ sys_user su ON tbds.submit_user_id = su.id
|
|
<where>
|
|
<where>
|
|
- AND main.serviceStatus = 'PUBLISH'
|
|
|
|
|
|
+ AND tbs.status = 'PUBLISH'
|
|
<if test="serviceUnitId != null">
|
|
<if test="serviceUnitId != null">
|
|
- AND main.serviceUnitId = #{serviceUnitId}
|
|
|
|
|
|
+ AND sta.service_id = #{serviceUnitId}
|
|
</if>
|
|
</if>
|
|
<if test="dingSubmitStatusList != null and dingSubmitStatusList != '' and dingSubmitStatusList.size > 0">
|
|
<if test="dingSubmitStatusList != null and dingSubmitStatusList != '' and dingSubmitStatusList.size > 0">
|
|
- AND main.submitStatus IN
|
|
|
|
|
|
+ AND IFNULL(tbds.submit_status, 'WILL_SUBMIT') IN
|
|
<foreach collection="dingSubmitStatusList" item="item" index="index" open="(" separator="," close=")">
|
|
<foreach collection="dingSubmitStatusList" item="item" index="index" open="(" separator="," close=")">
|
|
#{item}
|
|
#{item}
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
<if test="submitUserId != null">
|
|
<if test="submitUserId != null">
|
|
- AND main.submitUserId = #{serviceUnitId}
|
|
|
|
- </if>
|
|
|
|
- <if test="archivesId != null">
|
|
|
|
- AND main.archivesId = #{archivesId}
|
|
|
|
|
|
+ AND tbds.submit_user_id = #{serviceUnitId}
|
|
</if>
|
|
</if>
|
|
<if test="archivesName != null and archivesName != ''">
|
|
<if test="archivesName != null and archivesName != ''">
|
|
- AND main.archivesName LIKE CONCAT('%',#{archivesName},'%')
|
|
|
|
|
|
+ AND sta.user_archives_name LIKE CONCAT('%',#{archivesName},'%')
|
|
</if>
|
|
</if>
|
|
<if test="supplierId != null">
|
|
<if test="supplierId != null">
|
|
- AND main.supplierId = #{supplierId}
|
|
|
|
|
|
+ AND sta.supplier_id = #{supplierId}
|
|
</if>
|
|
</if>
|
|
<if test="customName != null and customName != ''">
|
|
<if test="customName != null and customName != ''">
|
|
- AND main.customName LIKE CONCAT('%',#{customName},'%')
|
|
|
|
|
|
+ AND sta.custom_name LIKE CONCAT('%',#{customName},'%')
|
|
</if>
|
|
</if>
|
|
<if test="sopNo != null and sopNo != ''">
|
|
<if test="sopNo != null and sopNo != ''">
|
|
- AND main.sopNo = #{sopNo}
|
|
|
|
|
|
+ AND sta.sop_no = #{sopNo}
|
|
</if>
|
|
</if>
|
|
<if test="violationHoursLimit != null">
|
|
<if test="violationHoursLimit != null">
|
|
- AND main.violationDays > #{violationHoursLimit}
|
|
|
|
|
|
+ AND sta.violation_days > #{violationHoursLimit}
|
|
</if>
|
|
</if>
|
|
<if test="dingExceptionLimit != null">
|
|
<if test="dingExceptionLimit != null">
|
|
- AND main.dingExceptionCount > #{dingExceptionLimit}
|
|
|
|
|
|
+ AND sta.ding_exception_count > #{dingExceptionLimit}
|
|
</if>
|
|
</if>
|
|
<if test="exceptionLimit != null">
|
|
<if test="exceptionLimit != null">
|
|
- AND main.exceptionCount > #{exceptionLimit}
|
|
|
|
|
|
+ AND sta.exception_count > #{exceptionLimit}
|
|
</if>
|
|
</if>
|
|
<if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
|
|
<if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
|
|
<choose>
|
|
<choose>
|
|
<when test="dpr.hasBusiness">
|
|
<when test="dpr.hasBusiness">
|
|
- AND main.serviceUnitLeaderId = #{dpr.requestUserId}
|
|
|
|
|
|
+ AND tbs.service_lead_id = #{dpr.requestUserId}
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
<choose>
|
|
<choose>
|
|
<when test="dpr.hasRegionManager">
|
|
<when test="dpr.hasRegionManager">
|
|
- AND main.regionManagerId = #{dpr.requestUserId}
|
|
|
|
|
|
+ AND tbc.lead_id = #{dpr.requestUserId}
|
|
</when>
|
|
</when>
|
|
- <otherwise>
|
|
|
|
- <choose>
|
|
|
|
- <when test="dpr.hasRegionCoordinator">
|
|
|
|
- AND main.coordinatorId = #{dpr.requestUserId}
|
|
|
|
- </when>
|
|
|
|
- </choose>
|
|
|
|
- </otherwise>
|
|
|
|
</choose>
|
|
</choose>
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
- ORDER BY main.serviceUpdateTime DESC,main.crmUpdateTime DESC
|
|
|
|
|
|
+ ORDER BY tbs.update_time DESC,tbc.update_time DESC
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|