select sm.id,
sm.sheep_id,
sm.user_id,
sm.dept_id,
bs.manage_tags,
ds.id as sheepfold_id,
ds.sheepfold_name,
bsv.id as variety_id,
bsv.variety as variety_name,
'体尺测量' as event_type,
bst.name as sheep_type_name,
sm.measure_date,
bs.gender,
bs.parity,
bs.birth_weight as birth_weight,
bs.weaning_weight as weaning_weight,
sm.current_weight as current_weight,
sm.height,
sm.bust,
sm.body_length,
sm.pipe_length,
sm.chest_depth,
sm.hip_height,
sm.rump_width,
sm.rump_heignt,
sm.hip_width,
sm.hip_cross_height,
sm.month_age,
sm.breast_depth,
sm.breast_position,
sm.breast_length,
sm.breast_adbere,
sm.breast_spacing,
sm.breast_score,
sm.body_score,
sm.lactation_day,
sm.gestation_day,
sm.post_mating_day,
bbs.breed as breed_status_name,
sm.comment,
sm.technician,
sm.create_by,
sm.create_time
from sc_body_measure sm
LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.id
LEFT JOIN bas_breed_status bbs ON bs.breed_status_id = bbs.id
LEFT JOIN da_sheepfold ds ON bs.sheepfold_id = ds.id
LEFT JOIN bas_sheep_type bst ON bs.type_id = bst.id
LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.id
insert into sc_body_measure
sheep_id,
measure_date,
height,
bust,
body_length,
pipe_length,
chest_depth,
hip_height,
rump_width,
rump_heignt,
current_weight,
hip_width,
hip_cross_height,
month_age,
breast_depth,
breast_position,
breast_length,
breast_adbere,
breast_spacing,
breast_score,
body_score,
lactation_day,
gestation_day,
post_mating_day,
comment,
technician,
create_by,
create_time,
user_id,
dept_id,
#{sheepId},
#{measureDate},
#{height},
#{bust},
#{bodyLength},
#{pipeLength},
#{chestDepth},
#{hipHeight},
#{rumpWidth},
#{rumpHeignt},
#{currentWeight},
#{hipWidth},
#{hipCrossHeight},
#{monthAge},
#{breastDepth},
#{breastPosition},
#{breastLength},
#{breastAdbere},
#{breastSpacing},
#{breastScore},
#{bodyScore},
#{lactationDay},
#{gestationDay},
#{postMatingDay},
#{comment},
#{technician},
#{createBy},
#{createTime},
#{userId},
#{deptId},
update sc_body_measure
sheep_id = #{sheepId},
measure_date = #{measureDate},
height = #{height},
bust = #{bust},
body_length = #{bodyLength},
pipe_length = #{pipeLength},
chest_depth = #{chestDepth},
hip_height = #{hipHeight},
rump_width = #{rumpWidth},
rump_heignt = #{rumpHeignt},
current_weight = #{currentWeight},
hip_width = #{hipWidth},
hip_cross_height = #{hipCrossHeight},
month_age = #{monthAge},
breast_depth = #{breastDepth},
breast_position = #{breastPosition},
breast_length = #{breastLength},
breast_adbere = #{breastAdbere},
breast_spacing = #{breastSpacing},
breast_score = #{breastScore},
body_score = #{bodyScore},
lactation_day = #{lactationDay},
gestation_day = #{gestationDay},
post_mating_day = #{postMatingDay},
comment = #{comment},
technician = #{technician},
create_by = #{createBy},
create_time = #{createTime},
where id = #{id}
delete
from sc_body_measure
where id = #{id}
delete from sc_body_measure where id in
#{id}