|
@@ -212,34 +212,98 @@
|
|
|
</where>) t
|
|
|
join t_f_custom_flow_entity tfcfe on tfcfe.code = t.sop_no
|
|
|
join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
|
|
|
- where t.status = 'DRAFT' and (tffa.status in ('START', 'DRAFT', 'AUDITING', 'REJECT', 'CANCEL') or (tffa.status = 'FINISH' and (t.datediff <![CDATA[ >= ]]> -1 and t.datediff <![CDATA[ <= ]]> 0)))
|
|
|
+-- where t.status = 'DRAFT' and (tffa.status in ('START', 'DRAFT', 'AUDITING', 'REJECT', 'CANCEL') or (tffa.status = 'FINISH' and (t.datediff <![CDATA[ >= ]]> -1 and t.datediff <![CDATA[ <= ]]> 0)))
|
|
|
+ where (tffa.status in ('START', 'DRAFT', 'AUDITING', 'REJECT', 'CANCEL') or (tffa.status = 'FINISH' and (t.datediff <![CDATA[ >= ]]> -1 and t.datediff <![CDATA[ <= ]]> 0)))
|
|
|
</select>
|
|
|
|
|
|
<select id="findFlowByServiceId" resultType="com.qmth.sop.business.bean.result.SopInfoResult">
|
|
|
- select
|
|
|
- tbsi.id,
|
|
|
- tbsi.sop_no as sopNo,
|
|
|
- tbsi.crm_no as crmNo,
|
|
|
- tbc.name as crmName,
|
|
|
- sc.name as customName,
|
|
|
- sc.type as customType,
|
|
|
- sc.id as customId,
|
|
|
- tbsi.service_id as serviceId,
|
|
|
- tbs.name as serviceName
|
|
|
- from
|
|
|
- t_b_sop_info tbsi
|
|
|
- left join t_b_crm tbc on tbc.crm_no = tbsi.crm_no
|
|
|
- left join sys_custom sc on sc.id = tbsi.custom_id
|
|
|
- left join t_b_service tbs on tbs.id = tbsi.service_id
|
|
|
- left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbsi.sop_no
|
|
|
- left join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
|
|
|
+<!-- select-->
|
|
|
+<!-- tbsi.id,-->
|
|
|
+<!-- tbsi.sop_no as sopNo,-->
|
|
|
+<!-- tbsi.crm_no as crmNo,-->
|
|
|
+<!-- tbc.name as crmName,-->
|
|
|
+<!-- sc.name as customName,-->
|
|
|
+<!-- sc.type as customType,-->
|
|
|
+<!-- sc.id as customId,-->
|
|
|
+<!-- tbsi.service_id as serviceId,-->
|
|
|
+<!-- tbs.name as serviceName-->
|
|
|
+<!-- from-->
|
|
|
+<!-- t_b_sop_info tbsi-->
|
|
|
+<!-- left join t_b_crm tbc on tbc.crm_no = tbsi.crm_no-->
|
|
|
+<!-- left join sys_custom sc on sc.id = tbsi.custom_id-->
|
|
|
+<!-- left join t_b_service tbs on tbs.id = tbsi.service_id-->
|
|
|
+<!-- left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbsi.sop_no-->
|
|
|
+<!-- left join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- <if test="serviceId != null and serviceId != ''">-->
|
|
|
+<!-- and tbsi.service_id = #{serviceId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- and tbsi.status = 'DRAFT'-->
|
|
|
+<!-- and tffa.status not in('END')-->
|
|
|
+<!-- </where>-->
|
|
|
+ select t.* from(SELECT
|
|
|
+ tbsi.id,
|
|
|
+ tbsi.sop_no as sopNo,
|
|
|
+ tbsi.crm_no as crmNo,
|
|
|
+ tbc.name as crmName,
|
|
|
+ sc.name as customName,
|
|
|
+ sc.type as customType,
|
|
|
+ sc.id as customId,
|
|
|
+ tbsi.service_id as serviceId,
|
|
|
+ tbs.name as serviceName
|
|
|
+ FROM t_b_sop_info tbsi
|
|
|
+ left join t_b_crm tbc on tbc.crm_no = tbsi.crm_no
|
|
|
+ left join sys_custom sc on sc.id = tbsi.custom_id
|
|
|
+ left join t_b_service tbs on tbs.id = tbsi.service_id
|
|
|
+ left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbsi.sop_no
|
|
|
+ left join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
|
|
|
+ left join t_b_crm_detail tbcd on tbsi.sop_no = tbcd.sop_no
|
|
|
+ left join t_b_user_archives_allocation tbuaa on tbuaa.crm_detail_id = tbcd.id
|
|
|
<where>
|
|
|
<if test="serviceId != null and serviceId != ''">
|
|
|
- and tbsi.service_id = #{serviceId}
|
|
|
+ and tbuaa.service_id = #{serviceId}
|
|
|
</if>
|
|
|
- and tbsi.status = 'DRAFT'
|
|
|
- and tffa.status not in('END')
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and tbuaa.user_id = #{serviceId}
|
|
|
+ </if>
|
|
|
+ and tbuaa.sop_role_type = 'ENGINEER'
|
|
|
+ and tffa.status not in('END')
|
|
|
+ </where>
|
|
|
+ union
|
|
|
+ SELECT tbsi.id,
|
|
|
+ tbsi.sop_no as sopNo,
|
|
|
+ tbsi.crm_no as crmNo,
|
|
|
+ tbc.name as crmName,
|
|
|
+ sc.name as customName,
|
|
|
+ sc.type as customType,
|
|
|
+ sc.id as customId,
|
|
|
+ tbsi.service_id as serviceId,
|
|
|
+ tbs.name as serviceName
|
|
|
+ from t_b_sop_info tbsi
|
|
|
+ left join t_b_crm tbc on tbc.crm_no = tbsi.crm_no
|
|
|
+ left join sys_custom sc on sc.id = tbsi.custom_id
|
|
|
+ left join t_b_service tbs on tbs.id = tbsi.service_id
|
|
|
+ left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbsi.sop_no
|
|
|
+ left join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
|
|
|
+ left join t_b_crm_detail tbcd on tbsi.sop_no = tbcd.sop_no
|
|
|
+ left join t_b_user_archives_allocation_log tbuaal on tbuaal.crm_detail_id = tbcd.id
|
|
|
+ WHERE exists (
|
|
|
+ SELECT tbuaa.crm_detail_id FROM t_b_user_archives_allocation tbuaa
|
|
|
+ left join t_b_crm_detail tbcd on tbcd.id = tbuaa.crm_detail_id
|
|
|
+ left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbcd.sop_no
|
|
|
+ left join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
|
|
|
+ <where>
|
|
|
+ <if test="serviceId != null and serviceId != ''">
|
|
|
+ and tbuaa.service_id = #{serviceId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and tbuaa.user_id = #{serviceId}
|
|
|
+ </if>
|
|
|
+ and tbuaa.sop_role_type = 'ENGINEER'
|
|
|
+ and tffa.status not in('END')
|
|
|
+ and tbuaal.crm_detail_id = tbuaa.crm_detail_id
|
|
|
</where>
|
|
|
+ )) t order by t.sopNo
|
|
|
</select>
|
|
|
|
|
|
<select id="userList" resultType="com.qmth.sop.business.entity.SysUser">
|