该方法 如果表中没有没有主键对应的数据就添加一条 如果有的话就更新该条数据
<insert id="insertBatch">
REPLACE into representatives_and_principal_personnel
(id,examine_and_approve_id, idcard_number, name, sex, duty, rankv, birth,
standard_culture, workspace, state, phone, have_bad_record, amount_of_contribution)
values
<foreach collection="list" item="representativesAndPrincipalPersonnel" separator=",">
(#{representativesAndPrincipalPersonnel.id},
#{representativesAndPrincipalPersonnel.examine_and_approve_id},
#{representativesAndPrincipalPersonnel.idcard_number},
#{representativesAndPrincipalPersonnel.name},
#{representativesAndPrincipalPersonnel.sex},
#{representativesAndPrincipalPersonnel.duty},
#{representativesAndPrincipalPersonnel.rankv},
#{representativesAndPrincipalPersonnel.birth},
#{representativesAndPrincipalPersonnel.standard_culture},
#{representativesAndPrincipalPersonnel.workspace},
#{representativesAndPrincipalPersonnel.state},
#{representativesAndPrincipalPersonnel.phone},
#{representativesAndPrincipalPersonnel.have_bad_record},
#{representativesAndPrincipalPersonnel.amount_of_contribution})
</foreach>
</insert>

2542





