INSERT INTO card_template_person( card_person_id, background_id, card_name, template_id, content, source, card_order, thumbnail, is_main, card_width, card_height, creator, gmt_create, modifier, gmt_modified, is_delete ) VALUES( #{cardPersonId}, #{backgroundId}, #{cardName}, #{templateId}, #{content}, #{source}, #{cardOrder}, #{thumbnail}, #{isMain}, #{cardWidth}, #{cardHeight}, #{creator}, #{gmtCreate}, #{modifier}, #{gmtModified}, #{isDelete} ) UPDATE card_template_person SET gmt_modified = #{gmtModified}, modifier = #{modifier}, is_delete = 1 WHERE card_person_id IN #{templatePersonIds[${index}]} DELETE FROM card_template_person WHERE card_person_id = #{cardPersonId} UPDATE card_template_person SET card_person_id = #{cardPersonId}, background_id = #{backgroundId}, card_name = #{cardName}, template_id = #{templateId}, content = #{content}, source = #{source}, card_order = #{cardOrder}, thumbnail = #{thumbnail}, is_main = #{isMain}, card_width = #{cardWidth}, card_height = #{cardHeight}, creator = #{creator}, gmt_create = #{gmtCreate}, modifier = #{modifier}, is_delete = #{isDelete}, gmt_modified = #{gmtModified} WHERE card_person_id = #{cardPersonId} UPDATE card_template_person SET is_main = 0 WHERE is_delete = 0 AND creator = #{modifier} OR modifier = #{modifier}