select material_id, material_name, material_code,cm.img_url,
cm.goods_type, bar_code,
sale_price, unit_price, sales_mode, shelf_life_type, shelf_life_days,
pur_price_ceiling, big_category_id, size, cm.description,cm.create_by,
cm.create_time, cm.update_by, cm.update_time,
cm.nutrition_id,cn.nutrition_name,
cmt.material_type_id, cmt.material_type_name,
a.area_id, a.area_name,
cm.nutrition_type_id, cnt.nutrition_type_name,
spu.unit_name,cm.unit_id
from cook_material cm
left join cook_material_type cmt on cm.material_type_id = cmt.material_type_id
left join cook_nutrition_type cnt on cm.nutrition_type_id = cnt.nutrition_type_id
left join cook_nutrition cn on cm.nutrition_id = cn.nutrition_id
left join supply_product_unit spu on cm.unit_id = spu.unit_id
left join basic_area a on cm.area_id = a.area_id
insert into cook_material
area_id,
material_name,
material_code,
img_url,
nutrition_id,
material_type_id,
nutrition_type_id,
goods_type,
bar_code,
unit_id,
sale_price,
unit_price,
sales_mode,
shelf_life_type,
shelf_life_days,
pur_price_ceiling,
big_category_id,
size,
description,
create_by,
create_time,
update_by,
update_time,
#{areaId},
#{materialName},
#{materialCode},
#{imgUrl},
#{nutritionId},
#{materialTypeId},
#{nutritionTypeId},
#{goodsType},
#{barCode},
#{unitId},
#{salePrice},
#{unitPrice},
#{salesMode},
#{shelfLifeType},
#{shelfLifeDays},
#{purPriceCeiling},
#{bigCategoryId},
#{size},
#{description},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
update cook_material
area_id = #{areaId},
material_name = #{materialName},
material_code = #{materialCode},
img_url = #{imgUrl},
nutrition_id = #{nutritionId},
material_type_id = #{materialTypeId},
nutrition_type_id = #{nutritionTypeId},
goods_type = #{goodsType},
bar_code = #{barCode},
unit_id = #{unitId},
sale_price = #{salePrice},
unit_price = #{unitPrice},
sales_mode = #{salesMode},
shelf_life_type = #{shelfLifeType},
shelf_life_days = #{shelfLifeDays},
pur_price_ceiling = #{purPriceCeiling},
big_category_id = #{bigCategoryId},
size = #{size},
description = #{description},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
where material_id = #{materialId}
delete from cook_material where material_id = #{materialId}
delete from cook_material where material_id in
#{materialId}