INSERT IGNORE INTO gen_home_person( home_person_id, healthy, relationship_with_home_people, leading_healthy, annual_income_family, home_person_type, difficulty, leading_address, annual_income_self, base_id, leading_phone, leading_card, help_situation, people_same_census, leading_name, creator, gmt_create, modifier, gmt_modified, is_delete ) SELECT #{homePersonId}, #{healthy}, #{relationshipWithHomePeople}, #{leadingHealthy}, #{annualIncomeFamily}, #{homePersonType}, #{difficulty}, #{leadingAddress}, #{annualIncomeSelf}, #{baseId}, #{leadingPhone}, #{leadingCard}, #{helpSituation}, #{peopleSameCensus}, #{leadingName}, #{creator}, #{gmtCreate}, #{modifier}, #{gmtModified}, #{isDelete} FROM DUAL WHERE NOT EXISTS ( SELECT * FROM gen_home_person WHERE base_id = #{baseId} AND is_delete = 0 ) INSERT IGNORE INTO gen_home_person( home_person_id, healthy, relationship_with_home_people, leading_healthy, annual_income_family, home_person_type, difficulty, leading_address, annual_income_self, base_id, leading_phone, leading_card, help_situation, people_same_census, leading_name, creator, gmt_create, modifier, gmt_modified, is_delete ) SELECT #{item.homePersonId}, #{item.healthy}, #{item.relationshipWithHomePeople}, #{item.leadingHealthy}, #{item.annualIncomeFamily}, #{item.homePersonType}, #{item.difficulty}, #{item.leadingAddress}, #{item.annualIncomeSelf}, #{item.baseId}, #{item.leadingPhone}, #{item.leadingCard}, #{item.helpSituation}, #{item.peopleSameCensus}, #{item.leadingName}, #{item.creator}, #{item.gmtCreate}, #{item.modifier}, #{item.gmtModified}, #{item.isDelete} FROM DUAL WHERE NOT EXISTS ( SELECT * FROM gen_home_person WHERE base_id = #{item.baseId} AND is_delete = 0 ) UPDATE gen_home_person SET is_delete = 1, modifier = #{modifier}, gmt_modified = #{gmtModified} WHERE home_person_id IN #{homePersonIds[${index}]} DELETE FROM gen_home_person WHERE home_person_id IN #{homePersonIds[${index}]} UPDATE gen_home_person SET healthy = #{healthy}, relationship_with_home_people = #{relationshipWithHomePeople}, leading_healthy = #{leadingHealthy}, annual_income_family = #{annualIncomeFamily}, home_person_type = #{homePersonType}, difficulty = #{difficulty}, leading_address = #{leadingAddress}, annual_income_self = #{annualIncomeSelf}, base_id = #{baseId}, leading_phone = #{leadingPhone}, leading_card = #{leadingCard}, help_situation = #{helpSituation}, people_same_census = #{peopleSameCensus}, leading_name = #{leadingName}, modifier = #{modifier}, gmt_modified = #{gmtModified} WHERE home_person_id = #{homePersonId}