select id, external_id, yak_no, ear_tag_number, pasture_id, pasture_name,
farm_external_id, enclosure_external_id, enclosure_id, enclosure_name,
batch_no, batch_external_id, batch_id, entry_cycle,
gender, cattle_variety, cattle_picture, registrant, remark,
birth_date, age_months, entry_date, entry_weight_kg, source, breeding_method,
asset_status, status_change_date, status_change_reason, pen_location,
expected_out_date, supplement_plan, realtime_temp, realtime_steps, env_temp,
location, physio_collect_time, father_yak_no, mother_yak_no,
last_sync_time, del_flag, create_time, update_time
from biz_yak_asset
insert into biz_yak_asset (
external_id, yak_no, ear_tag_number, pasture_id, pasture_name,
farm_external_id, enclosure_external_id, enclosure_id, enclosure_name,
batch_no, batch_external_id, batch_id, entry_cycle,
gender, cattle_variety, cattle_picture, registrant, remark,
birth_date, age_months, entry_date, entry_weight_kg, source, breeding_method,
asset_status, status_change_date, status_change_reason, pen_location,
expected_out_date, supplement_plan, realtime_temp, realtime_steps, env_temp,
location, physio_collect_time, father_yak_no, mother_yak_no,
last_sync_time, del_flag, create_time
) values (
#{externalId}, #{yakNo}, #{earTagNumber}, #{pastureId}, #{pastureName},
#{farmExternalId}, #{enclosureExternalId}, #{enclosureId}, #{enclosureName},
#{batchNo}, #{batchExternalId}, #{batchId}, #{entryCycle},
#{gender}, #{cattleVariety}, #{cattlePicture}, #{registrant}, #{remark},
#{birthDate}, #{ageMonths}, #{entryDate}, #{entryWeightKg}, #{source}, #{breedingMethod},
#{assetStatus}, #{statusChangeDate}, #{statusChangeReason}, #{penLocation},
#{expectedOutDate}, #{supplementPlan}, #{realtimeTemp}, #{realtimeSteps}, #{envTemp},
#{location}, #{physioCollectTime}, #{fatherYakNo}, #{motherYakNo},
#{lastSyncTime}, #{delFlag}, sysdate()
)
update biz_yak_asset set
external_id = #{externalId},
yak_no = #{yakNo},
ear_tag_number = #{earTagNumber},
pasture_id = #{pastureId},
pasture_name = #{pastureName},
farm_external_id = #{farmExternalId},
enclosure_external_id = #{enclosureExternalId},
enclosure_id = #{enclosureId},
enclosure_name = #{enclosureName},
batch_no = #{batchNo},
batch_external_id = #{batchExternalId},
batch_id = #{batchId},
entry_cycle = #{entryCycle},
gender = #{gender},
cattle_variety = #{cattleVariety},
cattle_picture = #{cattlePicture},
registrant = #{registrant},
remark = #{remark},
birth_date = #{birthDate},
age_months = #{ageMonths},
entry_date = #{entryDate},
entry_weight_kg = #{entryWeightKg},
source = #{source},
breeding_method = #{breedingMethod},
asset_status = #{assetStatus},
status_change_date = #{statusChangeDate},
status_change_reason = #{statusChangeReason},
pen_location = #{penLocation},
expected_out_date = #{expectedOutDate},
supplement_plan = #{supplementPlan},
realtime_temp = #{realtimeTemp},
realtime_steps = #{realtimeSteps},
env_temp = #{envTemp},
location = #{location},
physio_collect_time = #{physioCollectTime},
father_yak_no = #{fatherYakNo},
mother_yak_no = #{motherYakNo},
last_sync_time = #{lastSyncTime},
update_time = sysdate()
where id = #{id} and del_flag = '0'