select id, name, type, methods, create_by, create_time, update_by, update_time from sys_dishes
SELECT * FROM(
SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_unit
FROM sys_dishes_ingredient
WHERE dishes_id = #{id}
) dishes
LEFT JOIN (
SELECT id, name, type, protein_ratio, fat_ratio, carbon_ratio, area, not_rec, rec
FROM sys_ingredient igd
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_not_rec
) notRec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) notRecT USING(id)
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_rec
) rec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) recT USING(id)
) ing USING(id)
insert into sys_dishes
name,type,methods,create_by,create_time,update_by,update_time,#{name},#{type},#{methods},#{createBy},#{createTime},#{updateBy},#{updateTime},
update sys_dishes
name = #{name},type = #{type},methods = #{methods},create_by = #{createBy},create_time = #{createTime},update_by = #{updateBy},update_time = #{updateTime},
where id = #{id}
delete from sys_dishes where id = #{id}
delete from sys_dishes where id in
#{id}
delete from sys_dishes_ingredient where dishes_id = #{id}
delete from sys_dishes_ingredient where dishes_id in
#{id}
insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_weight) values
(#{item.dishesId}, #{item.ingredientId}, #{item.weight}, #{item.cusUnit}, #{item.cusWeight})