Merge branch 'master' into test417

This commit is contained in:
sxu 2025-04-17 20:17:49 +08:00
commit 198abaa8ae
3 changed files with 25 additions and 7 deletions

View File

@ -200,4 +200,7 @@ public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
List<String> getSnByCanteenId(Long canteenId); List<String> getSnByCanteenId(Long canteenId);
int deleteRecipeByrecipeId(Long recipeId); int deleteRecipeByrecipeId(Long recipeId);
List<Integer> getDeviceIdByDevivce(@Param("canteenId")String canteenId, @Param("stallId")String stallId);
void updateRecipeByCanteeStallMeal(@Param("recipeId")String recipeId, @Param("canteenId")String canteenId, @Param("stallId")String stallId, @Param("deviceIds")List<Integer> deviceIds);
} }

View File

@ -136,6 +136,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
mar.setRecipeId(content.getRecipeId()); mar.setRecipeId(content.getRecipeId());
mar.setMealLineId(content.getMealLineId()); mar.setMealLineId(content.getMealLineId());
mar.setBindType(content.getBindType()); mar.setBindType(content.getBindType());
List<Integer> deviceTypeList = menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()));
if (ObjectUtil.isEmpty(sortEnum)) { if (ObjectUtil.isEmpty(sortEnum)) {
throw new ServiceException(I18n.getMessage("bingType值异常", new Object[0])); throw new ServiceException(I18n.getMessage("bingType值异常", new Object[0]));
} else { } else {
@ -163,15 +164,14 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
appRecipe.setMealLineId(content.getMealLineId()); appRecipe.setMealLineId(content.getMealLineId());
appRecipe.setBindTime(LocalDateTime.now()); appRecipe.setBindTime(LocalDateTime.now());
this.menuRecipeMapper.insert(appRecipe); this.menuRecipeMapper.insert(appRecipe);
if (ObjectUtil.isNotEmpty(deviceTypes)) { if (ObjectUtil.isNotEmpty(deviceTypes) && deviceTypeList!= null && !deviceTypeList.isEmpty()) {
// this.deviceApi.updateRecipeByCanteeStallMeal(content.getRecipeId(), menuRecipe.getCanteenId(), menuRecipe.getStallId(), content.getMealLineId(), deviceTypes); this.menuRecipeMapper.updateRecipeByCanteeStallMeal(String.valueOf(content.getRecipeId()), String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()),deviceTypeList);
} }
MqUtil.sendDataChange(menuRecipe, LeMqConstant.DataChangeType.ADD, LeMqConstant.Topic.DATA_CHANGE_RECIPE_RELEASE); MqUtil.sendDataChange(menuRecipe, LeMqConstant.DataChangeType.ADD, LeMqConstant.Topic.DATA_CHANGE_RECIPE_RELEASE);
} else { } else {
this.menuRecipeMapper.delete(mar); this.menuRecipeMapper.delete(mar);
if (ObjectUtil.isNotEmpty(deviceTypes)) { if (ObjectUtil.isNotEmpty(deviceTypes) && deviceTypeList!= null && !deviceTypeList.isEmpty()) {
// this.deviceApi.deleteRecipeByCanteeStallMeal(content.getRecipeId(), menuRecipe.getCanteenId(), menuRecipe.getStallId(), content.getMealLineId(), deviceTypes); this.menuRecipeMapper.updateRecipeByCanteeStallMeal("-1", String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()), deviceTypeList);
} }
} }

View File

@ -900,13 +900,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<delete id="deleteMenuRecipeDetailByIds"> <delete id="deleteMenuRecipeDetailByIds">
delete from menu_recipe_detail where id in delete from menu_recipe_detail where detail_id in
<foreach item="id" collection="list" open="(" separator="," close=")"> <foreach item="id" collection="list" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteMenuRecipeDishesByIds"> <delete id="deleteMenuRecipeDishesByIds">
delete from menu_recipe_dishes where id in delete from menu_recipe_dishes where detail_id in
<foreach item="id" collection="list" open="(" separator="," close=")"> <foreach item="id" collection="list" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -973,5 +973,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteRecipeByrecipeId"> <delete id="deleteRecipeByrecipeId">
delete from menu_recipe where recipe_id = #{recipeId} delete from menu_recipe where recipe_id = #{recipeId}
</delete> </delete>
<update id="updateRecipeByCanteeStallMeal">
update device_recipe set recipe_id = #{ recipeId}
where canteen_id = #{canteenId} and stall_id = #{stallId}
and device_id in
<foreach collection="deviceIds" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</update>
<select id="getDeviceIdByDevivce" parameterType="string" resultType="integer">
select a.device_id
from device_info a
LEFT JOIN device_bind b on a.device_id = b.device_id
where b.canteen_id = #{canteenId} and b.stall_id = #{stallId}
</select>
</mapper> </mapper>