635 lines
24 KiB
XML
635 lines
24 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.nxdt.energy.material.dao.MaterialUploadDao">
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getPersonByConsIdAndProId" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" resultType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
select cq.id,cq.`name` as personName,cq.idcard as idNumber,cq.person_aptitude_fileId as qualificationId,cq.other_file_id as otherFileId ,
|
||
|
|
cq.insurance_file_id as insuranceFileId,cq.epidemic_file_id as epidemicFileId,
|
||
|
|
cq.is_special as isSpecial,tw.type_name as workType,`relative` as phone,address,hmc_enter_time as enterTime,hmc_leave_time as leaveTime
|
||
|
|
,cq.culture,cq.physical,cq.nation,cq.hold_address as holdAddress,cq.insurance
|
||
|
|
from cons_person_qualifi cq
|
||
|
|
LEFT JOIN type_work tw on tw.id = cq.job
|
||
|
|
where cq.contrator_id = #{contratorId} and cq.pro_id = #{projectId} and cq.is_active='1'
|
||
|
|
ORDER BY id desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getSecurityByConsIdAndProId" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" resultType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
select id,securiity_name as toolsName,num as nums,equip_file_id as qualificationId
|
||
|
|
from security_apparatus cq
|
||
|
|
where cq.contrator_id =#{contratorId} and cq.project_id = #{projectId} and cq.is_active = '1'
|
||
|
|
ORDER BY id desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getConsFileByConsIdAndProId" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" resultType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
SELECT
|
||
|
|
ft.id,
|
||
|
|
ft.type_id AS typeId,
|
||
|
|
ft.file_id AS fileId,
|
||
|
|
ft.file_address AS address,
|
||
|
|
ft.file_name AS fileName,
|
||
|
|
ft.is_active AS isActive,
|
||
|
|
'0' AS annex,
|
||
|
|
fc.file_name AS kindName,
|
||
|
|
fc.file_path AS kindPath,
|
||
|
|
fc.type_name AS kindType,
|
||
|
|
fc.request_url AS kindUrl
|
||
|
|
FROM
|
||
|
|
file_table ft
|
||
|
|
RIGHT JOIN ( SELECT id AS consId, contrator_name AS consName, four_file_id AS fourFileId FROM contractor_qualication
|
||
|
|
WHERE contrator_id = #{contratorId} AND project_id = #{projectId} ) a ON a.fourFileId = ft.file_id
|
||
|
|
LEFT JOIN file_configuration fc ON fc.id = ft.type_id
|
||
|
|
where ft.file_address is not null and ft.is_active = '1'
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT
|
||
|
|
ft.id,
|
||
|
|
ft.type_id AS typeId,
|
||
|
|
ft.file_id AS fileId,
|
||
|
|
ft.file_address AS address,
|
||
|
|
ft.file_name AS fileName,
|
||
|
|
ft.is_active AS isActive,
|
||
|
|
'1' AS annex,
|
||
|
|
fc.file_name AS kindName,
|
||
|
|
fc.file_path AS kindPath,
|
||
|
|
fc.type_name AS kindType,
|
||
|
|
fc.request_url AS kindUrl
|
||
|
|
FROM
|
||
|
|
file_table ft
|
||
|
|
RIGHT JOIN ( SELECT * FROM security_apparatus
|
||
|
|
WHERE contrator_id = #{contratorId} AND project_id = #{projectId} ) a ON a.equip_file_id = ft.file_id
|
||
|
|
LEFT JOIN file_configuration fc ON fc.id = ft.type_id
|
||
|
|
where ft.file_address is not null and ft.is_active = '1'
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT
|
||
|
|
ft.id,
|
||
|
|
ft.type_id AS typeId,
|
||
|
|
ft.file_id AS fileId,
|
||
|
|
ft.file_address AS address,
|
||
|
|
ft.file_name AS fileName,
|
||
|
|
ft.is_active AS isActive,
|
||
|
|
'1' AS annex,
|
||
|
|
fc.file_name AS kindName,
|
||
|
|
fc.file_path AS kindPath,
|
||
|
|
fc.type_name AS kindType,
|
||
|
|
fc.request_url AS kindUrl
|
||
|
|
FROM
|
||
|
|
file_table ft
|
||
|
|
RIGHT JOIN ( SELECT person_aptitude_fileId FROM cons_person_qualifi
|
||
|
|
WHERE contrator_id = #{contratorId} AND pro_id = #{projectId} ) a ON a.person_aptitude_fileId = ft.file_id
|
||
|
|
LEFT JOIN file_configuration fc ON fc.id = ft.type_id
|
||
|
|
where ft.file_address is not null and ft.is_active = '1'
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT
|
||
|
|
ft.id,
|
||
|
|
ft.type_id AS typeId,
|
||
|
|
ft.file_id AS fileId,
|
||
|
|
ft.file_address AS address,
|
||
|
|
ft.file_name AS fileName,
|
||
|
|
ft.is_active AS isActive,
|
||
|
|
'2' AS annex,
|
||
|
|
fc.file_name AS kindName,
|
||
|
|
fc.file_path AS kindPath,
|
||
|
|
fc.type_name AS kindType,
|
||
|
|
fc.request_url AS kindUrl
|
||
|
|
FROM
|
||
|
|
file_table ft
|
||
|
|
RIGHT JOIN ( SELECT other_file_id FROM cons_person_qualifi
|
||
|
|
WHERE contrator_id = #{contratorId} AND pro_id = #{projectId} ) a ON a.other_file_id = ft.file_id
|
||
|
|
LEFT JOIN file_configuration fc ON fc.id = ft.type_id
|
||
|
|
where ft.file_address is not null and ft.is_active = '1'
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT
|
||
|
|
ft.id,
|
||
|
|
ft.type_id AS typeId,
|
||
|
|
ft.file_id AS fileId,
|
||
|
|
ft.file_address AS address,
|
||
|
|
ft.file_name AS fileName,
|
||
|
|
ft.is_active AS isActive,
|
||
|
|
'3' AS annex,
|
||
|
|
fc.file_name AS kindName,
|
||
|
|
fc.file_path AS kindPath,
|
||
|
|
fc.type_name AS kindType,
|
||
|
|
fc.request_url AS kindUrl
|
||
|
|
FROM
|
||
|
|
file_table ft
|
||
|
|
RIGHT JOIN ( SELECT insurance_file_id FROM cons_person_qualifi
|
||
|
|
WHERE contrator_id = #{contratorId} AND pro_id = #{projectId} ) a ON a.insurance_file_id = ft.file_id
|
||
|
|
LEFT JOIN file_configuration fc ON fc.id = ft.type_id
|
||
|
|
where ft.file_address is not null and ft.is_active = '1'
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT
|
||
|
|
ft.id,
|
||
|
|
ft.type_id AS typeId,
|
||
|
|
ft.file_id AS fileId,
|
||
|
|
ft.file_address AS address,
|
||
|
|
ft.file_name AS fileName,
|
||
|
|
ft.is_active AS isActive,
|
||
|
|
'4' AS annex,
|
||
|
|
fc.file_name AS kindName,
|
||
|
|
fc.file_path AS kindPath,
|
||
|
|
fc.type_name AS kindType,
|
||
|
|
fc.request_url AS kindUrl
|
||
|
|
FROM
|
||
|
|
file_table ft
|
||
|
|
RIGHT JOIN ( SELECT epidemic_file_id FROM cons_person_qualifi
|
||
|
|
WHERE contrator_id = #{contratorId} AND pro_id = #{projectId} ) a ON a.epidemic_file_id = ft.file_id
|
||
|
|
LEFT JOIN file_configuration fc ON fc.id = ft.type_id
|
||
|
|
where ft.file_address is not null and ft.is_active = '1'
|
||
|
|
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getFileUploadTypeByConsId" parameterType="com.bonus.nxdt.energy.material.entity.FileUpBean" resultType="com.bonus.nxdt.energy.material.entity.FileUpBean">
|
||
|
|
select pfc.id,pfc.cons_id as consId,cq.contrator_id as contratorId,cq.project_id as projectId,
|
||
|
|
fc.file_name as fileName,pfc.file_id as fileId,fc.type_name as typeName,fc.request_url as requestUrl,
|
||
|
|
fc.file_path as filePath
|
||
|
|
from pm_file_cons pfc
|
||
|
|
LEFT JOIN contractor_qualication cq on cq.id = pfc.cons_id
|
||
|
|
LEFT JOIN file_configuration fc on fc.id = pfc.file_id
|
||
|
|
WHERE pfc.cons_id = #{consId} and project_type_id ='2'
|
||
|
|
group by pfc.id
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="addConsMessage" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" >
|
||
|
|
insert into contractor_qualication(contrator_id,project_id,contrator_name,is_active,audit_status)
|
||
|
|
values (#{contratorId},#{projectId},#{consName},'-1','0')
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<select id="haveConsDate" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" resultType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
select id from contractor_qualication where contrator_id = #{contratorId} and project_id = #{projectId} and is_active = '1' limit 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getAuditProcessAndFileId" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" resultType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
select contrator_id as contratorId,audit_process as auditProcess, four_file_id as fourFileId from contractor_qualication
|
||
|
|
where contrator_id = #{contratorId} and project_id = #{projectId} and is_active = '1'
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<update id="updateFourFileId" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update contractor_qualication set four_file_id = #{uuid} where contrator_id = #{contratorId} and project_id = #{projectId} and is_active = '1'
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="updateFileIdByConsId" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update contractor_qualication
|
||
|
|
<set>
|
||
|
|
<if test="auditProcess !='null' and auditProcess != null">
|
||
|
|
audit_process = #{auditProcess},
|
||
|
|
</if>
|
||
|
|
<if test="idType =='1' or idType == 1">
|
||
|
|
four_file_id = #{uuid},
|
||
|
|
</if>
|
||
|
|
<if test="idType =='2' or idType == 2 ">
|
||
|
|
qualification_id = #{uuid},
|
||
|
|
</if>
|
||
|
|
<if test="idType =='3' or idType == 3 ">
|
||
|
|
other_file_id = #{uuid},
|
||
|
|
</if>
|
||
|
|
</set>
|
||
|
|
where contrator_id = #{contratorId} and project_id = #{projectId} and is_active = '1'
|
||
|
|
</update>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<insert id="addFileDate" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" useGeneratedKeys="true" keyProperty="id">
|
||
|
|
insert into file_table(file_id,type_id,file_name,file_address,is_active,data_index)
|
||
|
|
values (#{fileId},#{typeId},#{fileName},#{fileAddress},#{isActive},#{dataIndex})
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<insert id="addTools" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
insert into security_apparatus(project_id,contrator_id,securiity_name,num,equip_file_id,is_active,process_id,audit_status)
|
||
|
|
values (#{projectId},#{contratorId},#{toolsName},#{nums},#{uuid},#{isActive},#{auditProcess},'0')
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<select id="haveTools" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" resultType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
select id from security_apparatus where equip_file_id = #{fileId} and is_active !='0' limit 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="havePerson" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" resultType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
select id from cons_person_qualifi where idcard = #{idNumber} and contrator_id =#{contratorId} and pro_id = #{projectId} and is_active !='0' limit 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="addPerson" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
insert into cons_person_qualifi(contrator_id,pro_id,`name`,idcard,is_active,person_aptitude_fileId,job,is_special,
|
||
|
|
check_process_id,name_id,other_file_id,`relative`,audit_status,address,hmc_enter_time,hmc_leave_time,
|
||
|
|
culture,physical,nation,insurance,hold_address,epidemic_file_id,insurance_file_id)
|
||
|
|
values (#{contratorId},#{projectId},#{personName},#{idNumber},#{isActive},#{uuid},#{workType},#{isSpecial},
|
||
|
|
#{auditProcess},#{nameId},#{uuid2},#{phone},'0',#{address},#{enterTime},#{leaveTime},
|
||
|
|
#{culture},#{physical},#{nation},#{insurance},#{holdAddress},#{uuid4},#{uuid3})
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getWorkType" parameterType="com.bonus.nxdt.energy.constrator.entity.MapBean" resultType="com.bonus.nxdt.energy.constrator.entity.MapBean">
|
||
|
|
select id as `key`,type_name as `value` from type_work
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<update id="updatePersonOtherIdByIdNumber" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" >
|
||
|
|
update cons_person_qualifi
|
||
|
|
<set>
|
||
|
|
<if test="uuid2 != null and uuid2 != ''">
|
||
|
|
other_file_id = #{uuid2},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="isSpecial != null and isSpecial != ''">
|
||
|
|
is_special = #{isSpecial},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="workType != null and workType != ''">
|
||
|
|
job = #{workType},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="address != null and address != ''">
|
||
|
|
address = #{address},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="enterTime != null and enterTime != ''">
|
||
|
|
hmc_enter_time = #{enterTime},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="leaveTime != null and leaveTime != ''">
|
||
|
|
hmc_leave_time = #{leaveTime},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="address != null and address != ''">
|
||
|
|
address = #{address},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="enterTime != null and enterTime != ''">
|
||
|
|
hmc_enter_time = #{enterTime},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="leaveTime != null and leaveTime != ''">
|
||
|
|
hmc_leave_time = #{leaveTime},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="physical != null and physical != ''">
|
||
|
|
physical = #{physical},
|
||
|
|
</if>
|
||
|
|
<if test="culture != null and culture != ''">
|
||
|
|
culture = #{culture},
|
||
|
|
</if>
|
||
|
|
<if test="nation != null and nation != ''">
|
||
|
|
nation = #{nation},
|
||
|
|
</if>
|
||
|
|
<if test="insurance != null and insurance != ''">
|
||
|
|
insurance = #{insurance},
|
||
|
|
</if>
|
||
|
|
<if test="holdAddress != null and holdAddress != ''">
|
||
|
|
hold_address = #{holdAddress},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
</set>
|
||
|
|
where contrator_id = #{contratorId} and pro_id = #{projectId} and `name` = #{personName} and idcard = #{idNumber}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="updatePersonMessageByUuid" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update cons_person_qualifi
|
||
|
|
<set>
|
||
|
|
<if test="personName != null and personName != ''">
|
||
|
|
`name` = #{personName},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="idNumber != null and idNumber != ''">
|
||
|
|
idcard = #{idNumber},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="isSpecial != null and isSpecial != ''">
|
||
|
|
is_special = #{isSpecial},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="workType != null and workType != ''">
|
||
|
|
job = #{workType},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="phone != null and phone != ''">
|
||
|
|
`relative` = #{phone},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="address != null and address != ''">
|
||
|
|
address = #{address},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="enterTime != null and enterTime != ''">
|
||
|
|
hmc_enter_time = #{enterTime},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="leaveTime != null and leaveTime != ''">
|
||
|
|
hmc_leave_time = #{leaveTime},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
|
||
|
|
<if test="physical != null and physical != ''">
|
||
|
|
physical = #{physical},
|
||
|
|
</if>
|
||
|
|
<if test="culture != null and culture != ''">
|
||
|
|
culture = #{culture},
|
||
|
|
</if>
|
||
|
|
<if test="nation != null and nation != ''">
|
||
|
|
nation = #{nation},
|
||
|
|
</if>
|
||
|
|
<if test="insurance != null and insurance != ''">
|
||
|
|
insurance = #{insurance},
|
||
|
|
</if>
|
||
|
|
<if test="holdAddress != null and holdAddress != ''">
|
||
|
|
hold_address = #{holdAddress},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
</set>
|
||
|
|
where person_aptitude_fileId = #{uuid}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="updateToolsMessageByUuid" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update security_apparatus
|
||
|
|
<set>
|
||
|
|
<if test="toolsName != null and toolsName != ''">
|
||
|
|
securiity_name = #{toolsName},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="nums != null and nums != ''">
|
||
|
|
num = #{nums},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
</set>
|
||
|
|
where equip_file_id = #{uuid}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="restoreToolsAndPerson" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update cons_person_qualifi set check_process_status ='0' where check_process_status ='1' and contrator_id = #{contratorId} and pro_id = #{projectId};
|
||
|
|
update security_apparatus set audit_status = '0' where audit_status ='1' and project_id = #{projectId} and contrator_id = #{contratorId};
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="changeStatus" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update security_apparatus set is_active ='1' where is_active = '-1' and project_id = #{projectId} and contrator_id = #{contratorId};
|
||
|
|
update cons_person_qualifi set is_active ='1' where is_active = '-1' and contrator_id = #{contratorId} and pro_id = #{projectId};
|
||
|
|
update contractor_qualication set audit_status ='0' ,create_time = CURRENT_TIMESTAMP() where contrator_id = #{contratorId} and project_id = #{projectId};
|
||
|
|
|
||
|
|
update file_table set is_active ='1'
|
||
|
|
where is_active ='-1' and file_id in (
|
||
|
|
select four_file_id as fileId from contractor_qualication cq
|
||
|
|
WHERE cq.contrator_id = #{contratorId} and cq.project_id = #{projectId}
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT equip_file_id as fileId from security_apparatus sa
|
||
|
|
WHERE sa.contrator_id = #{contratorId} and sa.project_id = #{projectId}
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT person_aptitude_fileId as fileId from cons_person_qualifi cp
|
||
|
|
WHERE cp.contrator_id = #{contratorId} and cp.pro_id = #{projectId}
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT cp.other_file_id as fileId from cons_person_qualifi cp
|
||
|
|
WHERE cp.contrator_id = #{contratorId} and cp.pro_id = #{projectId}
|
||
|
|
and cp.other_file_id is not null
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT cp.insurance_file_id as fileId from cons_person_qualifi cp
|
||
|
|
WHERE cp.contrator_id = #{contratorId} and cp.pro_id = #{projectId}
|
||
|
|
and cp.insurance_file_id is not null
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT cp.epidemic_file_id as fileId from cons_person_qualifi cp
|
||
|
|
WHERE cp.contrator_id = #{contratorId} and cp.pro_id = #{projectId}
|
||
|
|
and cp.epidemic_file_id is not null
|
||
|
|
)
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="cancelModify" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update security_apparatus set is_active ='0' where is_active = '-1' and project_id = #{projectId} and contrator_id = #{contratorId};
|
||
|
|
update cons_person_qualifi set is_active ='0' where is_active = '-1' and contrator_id = #{contratorId} and pro_id = #{projectId};
|
||
|
|
update file_table set is_active ='0'
|
||
|
|
where is_active ='-1' and file_id in (
|
||
|
|
select four_file_id as fileId from contractor_qualication cq
|
||
|
|
WHERE cq.contrator_id = #{contratorId} and cq.project_id = #{projectId}
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT equip_file_id as fileId from security_apparatus sa
|
||
|
|
WHERE sa.contrator_id = #{contratorId} and sa.project_id = #{projectId}
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT person_aptitude_fileId as fileId from cons_person_qualifi cp
|
||
|
|
WHERE cp.contrator_id = #{contratorId} and cp.pro_id = #{projectId}
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT cp.other_file_id as fileId from cons_person_qualifi cp
|
||
|
|
WHERE cp.contrator_id = #{contratorId} and cp.pro_id = #{projectId}
|
||
|
|
and cp.other_file_id is not null
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT cp.insurance_file_id as fileId from cons_person_qualifi cp
|
||
|
|
WHERE cp.contrator_id = #{contratorId} and cp.pro_id = #{projectId}
|
||
|
|
and cp.insurance_file_id is not null
|
||
|
|
|
||
|
|
UNION
|
||
|
|
|
||
|
|
SELECT cp.epidemic_file_id as fileId from cons_person_qualifi cp
|
||
|
|
WHERE cp.contrator_id = #{contratorId} and cp.pro_id = #{projectId}
|
||
|
|
and cp.epidemic_file_id is not null
|
||
|
|
)
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="updateProcesson" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update contractor_qualication set audit_process = #{auditProcess} where contrator_id = #{contratorId} and project_id = #{projectId} ;
|
||
|
|
update security_apparatus set process_id = #{auditProcess} where project_id = #{projectId} and contrator_id = #{contratorId};
|
||
|
|
update cons_person_qualifi set check_process_id = #{auditProcess} where contrator_id = #{contratorId} and pro_id = #{projectId};
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteStatus" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
delete from security_apparatus where is_active = '-1' and project_id = #{projectId} and contrator_id = #{contratorId};
|
||
|
|
delete from cons_person_qualifi where is_active = '-1' and contrator_id = #{contratorId} and pro_id = #{projectId};
|
||
|
|
update contractor_qualication set four_file_id = null,other_file_id = null ,qualification_id = null,audit_process = null
|
||
|
|
where contrator_id = #{contratorId} and project_id = #{projectId};
|
||
|
|
delete from file_table where is_active = '-1';
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<update id="deleFileByNameAndUUid" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update file_table set is_active ='0' where file_name = #{fileName} and data_index = #{dataIndex}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="deleFileById" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update file_table set is_active ='0' where id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="getFourIdByConsId" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean" resultType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
select four_file_id as fourFileId,audit_process as auditProcess from contractor_qualication where contrator_id =#{contratorId} and project_id = #{projectId} and is_active = '1'
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<update id="updatePersonAndFileTypeByUuid" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update cons_person_qualifi set is_active ='0' where person_aptitude_fileId = #{uuid};
|
||
|
|
update file_table set is_active ='0' where file_id = #{uuid} or file_id = #{uuid2} or file_id = #{uuid3} or file_id = #{uuid4};
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="updateToolsAndFileTypeByUuid" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
update security_apparatus set is_active ='0' where equip_file_id = #{uuid};
|
||
|
|
update file_table set is_active ='0' where file_id = #{uuid} ;
|
||
|
|
</update>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="count" resultType="java.lang.Integer">
|
||
|
|
SELECT
|
||
|
|
count(1)
|
||
|
|
FROM(
|
||
|
|
select
|
||
|
|
cq.id,
|
||
|
|
cq.`name` as name,
|
||
|
|
cq.idcard AS idNumber,
|
||
|
|
cq.relative AS relative,
|
||
|
|
cq.hold_address AS holdAddress,
|
||
|
|
cq.address AS address,
|
||
|
|
cq.is_special AS isSpecial,
|
||
|
|
cq.job AS jobId,
|
||
|
|
tw.type_name AS jobName,
|
||
|
|
|
||
|
|
cq.hmc_enter_time AS hmcEnterTime,
|
||
|
|
cq.hmc_leave_time AS hmcLeaveTime,
|
||
|
|
|
||
|
|
cq.province AS province,
|
||
|
|
cq.nation AS nation,
|
||
|
|
cq.culture AS educationalLevel,
|
||
|
|
cq.hold_address AS registerAddress,
|
||
|
|
cq.physical AS healthCheckup,
|
||
|
|
cq.insurance AS isInsure
|
||
|
|
from cons_person_qualifi cq
|
||
|
|
LEFT JOIN type_work tw on tw.id = cq.job
|
||
|
|
where cq.is_active='1' and cq.contrator_id = #{params.contratorId} and cq.pro_id = #{params.projectId}
|
||
|
|
and check_process_status not in('1','5')
|
||
|
|
)r
|
||
|
|
</select>
|
||
|
|
<select id="historycount" resultType="java.lang.Integer">
|
||
|
|
SELECT
|
||
|
|
count(1)
|
||
|
|
FROM
|
||
|
|
pm_history_audit
|
||
|
|
where 1=1
|
||
|
|
<if test="params.projectId != null or params.projectId == ''">
|
||
|
|
AND project_id = #{params.projectId}
|
||
|
|
</if>
|
||
|
|
<if test="params.consId != null or params.consId == ''">
|
||
|
|
AND cons_id = #{params.consId}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
<select id="historylist" resultType="com.bonus.nxdt.energy.material.entity.HistoryBean">
|
||
|
|
SELECT
|
||
|
|
pha.id,
|
||
|
|
pha.project_id AS projectId,
|
||
|
|
bp.`name` AS projectName,
|
||
|
|
pha.cons_id AS consId,
|
||
|
|
bspr.cons_name AS consName,
|
||
|
|
pha.user_id AS userId,
|
||
|
|
su.USERNAME,
|
||
|
|
po.`NAME` AS auditDepart,
|
||
|
|
pha.`current_time` AS currentTime,
|
||
|
|
audit_type AS auditType,
|
||
|
|
file_type as fileType,
|
||
|
|
pha.json_str as jsonStr
|
||
|
|
FROM
|
||
|
|
pm_history_audit pha
|
||
|
|
LEFT JOIN bm_project bp ON bp.ID = pha.project_id
|
||
|
|
LEFT JOIN bm_sub_pro_relation bspr ON bspr.cons_id = pha.cons_id
|
||
|
|
LEFT JOIN sys_user su ON su.id = pha.user_id
|
||
|
|
LEFT JOIN pm_organization po ON po.id = su.ORG_ID
|
||
|
|
where 1=1
|
||
|
|
<if test="params.projectId != null or params.projectId == ''">
|
||
|
|
AND pha.project_id = #{params.projectId}
|
||
|
|
</if>
|
||
|
|
<if test="params.consId != null or params.consId == ''">
|
||
|
|
AND pha.cons_id = #{params.consId}
|
||
|
|
</if>
|
||
|
|
order by pha.`current_time` desc
|
||
|
|
limit #{offset}, #{limit}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="list" resultType="com.bonus.nxdt.energy.material.entity.PersonBean">
|
||
|
|
select
|
||
|
|
cq.id,
|
||
|
|
cq.`name` as name,
|
||
|
|
cq.idcard AS idNumber,
|
||
|
|
cq.relative AS relative,
|
||
|
|
cq.hold_address AS holdAddress,
|
||
|
|
cq.address AS address,
|
||
|
|
cq.is_special AS isSpecial,
|
||
|
|
cq.job AS jobId,
|
||
|
|
tw.type_name AS jobName,
|
||
|
|
cq.hmc_enter_time AS hmcEnterTime,
|
||
|
|
cq.hmc_leave_time AS hmcLeaveTime,
|
||
|
|
|
||
|
|
cq.province AS province,
|
||
|
|
cq.nation AS nation,
|
||
|
|
cq.culture AS educationalLevel,
|
||
|
|
cq.hold_address AS registerAddress,
|
||
|
|
cq.physical AS healthCheckup,
|
||
|
|
cq.insurance AS isInsure
|
||
|
|
from cons_person_qualifi cq
|
||
|
|
LEFT JOIN type_work tw on tw.id = cq.job
|
||
|
|
where cq.is_active='1' and cq.contrator_id = #{params.contratorId} and cq.pro_id = #{params.projectId}
|
||
|
|
and check_process_status not in('1','5')
|
||
|
|
limit #{offset}, #{limit}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getListById" resultType="com.bonus.nxdt.energy.material.entity.PersonBean">
|
||
|
|
select
|
||
|
|
c.contrator_name AS contratorName,
|
||
|
|
cq.id,cq.`name` as name,
|
||
|
|
cq.idcard AS idNumber,
|
||
|
|
cq.relative AS relative,
|
||
|
|
cq.hold_address AS holdAddress,
|
||
|
|
cq.address AS address,
|
||
|
|
cq.is_special AS isSpecial,
|
||
|
|
cq.job AS jobId,
|
||
|
|
tw.type_name AS jobName,
|
||
|
|
cq.hmc_enter_time AS hmcEnterTime,
|
||
|
|
cq.hmc_leave_time AS hmcLeaveTime,
|
||
|
|
cq.province AS province,
|
||
|
|
cq.nation AS nation,
|
||
|
|
cq.culture AS educationalLevel,
|
||
|
|
cq.hold_address AS registerAddress,
|
||
|
|
cq.physical AS healthCheckup,
|
||
|
|
cq.insurance AS isInsure
|
||
|
|
from cons_person_qualifi cq
|
||
|
|
LEFT JOIN type_work tw on tw.id = cq.job
|
||
|
|
LEFT JOIN contractor_qualication c ON c.contrator_id = cq.contrator_id
|
||
|
|
where cq.is_active='1' and cq.contrator_id = #{contratorId} and cq.pro_id = #{projectId} and cq.check_process_status not in('1','5')
|
||
|
|
<if test="personType == '1' or personType == 1">
|
||
|
|
and (cq.appera_status != '2' OR cq.appera_status is null)
|
||
|
|
</if>
|
||
|
|
<if test="personType == '2' or personType == 2">
|
||
|
|
AND cq.check_process_status = '2' AND cq.appera_status = '2'
|
||
|
|
</if>
|
||
|
|
<if test="personType == '1'">
|
||
|
|
AND cq.appera_status IS NULL
|
||
|
|
</if>
|
||
|
|
<if test="personType == '2'">
|
||
|
|
AND cq.appera_status = '0'
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!-- 以下为2024年审核流修改新增方法 -->
|
||
|
|
<insert id="addProgressChild" parameterType="com.bonus.nxdt.energy.material.entity.MaterialBean">
|
||
|
|
|
||
|
|
update audit_pross_child set is_active = '0' where pro_id=#{projectId} and cons_id=#{contratorId} and process_type = #{processType} and audit_status ='1';
|
||
|
|
|
||
|
|
insert into audit_pross_child(pro_id,cons_id,audit_process,audit_type,process_type,audit_status)
|
||
|
|
values (#{projectId},#{contratorId},#{auditProcess},#{idType},#{processType},#{auditStatus})
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
</mapper>
|