菜品新增修改,重复菜品和编号判断优化
This commit is contained in:
parent
41e65e2a01
commit
882dfd0933
|
|
@ -193,7 +193,10 @@ public class MenuRecipeController extends BaseController {
|
||||||
return ObjectUtil.isNull(excel) ? AjaxResult.error("请选择导入文件 ^_^") :
|
return ObjectUtil.isNull(excel) ? AjaxResult.error("请选择导入文件 ^_^") :
|
||||||
AjaxResult.success(this.menuRecipeService.recipeImportDishes(excel, recipeId));
|
AjaxResult.success(this.menuRecipeService.recipeImportDishes(excel, recipeId));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
throw new ServiceException(e.toString());
|
String message = e.toString();
|
||||||
|
//取倒数第二个:之后的信息
|
||||||
|
String finalMessage = message.substring(message.lastIndexOf(":") - 7);
|
||||||
|
throw new ServiceException(finalMessage.replace("Error:", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -401,15 +401,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
|
|
||||||
<select id="getOneByName" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO" resultMap="MenuDishesResult">
|
<select id="getOneByName" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO" resultMap="MenuDishesResult">
|
||||||
select * from menu_dishes where area_id = #{areaId} and (
|
select * from menu_dishes
|
||||||
dishes_name = #{dishesName}
|
where 1 = 1
|
||||||
) limit 1
|
<if test="areaId != null and areaId != ''">
|
||||||
|
and area_id = #{areaId}
|
||||||
|
</if>
|
||||||
|
and (dishes_name = #{dishesName})
|
||||||
|
<if test="dishesId != null and dishesId != ''">
|
||||||
|
and dishes_id != #{dishesId}
|
||||||
|
</if>
|
||||||
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getOneByNum" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO" resultMap="MenuDishesResult">
|
<select id="getOneByNum" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO" resultMap="MenuDishesResult">
|
||||||
select * from menu_dishes where area_id = #{areaId}
|
select * from menu_dishes where 1 = 1
|
||||||
|
<if test="areaId != null and areaId != ''">
|
||||||
|
and area_id = #{areaId}
|
||||||
|
</if>
|
||||||
<if test="dishesNum !=null and dishesNum !=''">
|
<if test="dishesNum !=null and dishesNum !=''">
|
||||||
and dishes_num =#{dishesNum}
|
and dishes_num =#{dishesNum}
|
||||||
|
</if>
|
||||||
|
<if test="dishesId != null and dishesId != ''">
|
||||||
|
and dishes_id != #{dishesId}
|
||||||
</if>
|
</if>
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue