|
@@ -2,11 +2,171 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.qmth.sop.business.mapper.TBDingApplyMapper">
|
|
|
|
|
|
- <select id="flowTaskUnDoneList" resultType="java.util.Map">
|
|
|
-
|
|
|
+ <select id="flowTaskUnDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyUnDoneResult">
|
|
|
+ select
|
|
|
+ cast(art.ASSIGNEE_ as Decimal(24)) as userId,
|
|
|
+ tfcf.type,
|
|
|
+ tfcfe.code,
|
|
|
+ tffa.status,
|
|
|
+ tffa.setup,
|
|
|
+ tfcf.version,
|
|
|
+ tfcfe.obj_id as objId,
|
|
|
+ tfcfe.crm_no as crmNo,
|
|
|
+ tbc.name as crmName,
|
|
|
+ tbs.id as serviceId,
|
|
|
+ tbs.name as serviceName,
|
|
|
+ tbs.type as serviceType,
|
|
|
+ sc.id as customId,
|
|
|
+ sc.type as customType,
|
|
|
+ sc.name as customName,
|
|
|
+ tfcfe.create_id as createId,
|
|
|
+ su.real_name as createRealName,
|
|
|
+ art.PROC_INST_ID_ as flowId,
|
|
|
+ art.NAME_ as taskName,
|
|
|
+ art.TASK_DEF_KEY_ as taskDefKey,
|
|
|
+ art.ID_ as taskId,
|
|
|
+ tfcfe.flow_process_var as flowProcessVar,
|
|
|
+ tfcfe.t_f_custom_flow_id as customFlowId,
|
|
|
+ tfcf.flow_deployment_id as flowDeploymentId,
|
|
|
+ tfcfe.id as customFlowEntityid,
|
|
|
+ tbda.`type` as dingExceptionType,
|
|
|
+ IF(tbda.`type` = 'IN',tbd.sign_in_time,tbd.sign_out_time) as exceptionTime,
|
|
|
+ tbda.apply_time as applyTime,
|
|
|
+ tbda.reason,
|
|
|
+ (select group_concat(ba.`path` SEPARATOR ';') from basic_attachment ba where find_in_set(ba.id, tbda.attachment_ids)) as attachmentPaths,
|
|
|
+ tbda.create_time as createTime,
|
|
|
+ su1.real_name as approveUserName
|
|
|
+ from ACT_RU_TASK art
|
|
|
+ left join t_f_flow_approve tffa on art.PROC_INST_ID_ = tffa.flow_id
|
|
|
+ left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
|
|
|
+ left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
|
|
|
+ left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
|
|
|
+ left join t_b_service tbs on tbs.id = tbc.service_id
|
|
|
+ left join sys_custom sc on sc.id = tbc.custom_id
|
|
|
+ left join t_b_ding_apply tbda on tbda.ding_exception_no = tfcfe.code
|
|
|
+ left join t_b_ding tbd on tbd.id = tbda.ding_id
|
|
|
+ left join sys_user su ON tbda.create_id = su.id
|
|
|
+ left join t_b_user_archives tbua on tbua.mobile_number = su.mobile_number
|
|
|
+ left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
|
|
|
+ left join sys_supplier ss on ss.id = tbuas.supplier_id
|
|
|
+ left join sys_user su1 ON cast(art.ASSIGNEE_ as Decimal(24)) = su1.id
|
|
|
+ left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
|
|
|
+ <where>
|
|
|
+ EXISTS(
|
|
|
+ select * from(select cast(art.PROC_INST_ID_ as Decimal(24)) as flowId
|
|
|
+ from
|
|
|
+ ACT_RU_TASK art
|
|
|
+ where 1 = 1
|
|
|
+ <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
|
|
|
+ and art.ASSIGNEE_ IN
|
|
|
+ <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ UNION all
|
|
|
+ select
|
|
|
+ art.PROC_INST_ID_ as flowId
|
|
|
+ from
|
|
|
+ ACT_RU_TASK art
|
|
|
+ left join act_ru_identitylink ari on
|
|
|
+ ari.TASK_ID_ = art.ID_
|
|
|
+ where
|
|
|
+ art.ASSIGNEE_ is null
|
|
|
+ <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
|
|
|
+ and ari.USER_ID_ IN
|
|
|
+ <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ and ari.TYPE_ = 'candidate') t where t.flowId = art.PROC_INST_ID_)
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="flowTaskDoneList" resultType="java.util.Map">
|
|
|
-
|
|
|
+ <select id="flowTaskDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyDoneResult">
|
|
|
+ select
|
|
|
+ tfcf.type,
|
|
|
+ tfcfe.code,
|
|
|
+ tffa.status,
|
|
|
+ tffa.setup,
|
|
|
+ tfcf.version,
|
|
|
+ tfcfe.obj_id as objId,
|
|
|
+ tfcfe.crm_no as crmNo,
|
|
|
+ tbc.name as crmName,
|
|
|
+ tbs.id as serviceId,
|
|
|
+ tbs.name as serviceName,
|
|
|
+ tbs.type as serviceType,
|
|
|
+ sc.id as customId,
|
|
|
+ sc.type as customType,
|
|
|
+ sc.name as customName,
|
|
|
+ tfcfe.create_id as createId,
|
|
|
+ su.real_name as createRealName,
|
|
|
+ tfcfe.flow_process_var as flowProcessVar,
|
|
|
+ tfcfe.t_f_custom_flow_id as customFlowId,
|
|
|
+ tfcf.flow_deployment_id as flowDeploymentId,
|
|
|
+ tfcfe.id as customFlowEntityid,
|
|
|
+ tbda.`type` as dingExceptionType,
|
|
|
+ IF(tbda.`type` = 'IN',tbd.sign_in_time,tbd.sign_out_time) as exceptionTime,
|
|
|
+ tbda.apply_time as applyTime,
|
|
|
+ tbda.reason,
|
|
|
+ (select group_concat(ba.`path` SEPARATOR ';') from basic_attachment ba where find_in_set(ba.id, tbda.attachment_ids)) as attachmentPaths,
|
|
|
+ tbda.create_time as createTime,
|
|
|
+ (select tffl.approve_operation from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id order by tffl.create_time desc limit 1) as approveOperation,
|
|
|
+ (select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
|
|
|
+ where find_in_set(us1.id, (select group_concat(tffl.approve_id) from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id))) as approveUsersName
|
|
|
+ from t_b_ding_apply tbda
|
|
|
+ left join t_f_custom_flow_entity tfcfe on tbda.ding_exception_no = tfcfe.code
|
|
|
+ left join t_f_flow_approve tffa on tfcfe.flow_id = tffa.flow_id
|
|
|
+ left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
|
|
|
+ left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
|
|
|
+ left join t_b_service tbs on tbs.id = tbc.service_id
|
|
|
+ left join sys_custom sc on sc.id = tbc.custom_id
|
|
|
+ left join t_b_ding tbd on tbd.id = tbda.ding_id
|
|
|
+ left join sys_user su ON tbda.create_id = su.id
|
|
|
+ left join t_b_user_archives tbua on tbua.mobile_number = su.mobile_number
|
|
|
+ left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
|
|
|
+ left join sys_supplier ss on ss.id = tbuas.supplier_id
|
|
|
+ where
|
|
|
+ (tffa.status = 'AUDITING' or tffa.status = 'REJECT' or tffa.status = 'FINISH')
|
|
|
+ and EXISTS (
|
|
|
+ select * from(select
|
|
|
+ distinct aht.PROC_INST_ID_
|
|
|
+ from
|
|
|
+ ACT_HI_TASKINST aht
|
|
|
+ where 1 = 1
|
|
|
+ <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
|
|
|
+ and aht.ASSIGNEE_ IN
|
|
|
+ <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ and aht.END_TIME_ is not null
|
|
|
+ union all
|
|
|
+ select
|
|
|
+ t.PROC_INST_ID_
|
|
|
+ from
|
|
|
+ (
|
|
|
+ select
|
|
|
+ ahi.*
|
|
|
+ from
|
|
|
+ ACT_HI_IDENTITYLINK ahi
|
|
|
+ where
|
|
|
+ ahi.TYPE_ = 'candidate'
|
|
|
+ and exists(
|
|
|
+ select
|
|
|
+ distinct aht.id_
|
|
|
+ from
|
|
|
+ ACT_HI_TASKINST aht
|
|
|
+ where
|
|
|
+ aht.ASSIGNEE_ is null
|
|
|
+ and aht.END_TIME_ is not null
|
|
|
+ and ahi.TASK_ID_ = aht.id_)
|
|
|
+ <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
|
|
|
+ and ahi.USER_ID_ IN
|
|
|
+ <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>) temp
|
|
|
+ join ACT_HI_TASKINST t on
|
|
|
+ t.ID_ = temp.TASK_ID_) temp where temp.PROC_INST_ID_ = tfcfe.flow_id)
|
|
|
</select>
|
|
|
</mapper>
|