2025-01-16 16:16:53 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.bonus.flowable.mapper.BusinessMapper" >
<update id= "updateContractStatus" >
UPDATE nxdt_ii.lk_cont_person
SET status ='1',
user_id =#{userId},
task_id = #{taskId}
WHERE id = #{id}
</update>
<select id= "selectSupUuidByProId" resultType= "java.util.Map" >
SELECT lps.sup_uuid AS supUuid
FROM nxdt_ii.lk_pro_sup lps
LEFT JOIN nxdt_ii.sys_user su
ON su.parent_uuid = lps.sup_uuid AND su.del_flag = '0' AND su.user_type = '01'
WHERE lps.pro_id = #{proId}
</select>
<select id= "selectUuidById" resultType= "java.util.Map" >
SELECT id AS id,
pro_id AS proId,
cont_uuid AS contUuid,
sub_uuid AS subUuid
FROM nxdt_ii.lk_cont_person
WHERE id = #{id}
</select>
<select id= "getContMessageByUser" resultType= "java.util.Map" >
select DISTINCT lpc.id,lpc.uuid,lpc.pro_id as proId,lpc.sup_uuid as supUuid,lpc.cont_uuid as contUuid,
ssu1.user_id as contUserId,ssu2.user_id as supUserId
from nxdt_ii.lk_pro_cont lpc
LEFT JOIN (
select * from nxdt_ii.sys_user where user_type ='02'
) ssu1 on ssu1.parent_uuid =lpc.cont_uuid
LEFT JOIN
(
select * from nxdt_ii.sys_user where user_type ='01'
)ssu2 on ssu2.parent_uuid =lpc.sup_uuid
where lpc.pro_id = #{proId}
<if test= "uuid != null" >
and lpc.cont_uuid = #{uuid}
</if>
</select>
<select id= "getSubMessageByUser" resultType= "java.util.Map" >
select DISTINCT lpc.id,lpc.uuid,lpc.pro_id as proId,lpc.sup_uuid as supUuid,lpc.cont_uuid as contUuid,
lpc.sub_uuid as subUuid,
ssu1.user_id as contUserId,ssu2.user_id as supUserId,ssu3.user_id as subUserId
from nxdt_ii.lk_cont_sub lpc
LEFT JOIN (
select * from nxdt_ii.sys_user where user_type ='02'
) ssu1 on ssu1.parent_uuid =lpc.cont_uuid
LEFT JOIN
(
select * from nxdt_ii.sys_user where user_type ='01'
)ssu2 on ssu2.parent_uuid =lpc.sup_uuid
LEFT JOIN
(
select * from nxdt_ii.sys_user where user_type ='03'
)ssu3 on ssu3.parent_uuid =lpc.sub_uuid
where lpc.pro_id = #{proId}
<if test= "uuid != null and uuid != ''" >
and lpc.sub_uuid = #{uuid}
</if>
</select>
<select id= "getSpecialDefinitionKeyByProAndBusinessType" resultType= "java.lang.String" >
SELECT pfp.definition_key
from (select *
from nxdt_ii.lk_pro_examine_configuration
where pro_id = #{proId}
and business_type = #{businessType}) lec
LEFT JOIN nxdt_ii.pt_flow_process pfp
on lec.examine_id = pfp.definition_key
</select>
<select id= "getOrdinaryDefinitionKeyByProAndBusinessType" resultType= "java.lang.String" >
SELECT definition_key
from nxdt_ii.pt_flow_process
WHERE business_type = #{businessType}
</select>
<insert id= "addAuditTask" parameterType= "com.bonus.flowable.entity.CheckTaskVo" >
insert into nxdt_ii.pt_check_task(task_id, proc_ins_id, task_type, process_state, is_pass, create_id,
create_user,
version, level, pro_id, parent_uuid,examine_id)
values (#{taskId}, #{processInstanceId}, #{taskType}, #{processState}, #{isPass}, #{createId}, #{createUser},
#{version}, #{level}, #{proId}, #{parentUuid},#{examineId})
</insert>
<insert id= "addTaskDetails" parameterType= "com.bonus.flowable.entity.TaskDetails" >
insert into nxdt_ii.pt_check_task_details
(task_id, proc_inst_id, version,repeated_submit,sort)
values (#{taskId}, #{processInstanceId}, #{version},#{repeatedSubmit},#{sort})
</insert>
<select id= "getAuditTaskCount" resultType= "int" >
select count(1)
from nxdt_ii.pt_check_task
where pro_id = #{proId}
and task_id = #{taskId}
</select>
<update id= "upDateAuditTask" >
update nxdt_ii.pt_check_task
set proc_ins_id = #{processInstanceId},
repeated_submit = repeated_submit +1,
version = #{version}
where task_id = #{taskId}
</update>
<select id= "getRepeatedSubmit" parameterType= "string" resultType= "int" >
select repeated_submit from nxdt_ii.pt_check_task where task_id = #{taskId}
</select>
<update id= "updatePersonStatus" parameterType= "string" >
update nxdt_ii.lk_cont_person
set into_status =#{enterStatus},
task_id = #{taskId},
proc_inst_id = #{processInstanceId}
where uuid = #{personId}
</update>
<select id= "getProcessInstanceIdByTaskId" resultType= "java.lang.String" >
select proc_inst_id
from nxdt_ii.pt_check_task_details
where task_id = #{taskId}
order by id desc
limit 1
</select>
<select id= "getCongifDetailsByTypeAndSort" parameterType= "string"
resultType="com.bonus.flowable.entity.ConfigurationVo">
select check_person as checkPerson ,examine_type as examineType,final_judgment as finalJudgment,sort,examine_id
as examineId,version
from nxdt_ii.pt_check_configuration_details where examine_id = (
select examine_id as id from nxdt_ii.pt_flow_process where business_type = #{businessType} and
pt_flow_process.is_active = '1' and examine_type = #{examineType} order by examine_id desc limit 1
)
<if test= "version == null" >
and version = (
select version as id from nxdt_ii.pt_flow_process where business_type = #{businessType} and
pt_flow_process.is_active = '1'
and examine_type = #{examineType}
order by examine_id desc limit 1
)
</if>
<if test= "version != null" >
and version = #{version}
</if>
<if test= "sort != 0 " >
and sort = #{sort}
</if>
</select>
<select id= "getCongifDetailsListByTypeAndSort" parameterType= "string"
resultType="com.bonus.flowable.entity.ConfigurationVo">
select check_person as checkPerson ,examine_type as examineType,final_judgment as finalJudgment,sort,examine_id
as examineId,version
from nxdt_ii.pt_check_configuration_details where examine_id = (
select examine_id as id from nxdt_ii.pt_flow_process where business_type = #{businessType} and
pt_flow_process.is_active = '1' and examine_type = #{examineType} and examine_id = #{examineId}
)
and version = (
select version as id from nxdt_ii.pt_flow_process where business_type = #{businessType}
and pt_flow_process.is_active = '1' and examine_type = #{examineType}
and examine_id = #{examineId}
)
</select>
<delete id= "delectCheckPerson" >
delete from nxdt_ii.pt_check_person where task_id = #{taskId}
</delete>
<insert id= "insertCheckPerson" parameterType= "java.util.List" >
insert into nxdt_ii.pt_check_person(task_id, user_id,exam_type,type,sort,version)
values
<foreach item= "item" index= "index" collection= "list" separator= "," >
(#{item.taskId},#{item.checkPerson},#{item.examineType},#{item.isActive},#{item.sort},#{item.version})
</foreach>
</insert>
<update id= "updatePersonIntoStatusByUuid" parameterType= "string" >
update nxdt_ii.lk_cont_person
set into_status =#{statusType},
admission_date = DATE(NOW())
where uuid = #{uuid}
</update>
<update id= "updateConsStatus" parameterType= "string" >
update nxdt_ii.lk_pro_cont
set into_status = #{enterStatus},
task_id = #{taskId},
proc_inst_id = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updateConsIntoStatusByUuid" >
update nxdt_ii.lk_pro_cont
set into_status =#{statusType}
where uuid = #{uuid}
</update>
<update id= "updateSupervisorStatus" >
update nxdt_ii.lk_pro_sup
set status = #{enterStatus},
task_id = #{taskId},
proc_inst_id = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updateSupervisorIntoStatusByUuid" >
update nxdt_ii.lk_pro_sup
set status =#{statusType}
where uuid = #{uuid}
</update>
<update id= "updateSubStatus" >
update nxdt_ii.lk_cont_sub
set into_status = #{enterStatus},
task_id = #{taskId},
proc_inst_id = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updateSubIntoStatusByUuid" >
update nxdt_ii.lk_cont_sub
set into_status =#{statusType}
where uuid = #{uuid}
</update>
<update id= "updateStartWorkStatus" >
update nxdt_ii.lk_pro_cont
set start_status = #{enterStatus},
task_id_start = #{taskId},
proc_inst_id_start = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updateStartWorkIntoStatusByUuid" >
update nxdt_ii.lk_pro_cont
set start_status =#{statusType}
where uuid = #{uuid}
</update>
<update id= "updateUserIntoStatusByUuid" >
update nxdt_ii.lk_cont_person set into_status =#{statusType},
admission_date = DATE(NOW())
where pro_id = #{proId} and cont_uuid = #{consUuid}
<if test= "subUuid != null and subUuid != ''" >
and sub_uuid = #{subUuid}
</if>
</update>
<update id= "updateSubOutStatus" >
update nxdt_ii.lk_cont_sub
set out_status = #{enterStatus},
task_id_out = #{taskId},
proc_inst_id_out = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updateSubOutStatusByUuid" >
update nxdt_ii.lk_cont_sub
set out_status =#{statusType}
where uuid = #{uuid}
</update>
<update id= "updateToolsIntoStatusByUuid" >
update nxdt_ii.pt_pro_tools
set status =#{statusType}
where uuid = #{uuid}
</update>
<update id= "updateToolsStatus" >
update nxdt_ii.pt_pro_tools
set status = #{enterStatus},
task_id = #{taskId},
proc_inst_id = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updatePersonOutStatusByUuid" >
update nxdt_ii.lk_cont_person
set out_status =#{statusType},
departure_date = DATE(NOW())
where uuid = #{uuid}
</update>
<update id= "updatePersonOutStatus" >
update nxdt_ii.lk_cont_person
set out_status = #{enterStatus},
task_id_out = #{taskId},
proc_inst_id_out = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updateConsFinishStatus" >
update nxdt_ii.lk_pro_cont
set out_status = #{enterStatus},
task_id_out = #{taskId},
proc_inst_id_out = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updateConsFinishIntoStatusByUuid" >
update nxdt_ii.lk_pro_cont
set out_status =#{statusType}
where uuid = #{uuid}
</update>
<update id= "updateConsMaterialStatusByUuid" >
update nxdt_ii.lk_cont_file
set status =#{statusType}
where uuid = #{uuid}
</update>
<update id= "updateConsMaterialStatus" >
update nxdt_ii.lk_cont_file
set status = #{enterStatus},
task_id = #{taskId},
proc_inst_id = #{processInstanceId}
where uuid = #{uuid}
</update>
<update id= "updateSupervisorPersonStatus" >
update nxdt_ii.lk_sup_person
set status = #{statusType},
admission_date = DATE(NOW())
where sup_uuid = (select sup_uuid from nxdt_ii.lk_pro_sup where uuid = #{uuid})
</update>
<update id= "updateSupervisorSysUserStatus" >
update nxdt_ii.sys_user
set status = '0'
where parent_uuid = (select sup_uuid from nxdt_ii.lk_pro_sup where uuid = #{uuid})
</update>
<update id= "updateConsSysUserStatus" >
update nxdt_ii.sys_user
set status = '0'
where parent_uuid = (select cont_uuid from nxdt_ii.lk_pro_cont where uuid = #{uuid})
</update>
<update id= "updateSubSysUserStatus" >
update nxdt_ii.sys_user
set status = '0'
where parent_uuid = (select sub_uuid from nxdt_ii.lk_cont_sub where uuid = #{uuid})
</update>
<update id= "updateConsToolsStatus" >
update nxdt_ii.pt_pro_tools
set status = '3',
admission_date = DATE(NOW())
where pro_id = #{proId}
</update>
<update id= "updateSubPersonStatus" >
update nxdt_ii.lk_cont_person
set out_status = '3',
departure_date = DATE(NOW()),
exit_reason = '分包商统一出场'
where sub_uuid = #{subUuid} and pro_id = #{proId} and cont_uuid = #{consUuid} and out_status != '3'
</update>
<update id= "updateConsPersonStatus" >
update nxdt_ii.lk_cont_person
set out_status = '3',
departure_date = DATE(NOW()),
exit_reason = '承包包商统一出场'
where pro_id = #{proId} and cont_uuid = #{consUuid} and out_status != '3'
</update>
<update id= "updateSubOutStatusByCons" >
update nxdt_ii.lk_cont_sub
set out_status = '3',
departure_date = DATE(NOW()),
exit_reason = '承包商统一出场'
where pro_id = #{proId} and cont_uuid = #{consUuid} and out_status != '3'
</update>
<update id= "updateProStatus" >
update nxdt_ii.pt_project_info
set pro_status = '4'
where pro_id = #{proId}
</update>
<update id= "updateProUnderConstructionStatus" >
update nxdt_ii.pt_project_info
set pro_status = '3'
where pro_id = #{proId}
</update>
<select id= "getProcessInstanceIdListByTaskId" resultType= "java.lang.String" >
<if test= "checkType =='1' or checkType == 1" >
select proc_inst_id
from nxdt_ii.pt_check_task_details
where task_id = #{taskId}
and repeated_submit =(
select max(repeated_submit) from nxdt_ii.pt_check_task_details where task_id = #{taskId}
)
</if>
<if test= "checkType =='2' or checkType == 2" >
select proc_inst_id
from nxdt_ii.pt_check_task_details
where task_id = #{taskId}
</if>
</select>
<insert id= "addComment" parameterType= "string" >
insert into nxdt_ii.pt_check_comment(task_id, proc_inst_id, user_id, comment, agree, reject)
values (#{taskId}, #{processInstanceId}, #{userId}, #{comment}, #{agree}, #{rejectReason})
</insert>
<select id= "getCommentListByProcessInstanceId" resultType= "com.bonus.flowable.entity.CheckComment" >
select a.*, b.name, c.dept_name as section
from (select pcc.user_id as userId,
pcc.comment as reason,
IFNULL(pcc.reject,'') as turnDownReason,
2025-02-13 16:36:47 +08:00
case when pcc.agree = '1' then '审核通过'
when pcc.agree = '2' then '审核驳回'
when pcc.agree = '3' then '终审通过'
when pcc.agree = '4' then '已撤回'
else '' end as status
2025-01-16 16:16:53 +08:00
from nxdt_ii.pt_check_comment pcc
where proc_inst_id = #{processInstanceId}) a
left join (select user_name as userName, nick_name as name, user_id as userId, dept_id as deptId
from nxdt_ii.sys_user
where user_type = '00'
or user_type = '01'
or user_type = '02'
or user_type = '03') b
on a.userId = b.userId
left join nxdt_ii.sys_dept c
on b.deptId = c.dept_id
</select>
<select id= "getExamineIdByProAndCheckType" resultType= "java.lang.String" >
select lk.examine_id
from nxdt_ii.lk_pro_examine_configuration lk
LEFT JOIN nxdt_ii.pt_flow_process pt on pt.examine_id = lk.examine_id
WHERE lk.pro_id = #{proId}
and lk.business_type = #{checkType} and pt.`status` ='0'
</select>
<select id= "getCongifDetailsByExamineIdAndSort" resultType= "com.bonus.flowable.entity.ConfigurationVo" >
select check_person as checkPerson,
examine_type as examineType,
final_judgment as finalJudgment,
sort,
examine_id as examineId,
version
from nxdt_ii.pt_check_configuration_details
where examine_id =
(select examine_id as id from nxdt_ii.lk_pro_examine_configuration where examine_id = #{examineId})
<if test= "version == null" >
and version =(select version as id from nxdt_ii.pt_flow_process where business_type = #{businessType} and pt_flow_process.is_active = '1' and examine_type = #{examineType} and pt_flow_process.examine_id = #{examineId})
</if>
<if test= "version != null" >
and version = #{version}
</if>
and sort = #{sort}
</select>
<select id= "getContUserIdsByUuid" resultType= "com.bonus.common.core.domain.BaseBean" >
<if test= "type == '分包商'" >
select pro_id as proId,cont_uuid as consUuid,sub_uuid as subUuid from nxdt_ii.lk_cont_sub where uuid =
#{uuid}
</if>
<if test= "type == '承包商'" >
select pro_id as proId,cont_uuid as consUuid,'' as subUuid from nxdt_ii.lk_pro_cont where uuid =
#{uuid}
</if>
</select>
<select id= "getMaterialUuid" resultType= "com.bonus.common.core.domain.BaseBean" >
select uuid from nxdt_ii.lk_cont_file where pro_id = #{proId} and cont_uuid = #{contUuid} and task_id is null
</select>
<select id= "getConsFinishCount" resultType= "java.lang.Integer" >
select count(1)
from nxdt_ii.lk_pro_cont
where pro_id = #{proId}
and out_status != '3'
</select>
<select id= "getInitialHistory" parameterType= "string" resultType= "com.bonus.flowable.entity.CheckComment" >
select c.userId,c.reason,c.turnDownReason,c.time,c.name ,c.section from (
select a.* ,b.*,c.dept_name as section from (
select user_id as userId,`comment` as reason,reject as turnDownReason ,create_time as time
from nxdt_ii.pt_check_comment
where proc_inst_id =(
select proc_inst_id from nxdt_ii.pt_check_task_details
where task_id = #{taskId} and version = (
select version from nxdt_ii.pt_check_task where task_id =#{taskId}
)
and repeated_submit = (
select max(repeated_submit) from nxdt_ii.pt_check_task_details where task_id =#{taskId}
)
ORDER BY id limit 1
)
)a
LEFT JOIN (
select user_name as userName, nick_name as name, user_id as userIds, dept_id as deptId
from nxdt_ii.sys_user
where user_type = '01'
or user_type = '02'
)b on a.userId = b.userIds
left join nxdt_ii.sys_dept c
on b.deptId = c.dept_id
) c
where c.userIds is not null
</select>
<select id= "getThisHistory" parameterType= "string" resultType= "com.bonus.flowable.entity.CheckComment" >
SELECT
c.ii as id,
c.id AS userId,
2025-02-13 16:38:54 +08:00
d.agree,
2025-01-16 16:16:53 +08:00
IFNULL( d.`comment`, '' ) AS reason,
IFNULL( d.reject, '' ) AS turnDownReason,
IFNULL( d.time, '' ) AS time,
IFNULL( c.examType, '' ) AS examType,
IFNULL( e.`name`, '' ) AS `name`,
2025-02-13 16:36:47 +08:00
case when d.agree = '1' then '审核通过'
when d.agree = '2' then '审核驳回'
when d.agree = '3' then '终审通过'
when d.agree = '4' then '已撤回'
else '' end as status,
2025-01-16 16:16:53 +08:00
IFNULL( f.dept_name, '' ) AS section,
IFNULL( c.sort, '' ) AS sort,
#{taskId} as taskId
FROM
(
select id as ii,user_id as id,exam_type as examType,sort from nxdt_ii.pt_check_person where task_id = #{taskId} and type = '1'
) c
LEFT JOIN (
SELECT
id,
a.proc_inst_id,
version,
repeated_submit,
sort,
user_id,
`comment`,
reject,
2025-02-13 16:36:47 +08:00
b.agree,
2025-01-16 16:16:53 +08:00
create_time AS time
FROM
(
SELECT
proc_inst_id,
version,
repeated_submit,
sort
FROM
nxdt_ii.pt_check_task_details
WHERE
task_id = #{taskId} and version = (select max(version) from nxdt_ii.pt_check_task_details where task_id = #{taskId})
<!-- AND repeated_submit =( -->
<!-- SELECT -->
<!-- max( repeated_submit ) -->
<!-- FROM -->
<!-- nxdt_ii.pt_check_task_details -->
<!-- WHERE -->
<!-- task_id = #{taskId} -->
<!-- ) -->
) a
LEFT JOIN nxdt_ii.pt_check_comment b ON a.proc_inst_id = b.proc_inst_id and b.agree != '2'
) d ON c.id = d.user_id
AND d.id
IS NOT NULL LEFT JOIN ( SELECT user_name AS userName, nick_name AS NAME, user_id AS userId, dept_id AS deptId FROM nxdt_ii.sys_user WHERE user_type = '00' or user_type='01' or user_type='02') e ON c.id = e.userId
LEFT JOIN nxdt_ii.sys_dept f ON e.deptId = f.dept_id
ORDER BY c.ii
<!-- SELECT g.user_id as userId,h.* from ( -->
<!-- SELECT user_id from nxdt_ii.pt_check_person where task_id = #{taskId} -->
<!-- ) g LEFT JOIN ( -->
<!-- select -->
<!-- a.id as ii, -->
<!-- a.user_id AS userId, -->
<!-- IFNULL( b.`comment`, '' ) AS reason, -->
<!-- IFNULL( b.reject, '' ) AS turnDownReason, -->
<!-- IFNULL( b.create_time, '' ) AS time, -->
<!-- IFNULL( e.`name`, '' ) AS `name`, -->
<!-- ELECT max(id) as id,user_id FROM nxdt_ii.pt_check_comment where task_id = #{taskId} -->
<!-- GROUP BY user_id -->
<!-- )a LEFT JOIN ( -->
<!-- SELECT * from nxdt_ii.pt_check_comment where task_id = #{taskId} -->
<!-- )b on a.id = b.id -->
<!-- LEFT JOIN ( SELECT user_name AS userName, nick_name AS NAME, user_id AS userId, dept_id AS deptId FROM nxdt_ii.sys_user WHERE user_type = '00' or user_type='01' or user_type='02') e ON a.id = e.userId -->
<!-- LEFT JOIN nxdt_ii.sys_dept f ON e.deptId = f.dept_id -->
<!-- ) h on g.user_id = h.userId -->
<!-- IFNULL( f.dept_name, '' ) AS section -->
<!-- from ( -->
<!-- SELECT max(id) as id,user_id FROM nxdt_ii.pt_check_comment where task_id = #{taskId} -->
<!-- GROUP BY user_id -->
<!-- )a LEFT JOIN ( -->
<!-- SELECT * from nxdt_ii.pt_check_comment where task_id = #{taskId} -->
<!-- )b on a.id = b.id -->
<!-- LEFT JOIN ( SELECT user_name AS userName, nick_name AS NAME, user_id AS userId, dept_id AS deptId FROM nxdt_ii.sys_user WHERE user_type = '00' or user_type='01' or user_type='02') e ON a.id = e.userId -->
<!-- LEFT JOIN nxdt_ii.sys_dept f ON e.deptId = f.dept_id -->
<!-- ) h on g.user_id = h.userId -->
</select>
<select id= "getRestartChechMessage" resultType= "com.bonus.flowable.entity.ConfigurationVo" >
select a.*,b.version,b.repeated_submit as repeatedSubmit,b.sort,#{taskType} as taskType,c.check_person as checkPerson from (
select id,task_id as taskId,user_id as userId,proc_inst_id as processInstanceId from nxdt_ii.pt_check_comment
where task_id = #{taskId}
and agree ='2' ORDER BY id DESC limit 1
)a LEFT JOIN nxdt_ii.pt_check_task_details b
on (a.processInstanceId = b.proc_inst_id and a.taskId = b.task_id)
LEFT JOIN (
select pf.examine_id,pc.check_person ,pc.version,pc.sort from nxdt_ii.pt_flow_process pf
LEFT JOIN nxdt_ii.pt_check_configuration_details pc on pc.examine_id = pf.examine_id
WHERE pf.business_type = #{taskType}
)c on (c.version = b.version and c.sort = b.sort)
WHERE a.id is not null and examine_id = (select examine_id from nxdt_ii.pt_check_task WHERE task_id = #{taskId})
</select>
<select id= "getLastCheckId" resultType= "int" parameterType= "string" >
select max(id) as id from nxdt_ii.pt_check_comment where task_id = #{taskId}
</select>
<select id= "getAlreadyCheckPerson" parameterType= "string" resultType= "string" >
select user_id from nxdt_ii.pt_check_comment where proc_inst_id = (
select proc_inst_id from nxdt_ii.pt_check_task_details where task_id =#{taskId}
and version =#{version} and repeated_submit = #{repeatedSubmit} and sort = #{sort}
) and agree ='1'
</select>
<update id= "updateTaskIsPassStatus" parameterType= "string" >
update nxdt_ii.pt_check_task set is_pass = #{isPass} where task_id = #{taskId}
</update>
<update id= "updateViolationPunishStatus" >
update nxdt_ii.wz_violation_info
set punish_status = '1',
check_status = #{enterStatus},
task_id = #{taskId},
proc_inst_id = #{processInstanceId},
reject_reason = ''
where violation_id = #{uuid}
</update>
<update id= "updateViolationPunishByUuid" >
update nxdt_ii.wz_violation_info
set
check_status = #{statusType},
reject_reason = #{rejectReason}
where violation_id = #{uuid}
</update>
<update id= "updateHiddenDangerAcceptanceStatus" >
update nxdt_ii.yh_pitfall_info
set
check_state = #{enterStatus},
task_id = #{taskId},
proc_inst_id = #{processInstanceId},
reject_reason = ''
where pitfall_id = #{uuid}
</update>
<update id= "updateHiddenDangerAcceptanceByUuid" >
update nxdt_ii.yh_pitfall_info
set
check_state = #{statusType},
reject_reason = #{rejectReason}
<if test= "statusType == '4' or statusType == 4" >
,is_check = '0'
</if>
where pitfall_id = #{uuid}
</update>
<update id= "updateExtensionApplicationStatus" >
update nxdt_ii.yh_pitfall_info
set
delay_check_state = #{enterStatus},
delay_task_id = #{taskId},
delay_proc_inst_id = #{processInstanceId},
delay_reject_reason = ''
where pitfall_id = #{uuid}
</update>
<update id= "updateExtensionApplicationByUuid" >
UPDATE nxdt_ii.yh_pitfall_info
SET
delay_check_state = #{statusType},
is_delay = CASE WHEN #{statusType} != 3 THEN '0' ELSE is_delay END,
delay_reject_reason = CASE WHEN #{statusType} != 3 THEN #{rejectReason} ELSE delay_reject_reason END,
delay_time = CASE WHEN #{statusType} != 3 THEN NULL ELSE delay_time END
WHERE pitfall_id = #{uuid};
</update>
<update id= "updateHiddenDangerStatus" >
UPDATE nxdt_ii.yh_pitfall_info
SET check_status = #{checkStatus},
is_delay = '0'
WHERE pitfall_id = #{id}
</update>
<update id= "updateOneConsSysUserStatus" >
update nxdt_ii.sys_user
set status = '0'
where phonenumber = (SELECT pcp.phone
FROM nxdt_ii.lk_cont_person lcp
LEFT JOIN nxdt_ii.pt_cons_person pcp
ON lcp.cons_persion_id = pcp.cons_user_id
WHERE lcp.uuid = #{uuid})
</update>
<select id= "approvalHistoryUser" resultType= "com.bonus.flowable.entity.ConfigurationVo" >
select id ,task_id as taskId,user_id as userId,exam_type as examineType
from nxdt_ii.pt_check_person
where type= '2' and task_id = #{taskId}
</select>
<select id= "getNickNameById" parameterType= "java.util.List" resultType= "string" >
select nick_name from nxdt_ii.sys_user
where user_id in
<foreach item= "item" collection= "userId" open= "(" separator= "," close= ")" >
#{item}
</foreach>
ORDER BY FIELD(user_id,
<foreach item= "item" collection= "userId" separator= "," open= "" close= "" >
#{item}
</foreach>
)
</select>
<select id= "getThisCheckUser" resultType= "string" >
select ASSIGNEE_ as userId from act_ru_task where PROC_INST_ID_ =(
select proc_ins_id from nxdt_ii.pt_check_task where task_id = #{taskId}
) LIMIT 1
</select>
<select id= "getHiddenDangerRectificationForm" resultType= "com.bonus.common.safetycheck.NewHiddenDangerDto" >
SELECT ypi.pitfall_id AS id,
ypi.pitfall_code AS pitfallCode,
ypi.record_id AS recordCode,
ypi.check_level_id AS checkLevel,
ypi.check_level_name AS checkLevelName,
ypi.check_type AS checkType,
ypi.check_type_name AS checkTypeName,
ypi.create_user_id AS createUserId,
ypi.create_user_name AS createUserName,
ypi.create_time AS createTime,
ypi.accept_time AS rectificationReceiveTime,
ypi.feedback_time AS rectificationFeedbackTime,
ypi.finsh_time AS finshTime,
sdd2.dict_label AS checkStatus,
ypi.is_check AS isCheck,
ypi.is_delay AS isDelay,
ypi.is_process AS isProcess,
ypi.delay_check_state AS delayCheckState,
ypi.is_from AS isFrom,
ypi.delay_time AS delayTime,
ypd.check_user_id AS checkUserId,
ypd.check_user_name AS checkUserName,
ypd.find_time AS findTime,
ypd.pro_id AS proId,
ypd.pro_name AS proName,
ypd.sub_id AS subId,
ypd.sub_name AS subName,
ypd.pitfall_type_id AS pitfallTypeId,
ypd.pitfall_type_name AS pitfallTypeName,
ypd.pitfall_level_id AS pitfallLevelId,
ypd.pitfall_level_name AS pitfallLevelName,
ypd.correction_time AS correctionTime,
ypd.sub_person_id AS subPersonId,
ypd.sub_person_name AS subPersonName,
ypd.pitfall_description AS pitfallDescription,
ypd.suggestion AS suggestion,
ypd.dept_id AS deptId,
ypd.dept_name AS deptName,
ypd.user_id AS userId,
ypd.user_name AS userName,
ypd.opinion AS opinion,
ypd.remarks AS remarks,
ypd.duty_user_id AS dutyUserId,
ypd.duty_user_name AS dutyUserName,
ypd.generate_reason AS generateReason,
ypd.correction_status AS correctionStatus,
ypd.delay_reason AS delayReason
FROM nxdt_ii.yh_pitfall_info ypi
LEFT JOIN nxdt_ii.yh_pitfall_detaills ypd on ypi.pitfall_id = ypd.pitfall_id
LEFT JOIN nxdt_ii.sys_dict_data sdd2
ON ypi.check_status = sdd2.dict_value AND sdd2.dict_type = 'yn_check_status' AND sdd2.status = 0
WHERE ypi.is_active = 1
AND ypi.pitfall_id = #{id}
</select>
</mapper>