replace into bm_worker
(`id_number`, `name`, `sex`, `ethnic`,`birthday`, `address`, `issueauthority`,
`sign_date`, `expiry_date`, `phone`, is_twins, is_active)
values
(#{params.idNumber},#{params.name},#{params.sex},#{params.ethnic},
#{params.birthday},#{params.address},#{params.issueauthority},
#{params.signDate},#{params.expiryDate},#{params.phone},'0', 1)
replace into bm_worker_payroll(id_number,upload_time, BANK_CARD, BANK_NAME, ROLL_BANK_NAME,
bankAffiliated, upload_id, is_active)
values(#{idNumber}, now(), #{bankCard}, #{bankName},
#{wageBankSubBranchName}, #{bankAffiliated}, #{userId}, 1)
replace into bm_worker_contract
(id,idCard,`name`,`post`, contractCode, laborContractType, role, contractValidDate, contractInvalidDate,
contractType, wageApprovedWay, wageCriterion, miurInsurance, whetherOnJob, endowmentInsurance
,is_audit
)
values (#{contractId}, #{idNumber},#{name}, #{postId},#{contractCode}, #{laborContractType}, #{role}, #{contractValidDate},
#{contractInvalidDate},
#{contractType}, #{wageApprovedWay}, #{wageCriterion}, #{miurInsurance}, #{isJob},
#{endowmentInsurance}
,1
)
insert into bm_worker_contract
(id,idCard,`name`,`post`, contractCode, laborContractType, role, contractValidDate, contractInvalidDate,
contractType, wageApprovedWay, wageCriterion, miurInsurance, whetherOnJob, endowmentInsurance
,is_audit
)
select #{contractId}, #{idNumber},#{name}, #{postId},#{contractCode}, #{laborContractType}, #{role}, #{contractValidDate},
#{contractInvalidDate},
#{contractType}, #{wageApprovedWay}, #{wageCriterion}, #{miurInsurance}, #{whetherOnJob},
#{endowmentInsurance}
,1
from dual
where NOT EXISTS (
select * from bm_worker_contract where id = #{contractId}
);
insert into bm_worker_witness(id_number,witness_path,witness_type, upload_date,
upload_time, upload_id, is_active
,contract_id
)
values(#{idNumber},#{wageCardPath}, #{fileType}, CURDATE(), now(), #{userId}, 1
,#{contractId}
)
replace into bm_worker_record(ID_NUMBER,SUB_ID,ORG_ID,PROJECT_ID,TEAM_ID,POST_ID,EIN_DATE,EIN_TIME,
WHETHER_ONJOB, PE_STATUS, SAFETY_SCORE, TEAM_CAPTAIN, FOREMAN, FOREMAN_PHONE, FOREMAN_IDNUMBER,
PRINCIPAL_NAME, PRINCIPAL_IDNUMBER, PRINCIPAL_PHONE, ein_status,IS_ACTIVE)
values(#{idNumber},#{subId},#{orgId},#{proId},#{teamId},#{postId},CURDATE(),now(),
#{whetherOnjob}, #{peStatus}, #{safetyScore}, #{teamCaptain}, #{foreman}, #{foremanPhone},
#{foremanIdNumber}, #{principalName}, #{principalIdNumber}, #{principalPhone},1,1);
replace into bm_worker_attend_history(ID_NUMBER,NAME,ein_time,PROJECT_ID,SUB_ID,ORG_ID,POST_ID,TEAM_ID,IS_ACTIVE, is_short_term)
values(#{idNumber},#{name},now(),#{proId},#{subId},#{orgId},#{postId},#{teamId},1, 0)
replace into bm_worker_photo
(id_number, PHOTO_TYPE, PHOTO_PATH, upload_id
,FACE_FEATURES
,is_active)
values (#{idNumber}, 3, #{facePhoto}, #{userId}
,#{faceFeatureByte}
, 1)
insert into bm_attendance_machine_push(id_number, face_path, attendance_machine_id, operate)
values (#{idNumber}, #{facePhoto}, #{attendanceMachineId}, #{operate});
replace into bm_attendance_machine_push_history(id_number, attendance_machine_id) values
(#{idNumber}, #{attendanceMachineId})
update bm_worker set
`name` = #{name}, `sex` = #{sex}, `ethnic` = #{ethnic}, `birthday` = #{birthday},
`address` = #{address}, `issueauthority` = #{issueauthority},
`sign_date` = #{signDate}, `expiry_date` = #{expiryDate}, `phone` = #{phone}
where id_number = #{idNumber} and is_active = '1';
update bm_worker_record set WHETHER_ONJOB = #{whetherOnjob}, PE_STATUS = #{peStatus},
SAFETY_SCORE = #{safetyScore}, TEAM_CAPTAIN = #{teamCaptain}, FOREMAN = #{foreman},
FOREMAN_PHONE = #{foremanPhone}, FOREMAN_IDNUMBER = #{foremanIdNumber},
PRINCIPAL_NAME = #{principalName}, PRINCIPAL_IDNUMBER = #{principalIdNumber},
PRINCIPAL_PHONE = #{principalPhone}
where id_number = #{idNumber} and is_active = '1';
update bm_worker_payroll set
`bank_card` = #{bankCard},
`bank_name` = #{bankName},
`roll_bank_name` = #{wageBankSubBranchName},
bankAffiliated = #{bankAffiliated}
where id_number = #{idNumber} and is_active = '1'
update bm_worker_ein_history set sub_id = #{subId},
team_id = #{teamId}, post_id = #{postId}
where id_number = #{idNumber} and project_id = #{proId} and is_active = 1