hd_real_name/target/classes/mappers/push/ContractMapper.xml

147 lines
6.1 KiB
XML
Raw Normal View History

2025-03-17 15:01:27 +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.gzrn.rnbmw.push.dao.contract.ContractDao">
<select id="selectContractPushList"
resultType="com.bonus.gzrn.rnbmw.push.entity.contract.WorkerContractInfoBean">
select
concat('SongBianDianProject', IFNULL(p.pro_old_id,p.id)) as projectId,
p.NAME AS projectName,
concat('SongBianDianTeam', bst.id) as teamId,
bst.NAME AS teamName,
-- concat('SongBianDianTeam', cloud_bst.id) as teamId,
-- cloud_bst.NAME AS teamName,
'贵州送变电有限责任公司' AS orgName,
'9152000021440270X9' AS orgCreditCode,
IFNULL(bwt.name,'其它') as workType,
-- '其它' as workType,
case when
bwci.contractType = '电子合同' then
IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',bwci.person_contract_url),
CONCAT('http://116.63.142.171:1919/gzrnama/',bwci.sub_contract_url)) when
bwci.contractType = '纸质合同' then
contract.contractPath else 'http://npm.org/123.jpg'
end as contractAppendix,
bw.name,bw.ID_NUMBER as idCard,
bwci.contractCode,
-- bwci.role,
'务工人员' as role,
IFNULL(bwci.laborContractType,'以完成一定工作为期限的合同') as laborContractType,
bwci.contractValidDate as contractStartDate,
bwci.contractValidDate,bwci.contractType, p.payDate,
IFNULL(bwci.contractInvalidDate,p.end_time) as contractInvalidDate,
IFNULL(bwci.miurInsurance,'是') as miurInsurance,
IFNULL(bwci.endowmentInsurance,'是') as endowmentInsurance,
bwci.wageApprovedWay,bwci.wageCriterion,'是' as whetherOnJob
from bm_worker_contract bwci
left join bm_worker_contract_details bwcd on bwcd.part_b_idCard = bwci.idCard
left join bm_worker bw on bw.ID_NUMBER = bwci.idCard
left join bm_worker_record bwr on bwr.ID_NUMBER = bwci.idCard
-- left join gz_cloud.bm_worker_record cloud_bwr on cloud_bwr.ID_NUMBER = bwci.idCard
left join bm_project p on p.id = bwr.PROJECT_ID
left join bm_sub_team bst on bst.id = bwr.TEAM_ID
-- left join gz_cloud.bm_sub_team cloud_bst on cloud_bst.id = cloud_bwr.TEAM_ID
left join sys_dic_detail bwt on bwt.id = bwr.POST_ID
left join
(
select ID_NUMBER,GROUP_CONCAT(IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',
witness_path),'http://npm.org/123.jpg')) as contractPath
from bm_worker_witness where witness_type = 1 GROUP BY ID_NUMBER
) contract on contract.ID_NUMBER = bwci.idCard
where bw.name is not null
and if(bwci.contractType = '电子合同', bwcd.is_sign = '1', bwci.contractType = '纸质合同')
<if test="projectId != null and projectId != ''">
and p.id = #{projectId}
</if>
<if test="idCard != null and idCard != ''">
and bwci.idCard = #{idCard}
</if>
and bwt.name != '管理人员'
and bwr.ein_status = 1 and bwr.is_ein_push = 1
and bwci.is_push != '1' and bwci.is_active = 1
GROUP BY bwci.idCard
</select>
<update id="updateContractStatus">
update bm_worker_contract set
is_push = #{status},
push_time = #{nowTime},
push_content = #{result}
where idCard = #{id} and is_active = 1
</update>
<select id="selectChangHuiErrorContractList"
resultType="com.bonus.gzrn.rnbmw.push.entity.contract.WorkerContractInfoBean">
select
concat('SongBianDianProject', IFNULL(p.pro_old_id,p.id)) as projectId,
p.NAME AS projectName,
concat('SongBianDianTeam', bst.id) as teamId,
bst.NAME AS teamName,
'贵州送变电有限责任公司' AS orgName,
'9152000021440270X9' AS orgCreditCode,
IFNULL(bwt.name,'其它') as workType,
case when
bwci.contractType = '电子合同' then
IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',bwci.person_contract_url),
CONCAT('http://116.63.142.171:1919/gzrnama/',bwci.sub_contract_url)) when
bwci.contractType = '纸质合同' then
contract.contractPath else 'http://npm.org/123.jpg'
end as contractAppendix,
bw.name,bw.ID_NUMBER as idCard,
bwci.contractCode,
'务工人员' as role,
IFNULL(bwci.laborContractType,'以完成一定工作为期限的合同') as laborContractType,
bwci.contractValidDate,bwci.contractType,
IFNULL(bwci.contractInvalidDate,p.end_time) as contractInvalidDate,
IFNULL(bwci.miurInsurance,'是') as miurInsurance,
IFNULL(bwci.endowmentInsurance,'是') as endowmentInsurance,
bwci.wageApprovedWay,bwci.wageCriterion,'是' as whetherOnJob
from (
SELECT
bwr.ID_NUMBER,
bwr.PROJECT_ID as PROJECT_ID,
bwr.TEAM_ID,
CASE bwc.push_time
WHEN NULL THEN ''
ELSE bwc.contractCode END AS contractId,
bwr.ein_push_time,
bwr.exit_push_time,
bwc.push_time AS contractPushTime
FROM
bm_worker_record bwr
left join (
select * from (
select * from bm_worker_contract
where is_push = 1 and is_active = 1
ORDER BY is_push DESC limit 1000000000
) a GROUP BY a.idCard
) bwc on bwc.idCard = bwr.ID_NUMBER
WHERE
is_ein_push = 1 and bwc.push_time &gt; '2022-12-03 00:00:00' and ein_push_time &lt; '2022-12-07 18:10:00'
and PROJECT_ID in (10002,256,258,259,260,261,262,263,265,266,267,269,271,272,273,274,276,281)
GROUP BY bwr.ID_NUMBER
) a
left join bm_worker_contract bwci on a.ID_NUMBER = bwci.idCard
left join bm_worker_contract_details bwcd on bwcd.part_b_idCard = bwci.idCard
left join bm_worker bw on bw.ID_NUMBER = bwci.idCard
left join bm_worker_record bwr on bwr.ID_NUMBER = bwci.idCard
left join bm_project p on p.id = bwr.PROJECT_ID
left join bm_sub_team bst on bst.id = bwr.TEAM_ID
left join sys_dic_detail bwt on bwt.id = bwr.POST_ID
left join
(
select ID_NUMBER,GROUP_CONCAT(IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',
witness_path),'http://npm.org/123.jpg')) as contractPath
from bm_worker_witness where witness_type = 1 GROUP BY ID_NUMBER
) contract on contract.ID_NUMBER = bwci.idCard
where bw.name is not null
and if(bwci.contractType = '电子合同', bwcd.is_sign = '1', bwci.contractType = '纸质合同')
and bwt.name != '管理人员'
and bwr.ein_status = 1 and bwr.is_ein_push = 1
and bwci.is_active = 1
GROUP BY bwci.idCard
</select>
</mapper>