select id, external_id, yak_no, pasture_id, pasture_name, batch_no, gender, 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, pasture_id, pasture_name, batch_no, gender, 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}, #{pastureId}, #{pastureName}, #{batchNo}, #{gender}, #{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},
pasture_id = #{pastureId},
pasture_name = #{pastureName},
batch_no = #{batchNo},
gender = #{gender},
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'