select bb.obj_id,
bb.bom_code,
bb.material_code,
bb.material_name,
bb.material_type,
bb.standard_amount,
bb.parent_id,
bb.plant_code,
bb.product_line_code,
bb.is_flag,
bb.created_by,
bb.created_time,
bb.updated_by,
bb.updated_time,
bb.ancestors,
bf.factory_name,
bpl.PRODUCT_LINE_NAME
from base_bominfo bb
left join base_factory bf on bf.factory_code = plant_code
left join BASE_PRODUCTLINE bpl on bpl.PRODUCT_LINE_CODE = bb.product_line_code
SELECT seq_base_bominfo.NEXTVAL as objId FROM DUAL
insert into base_bominfo
obj_id,
bom_code,
material_code,
material_name,
material_type,
standard_amount,
parent_id,
plant_code,
product_line_code,
is_flag,
created_by,
created_time,
updated_by,
updated_time,
ancestors,
#{objId},
#{bomCode},
#{materialCode},
#{materialName},
#{materialType},
#{standardAmount},
#{parentId},
#{plantCode},
#{productLineCode},
#{isFlag},
#{createdBy},
#{createdTime},
#{updatedBy},
#{updatedTime},
#{ancestors},
update base_bominfo
bom_code = #{bomCode},
material_code = #{materialCode},
material_name = #{materialName},
material_type = #{materialType},
standard_amount = #{standardAmount},
parent_id = #{parentId},
plant_code = #{plantCode},
product_line_code = #{productLineCode},
is_flag = #{isFlag},
created_by = #{createdBy},
created_time = #{createdTime},
updated_by = #{updatedBy},
updated_time = #{updatedTime},
ancestors = #{ancestors},
where obj_id = #{objId}
update base_bominfo set ancestors =
when #{item.materialCode} then #{item.ancestors}
where material_code in
#{item.materialCode}
delete from base_bominfo where obj_id = #{objId}
delete from base_bominfo where obj_id in
#{objId}