nxdt-system/bonus-modules/bonus-project/src/main/resources/mapper/system/ContEntryExitMapper.xml

176 lines
6.8 KiB
XML
Raw Normal View History

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.project.mapper.ContEntryExitMapper">
<insert id="addFile">
insert into pt_cons_information(pro_id, uuid, from_type, information_type, information_path, information_name, information_size, information_user_id, information_user_name, is_active)
values
(#{proId}, #{uuid}, #{fromType}, #{informationType}, #{filePath}, #{fileName}, #{fileSize},
#{createUserId}, #{createUser}, '1')
</insert>
<update id="updateFinishStatus">
UPDATE lk_pro_cont
SET out_status = #{status},end_date = #{endDate}
WHERE uuid = #{uuid}
</update>
<update id="updateStartWorkStatus">
UPDATE lk_pro_cont
SET start_status = #{status},
start_date = #{startDate}
WHERE uuid = #{uuid}
</update>
<select id="listContEntry" resultType="com.bonus.project.domain.ContEntryExit">
SELECT
ppi.pro_name as proName,
lpc.cont_name as contName,
lpc.sup_code as supCode,
lce.legal_name as legalName,
lce.legal_phone as legalPhone,
lce.cont_user_name as contUserName,
lce.cont_user_phone as contUserPhone,
case lpc.into_status
when '1' then '待审批'
when '2' then '审批中'
when '3' then '已通过'
when '4' then '已驳回'
when '5' then '已撤回'
end as status
FROM
lk_pro_cont lpc
LEFT JOIN pt_cont_info pci ON lpc.cont_uuid = pci.uuid AND pci.is_active = '1'
LEFT JOIN pt_project_info ppi ON lpc.pro_id = ppi.pro_id AND ppi.is_active = '1'
WHERE
lpc.out_status = '0' AND lpc.into_status != '0'
<if test="userType != 00 or userType != 00">
AND lpc.pro_id = #{proId}
</if>
<if test="userType == '01' or userType == 01">
AND lpc.sup_uuid = #{supUuid}
</if>
<if test="status != null and status != ''">
AND lpc.into_status = #{status}
</if>
<if test="proName != null and proName != ''">
AND lpc.pro_id = #{proName}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
lce.cont_name LIKE CONCAT('%',#{keyWord},'%')
OR lce.sup_code LIKE CONCAT('%',#{keyWord},'%')
OR lce.legal_name LIKE CONCAT('%',#{keyWord},'%')
OR lce.legal_phone LIKE CONCAT('%',#{keyWord},'%')
OR lce.cont_user_name LIKE CONCAT('%',#{keyWord},'%')
OR lce.cont_user_phone LIKE CONCAT('%',#{keyWord},'%')
)
</if>
</select>
<select id="listCommencementApproval" resultType="com.bonus.project.domain.ContEntryExit">
SELECT
lpc.pro_id as proId,
lpc.cont_uuid as consUuid,
lpc.sup_uuid as supUuid,
lpc.uuid as uuid,
ppi.pro_name as proName,
pci.cont_name as contName,
'0' as status,
lpc.start_status as intoStatus,
lpc.start_date as startDate,
lpc.task_id_start as taskId,
lpc.proc_inst_id_start as procInsId
FROM lk_pro_cont lpc
LEFT JOIN pt_project_info ppi ON lpc.pro_id = ppi.pro_id AND ppi.is_active = '1'
LEFT JOIN pt_cont_info pci ON lpc.cont_uuid = pci.uuid AND pci.is_active = '1'
WHERE
lpc.into_status = '3'
AND lpc.start_status != '0'
<if test="userType != 00 or userType != 00">
AND lpc.pro_id = #{proId}
</if>
<if test="userType == '01' or userType == 01">
AND lpc.sup_uuid = #{supUuid}
</if>
<if test="status != null and status != '' and status != 1 and status != '1' and status != '2' and status != 2 ">
AND lpc.start_status = #{status}
</if>
<if test=" appType == 'app' ">
AND lpc.pro_id = #{proId}
</if>
</select>
<select id="listStartOfWork" resultType="com.bonus.project.domain.ContEntryExit">
SELECT
ppi.pro_name as proName,
lpc.cont_name as contName,
case lpc.start_status
when '1' then '待审批'
when '2' then '审批中'
when '3' then '已通过'
when '4' then '已驳回'
when '5' then '已撤回'
end as status,
lce.start_date as startDate
FROM lk_pro_cont lpc
LEFT JOIN pt_project_info ppi ON lpc.pro_id = ppi.pro_id AND ppi.is_active = '1'
LEFT JOIN pt_cont_info pci ON lpc.cont_uuid = pci.uuid AND pci.is_active = '1'
WHERE
lpc.into_status = '2'
AND lpc.start_status = '2'
<if test="userType != 00 or userType != 00">
AND lpc.pro_id = #{proId}
</if>
<if test="userType == '01' or userType == 01">
AND lpc.sup_uuid = #{supUuid}
</if>
<if test="status != null and status != '' and status != 1 and status != '1' and status != '2' and status != 2 ">
AND lpc.out_status = #{status}
</if>
</select>
<select id="listCompleteApproval" resultType="com.bonus.project.domain.ContEntryExit">
SELECT
lpc.pro_id as proId,
lpc.cont_uuid as consUuid,
lpc.sup_uuid as supUuid,
lpc.uuid as uuid,
ppi.pro_name as proName,
pci.cont_name as contName,
lpc.out_status as intoStatus,
'0' as status,
lpc.task_id_out as taskId,
lpc.proc_inst_id_out as procInsId,
lpc.end_date as endDate
FROM lk_pro_cont lpc
LEFT JOIN pt_project_info ppi ON lpc.pro_id = ppi.pro_id AND ppi.is_active = '1'
LEFT JOIN pt_cont_info pci ON lpc.cont_uuid = pci.uuid AND pci.is_active = '1'
WHERE
lpc.into_status = '3'
AND lpc.start_status = '3'
AND lpc.out_status != '0'
<if test="userType != 00 or userType != 00">
AND lpc.pro_id = #{proId}
</if>
<if test="userType == '01' or userType == 01">
AND lpc.sup_uuid = #{supUuid}
</if>
<if test="status != null and status != '' and status != 1 and status != '1' and status != '2' and status != 2 ">
AND lpc.out_status = #{status}
</if>
<if test="status == 1 or status == '1' or status == '2' and status == 2 ">
AND lpc.out_status = '1' OR lpc.out_status = '2'
</if>
<if test="proId != null and proId != ''">
AND lpc.pro_id = #{proId}
</if>
<if test="consUuid != null and consUuid != ''">
AND lpc.cont_uuid = #{consUuid}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
ppi.pro_name LIKE CONCAT('%',#{keyWord},'%')
OR pci.cont_name LIKE CONCAT('%',#{keyWord},'%')
)
</if>
</select>
</mapper>