961 lines
38 KiB
XML
961 lines
38 KiB
XML
<?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>
|
|
<delete id="deleteCheckRemark">
|
|
delete from nxdt_ii.pt_check_person_remark where task_id = #{taskId} and audit_status=2
|
|
</delete>
|
|
<delete id="deleteAuditUserInfo">
|
|
delete from nxdt_ii.lk_audit_user_info 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},
|
|
into_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>
|
|
<!--审核数据-->
|
|
<insert id="addCheckPersonRemark">
|
|
replace into nxdt_ii.pt_check_person_remark(
|
|
task_id, user_id,type,version,audit_status,remark,audit_time,audit_remark
|
|
)values (#{taskId},#{userId},#{type},#{vision},#{agree},#{rejectReason},now(),#{reason})
|
|
</insert>
|
|
<insert id="insertUserInfoData">
|
|
replace into nxdt_ii.lk_audit_user_info(
|
|
task_id,audit_user
|
|
<if test="state!=null and state!=''">
|
|
,audit_status
|
|
</if>
|
|
<if test="isAudit!=null and isAudit!=''">
|
|
,is_audit
|
|
</if>
|
|
,version
|
|
<if test="isNow!=null and isNow!=''">
|
|
,is_now
|
|
</if>
|
|
) values
|
|
(#{taskId},
|
|
#{userId}
|
|
<if test="state!=null and state!=''">
|
|
,#{state}
|
|
</if>
|
|
<if test="isAudit!=null and isAudit!=''">
|
|
,#{isAudit}
|
|
</if>
|
|
, #{version}
|
|
<if test="isNow!=null and isNow!=''">
|
|
,#{isNow}
|
|
</if>
|
|
)
|
|
</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,
|
|
pcc.create_time time,
|
|
IFNULL(pcc.reject,'') as turnDownReason,
|
|
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
|
|
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,
|
|
d.agree,
|
|
case when c.audit_status = '1' then '审核通过'
|
|
when c.audit_status = '2' then '审核驳回'
|
|
when c.audit_status = '3' then '终审通过'
|
|
else '待审核' end as status,
|
|
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`,
|
|
IFNULL( f.dept_name, '' ) AS section,
|
|
IFNULL( c.sort, '' ) AS sort,
|
|
#{taskId} as taskId
|
|
FROM
|
|
(
|
|
select pcp.id as ii,pcp.user_id as id,pcp.exam_type as examType,pcp.sort,pcpr.audit_status
|
|
from nxdt_ii.pt_check_person pcp
|
|
left join nxdt_ii.pt_check_person_remark pcpr on pcp.task_id = pcpr.task_id and pcp.user_id = pcpr.user_id and pcp.version = pcpr.version
|
|
where pcp.task_id = #{taskId} and pcp.type = '1'
|
|
) c
|
|
LEFT JOIN (
|
|
SELECT
|
|
id,
|
|
a.proc_inst_id,
|
|
version,
|
|
repeated_submit,
|
|
sort,
|
|
user_id,
|
|
`comment`,
|
|
reject,
|
|
b.agree,
|
|
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})
|
|
) a
|
|
LEFT JOIN nxdt_ii.pt_check_comment b ON a.proc_inst_id = b.proc_inst_id
|
|
) 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>
|
|
|
|
<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>
|
|
<update id="updateAuditUserInfo">
|
|
update nxdt_ii.lk_audit_user_info
|
|
SET audit_status=#{state},is_audit=#{isAudit},is_now=#{isNow}
|
|
where task_id=#{taskId} and audit_user=#{userId}
|
|
</update>
|
|
<update id="updateSupPersonStatus">
|
|
update nxdt_ii.lk_sup_person
|
|
set into_status =#{enterStatus},
|
|
task_id_into = #{taskId},
|
|
proc_inst_id_into = #{processInstanceId}
|
|
where uuid = #{uuid}
|
|
</update>
|
|
<update id="updateSupPersonOutStatus">
|
|
update nxdt_ii.lk_sup_person
|
|
set out_status =#{enterStatus},
|
|
task_id_out = #{taskId},
|
|
proc_inst_id_out = #{processInstanceId}
|
|
where uuid = #{uuid}
|
|
</update>
|
|
<update id="updateSupPersonSysUserStatus">
|
|
update nxdt_ii.sys_user
|
|
set status = '0'
|
|
where parent_uuid = (select sup_uuid from nxdt_ii.lk_sup_person where uuid = #{uuid})
|
|
</update>
|
|
<update id="updateSupPersonIntoStatusByUuid">
|
|
update nxdt_ii.lk_sup_person
|
|
set into_status =#{statusType},
|
|
admission_date = DATE(NOW())
|
|
where uuid = #{uuid}
|
|
</update>
|
|
<update id="updateSupPersonOutStatusByUuid">
|
|
update nxdt_ii.lk_sup_person
|
|
set out_status =#{statusType},
|
|
departure_date = DATE(NOW())
|
|
where uuid = #{uuid}
|
|
</update>
|
|
|
|
|
|
<select id="approvalHistoryUser" resultType="com.bonus.flowable.entity.ConfigurationVo">
|
|
select distinct a.id ,a.task_id as taskId,a.user_id as userId,a.exam_type as examineType,
|
|
b.audit_status as auditStatus
|
|
from nxdt_ii.pt_check_person a
|
|
left join nxdt_ii.pt_check_person_remark b on a.task_id = b.task_id and a.user_id = b.user_id and a.version = b.version
|
|
where a.type= '2' and a.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="getThisCheckUserStatus" resultType="string">
|
|
select task_type
|
|
from nxdt_ii.pt_check_task where task_id = #{taskId}
|
|
|
|
</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>
|
|
<select id="getProject" resultType="java.lang.String">
|
|
select pro_name
|
|
from nxdt_ii.pt_project_info
|
|
where pro_id=#{proId}
|
|
limit 1
|
|
</select>
|
|
<select id="getUserName" resultType="java.lang.String">
|
|
select su.nick_name
|
|
from nxdt_ii.pt_check_task pct
|
|
left join nxdt_ii.sys_user su on pct.create_id=su.user_id
|
|
where pct.task_id=#{taskId}
|
|
limit 1
|
|
</select>
|
|
<select id="getTypeName" resultType="java.lang.String">
|
|
select dict_label
|
|
from nxdt_ii.sys_dict_data
|
|
where dict_type='sys_approval_type'
|
|
and dict_value=#{taskType}
|
|
limit 1
|
|
</select>
|
|
<select id="getUserPhone" resultType="java.lang.String">
|
|
select user_name
|
|
from nxdt_ii.sys_user
|
|
where user_id in
|
|
<foreach item="userId" collection="list" open="(" separator="," close=")">
|
|
#{userId}
|
|
</foreach>
|
|
|
|
</select>
|
|
<select id="getJlUserList" resultType="java.lang.String">
|
|
select comm_user_id
|
|
from nxdt_ii.pt_sup_info
|
|
where uuid=#{uuid}
|
|
</select>
|
|
<select id="getRequestData" resultType="com.bonus.common.core.domain.RequestEntity">
|
|
select task_id taskId,user_id userId,exam_type examType,type type,version vision,sort sort
|
|
from nxdt_ii.pt_check_person
|
|
where task_id=#{taskId} and type=#{type}
|
|
<if test="userId!=null and userId!=''">
|
|
<if test='type=="1"'>
|
|
AND user_id=#{userId}
|
|
</if>
|
|
<if test='type=="2"'>
|
|
AND concat(',',user_id,',') like concat('%',#{userId},'%')
|
|
</if>
|
|
</if>
|
|
|
|
order by sort asc
|
|
</select>
|
|
<select id="getAuditRemark" resultType="java.lang.Integer">
|
|
select count(1)
|
|
from nxdt_ii.pt_check_person_remark
|
|
where task_id=#{taskId} and type=#{type}
|
|
and user_id=#{userId}
|
|
</select>
|
|
<select id="checkHistory" resultType="com.bonus.flowable.entity.CheckComment">
|
|
SELECT DISTINCT
|
|
IFNULL( sd.dept_name, '' ) AS section,
|
|
IFNULL( su.nick_name, '' ) AS NAME,
|
|
IFNULL( pcp.id, '' ) AS id,
|
|
IFNULL( pcp.user_id, '' ) AS userId,
|
|
IFNULL( pcp.task_id, '' ) AS taskId,
|
|
IFNULL( pcp.exam_type, '' ) AS examType,
|
|
IFNULL( pcp.sort, '' ) AS sort,
|
|
IFNULL( pcpr.audit_time, '' ) AS time,
|
|
CASE
|
|
WHEN pcpr.audit_status = '1' THEN
|
|
'审核通过'
|
|
WHEN pcpr.audit_status = '2' THEN
|
|
'审核驳回'
|
|
WHEN pcpr.audit_status = '3' THEN
|
|
'终审通过' ELSE '待审核'
|
|
END AS STATUS,
|
|
IFNULL( pcpr.remark, '' ) AS turnDownReason,
|
|
IFNULL( pcpr.audit_remark, '' ) AS reason
|
|
FROM
|
|
nxdt_ii.pt_check_person pcp
|
|
LEFT JOIN nxdt_ii.pt_check_person_remark pcpr ON pcp.task_id = pcpr.task_id
|
|
AND pcp.user_id = pcpr.user_id
|
|
AND pcp.version = pcpr.version
|
|
and pcp.type=pcpr.type
|
|
LEFT JOIN nxdt_ii.sys_user su ON pcp.user_id = su.user_id
|
|
LEFT JOIN nxdt_ii.sys_dept sd ON su.dept_id = sd.dept_id
|
|
WHERE
|
|
pcp.task_id = #{taskId} AND pcp.type = 1
|
|
<if test="userId!=null and userId!=''">
|
|
and pcp.user_id=#{userId} and pcp.version=#{vision}
|
|
</if>
|
|
<if test="dataType!=null and dataType!=''">
|
|
and pcpr.audit_status is not null
|
|
</if>
|
|
</select>
|
|
<select id="getTreeList" resultType="com.bonus.flowable.entity.CheckComment">
|
|
select pcp.user_id userId ,pcp.exam_type examType,pcp.version,pcpr.audit_status auditStatus
|
|
from nxdt_ii.pt_check_person pcp
|
|
LEFT JOIN nxdt_ii.pt_check_person_remark pcpr ON pcp.task_id = pcpr.task_id
|
|
AND pcp.user_id = pcpr.user_id
|
|
AND pcp.version = pcpr.version
|
|
and pcp.type=pcpr.type
|
|
where pcp.type=2 and pcp.task_id = #{taskId}
|
|
|
|
</select>
|
|
<select id="getUserIsCz" resultType="java.lang.Integer">
|
|
select count(1)
|
|
from nxdt_ii.lk_audit_user_info
|
|
where task_id=#{taskId} and audit_user=#{userId}
|
|
</select>
|
|
<select id="getAuditUserVersion" resultType="java.lang.String">
|
|
select version
|
|
from nxdt_ii.lk_audit_user_info
|
|
where task_id=#{taskId}
|
|
limit 1
|
|
</select>
|
|
<select id="getCheckRemark" resultType="java.lang.String">
|
|
select user_id
|
|
FROM nxdt_ii.pt_check_person_remark
|
|
where task_id=#{taskId} and type=2 and audit_status=2
|
|
</select>
|
|
<select id="getCheckTree" resultType="java.lang.String">
|
|
select user_id
|
|
from nxdt_ii.pt_check_person
|
|
where task_id=#{taskId}
|
|
and type=2
|
|
order by sort asc
|
|
limit 1
|
|
|
|
</select>
|
|
|
|
</mapper>
|