diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookMaterialController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookMaterialController.java index 622ab1f..a38c49f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookMaterialController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookMaterialController.java @@ -22,7 +22,7 @@ import com.bonus.common.core.web.page.TableDataInfo; /** * 原料信息Controller - * + * * @author xsheng * @date 2025-05-25 */ diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookMaterial.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookMaterial.java index 3f2e8fe..e91e6f7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookMaterial.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookMaterial.java @@ -12,7 +12,7 @@ import java.util.List; /** * 原料信息对象 cook_material - * + * * @author xsheng * @date 2025-05-25 */ @@ -132,4 +132,9 @@ public class CookMaterial extends BaseEntity { @ApiModelProperty(value = "当前库存总数") private BigDecimal materialTotalNum; + + /** + * 在原料中判断是否存在库存 + */ + private String hasInventory; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml index 164dc33..c13f88a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookDishesMapper.xml @@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -124,20 +124,108 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select dishes_id, meal_type, custom_id, inventory_id, dishes_name, alias_name, bar_code, intro, cook_id, type_id,cdt.dishes_type_name, classify_id, - effect_id, style_id, if_local_feature, dishes_depart, sequence, pungency_degree, sales_mode, size_type, size_json, - weight, large_weight, little_weight, weight_deviation, price, unit_price, large_price, little_price, image_url, - particulars, recommend, index_recommend, like_survey, like_batch, like_num, initial_score, calories, protein, fat, - carbohydrate, dietary_fiber, cholesterol, calcium, sodium, purine, iron, iodine, kalium, vitamin_a, vitamin_c, - vitamin_e, magnesium, zinc, glycemic_index, sort, cd.canteen_id,bc.canteen_name,cd.shopstall_id,bs.stall_name, hide_flag, convert_flag, material_cost, - gross_profit, gross_profit_rate, public_dishes, cd.area_id,ba.area_name, meal_id, cd.create_by, cd.create_time, cd.update_by, cd.update_time, - cd.processing_method, cd.processing_time, cd.edible, cd.water, cd.ash, cd.retinol, cd.thiamine, cd.riboflavin, cd.niacin, vitamin_d, - cd.phosphorus, cd.selenium,cd.carotene - from cook_dishes cd - left join basic_area ba on cd.area_id = ba.area_id - left join basic_canteen bc on cd.canteen_id = bc.canteen_id - left join basic_stall bs on cd.shopstall_id = bs.stall_id - left join cook_dishes_type cdt on cd.type_id = cdt.dishes_type_id + SELECT + cd.dishes_id, + meal_type, + custom_id, + cd.inventory_id, + dishes_name, + alias_name, + bar_code, + intro, + cook_id, + type_id, + cdt.dishes_type_name, + classify_id, + effect_id, + style_id, + if_local_feature, + dishes_depart, + sequence, + pungency_degree, + sales_mode, + size_type, + size_json, + cd.weight, + large_weight, + little_weight, + weight_deviation, + price, + unit_price, + large_price, + little_price, + image_url, + particulars, + recommend, + index_recommend, + like_survey, + like_batch, + like_num, + initial_score, + calories, + protein, + fat, + carbohydrate, + dietary_fiber, + cholesterol, + calcium, + sodium, + purine, + iron, + iodine, + kalium, + vitamin_a, + vitamin_c, + vitamin_e, + magnesium, + zinc, + glycemic_index, + sort, + cd.canteen_id, + bc.canteen_name, + cd.shopstall_id, + bs.stall_name, + hide_flag, + convert_flag, + material_cost, + gross_profit, + gross_profit_rate, + public_dishes, + cd.area_id, + ba.area_name, + meal_id, + cd.create_by, + cd.create_time, + cd.update_by, + cd.update_time, + cd.processing_method, + cd.processing_time, + cd.edible, + cd.water, + cd.ash, + cd.retinol, + cd.thiamine, + cd.riboflavin, + cd.niacin, + vitamin_d, + cd.phosphorus, + cd.selenium, + cd.carotene, + CASE + + WHEN iin.material_num IS NOT NULL + AND iin.material_num > 0 THEN + 1 ELSE 0 + END AS has_inventory + FROM + cook_dishes cd + LEFT JOIN cook_dishes_material cdm ON cdm.dishes_id = cd.dishes_id + LEFT JOIN ims_inventory iin ON iin.material_id = cdm.material_id + AND iin.del_flag = 0 + LEFT JOIN basic_area ba ON cd.area_id = ba.area_id + LEFT JOIN basic_canteen bc ON cd.canteen_id = bc.canteen_id + LEFT JOIN basic_stall bs ON cd.shopstall_id = bs.stall_id + LEFT JOIN cook_dishes_type cdt ON cd.type_id = cdt.dishes_type_id - + - \ No newline at end of file + diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookMaterialMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookMaterialMapper.xml index ffbc3d5..44857ef 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookMaterialMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookMaterialMapper.xml @@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -47,8 +48,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.area_id, a.area_name, cm.nutrition_type_id, cnt.nutrition_type_name, iu.unit_name,cm.unit_id, - ii.material_total_num + ii.material_total_num , + CASE + WHEN iin.material_num IS NOT NULL AND iin.material_num > 0 THEN 1 + ELSE 0 + END AS has_inventory from cook_material cm + LEFT JOIN ims_inventory iin ON iin.material_id = cm.material_id and iin.del_flag=0 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 @@ -95,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by cm.create_time desc - +