营养类别等相关接口调试修复
This commit is contained in:
parent
4015c6942f
commit
4fe71a435b
|
|
@ -63,6 +63,7 @@ public class MenuNutrition extends BaseEntity {
|
|||
@ApiModelProperty(value = "类别id")
|
||||
private Long categoryId;
|
||||
|
||||
|
||||
/** 食材大类 */
|
||||
@Excel(name = "食材大类")
|
||||
@ApiModelProperty(value = "食材大类")
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ public class MenuNutritionDTO {
|
|||
private Integer price;
|
||||
@ApiModelProperty("食材颜色")
|
||||
private String color;
|
||||
@ApiModelProperty("食材小类id")
|
||||
private Long categoryId;
|
||||
@ApiModelProperty("食材大类")
|
||||
private @NotNull( message = "{menu_big_type_null}" ) String bigType;
|
||||
@ApiModelProperty("食材小类")
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public class MenuNutritionServiceImpl implements IMenuNutritionService {
|
|||
return menuNutritionMapper.insertMenuNutrition(menuNutrition);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
throw new ServiceException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,23 +60,27 @@ public class MenuNutritionTypeServiceImpl implements IMenuNutritionTypeService {
|
|||
public int insertMenuNutritionType(MenuNutritionType menuNutritionType) {
|
||||
menuNutritionType.setCreateBy(SecurityUtils.getUserId()+"");
|
||||
MenuNutritionType one = menuNutritionTypeMapper.getOne(menuNutritionType);
|
||||
try {
|
||||
if(one !=null ){
|
||||
throw new ServiceException("该营养基础类型已存在");
|
||||
}
|
||||
MenuNutritionType getParentOne = menuNutritionTypeMapper.getParentOne(menuNutritionType);
|
||||
if(getParentOne == null){
|
||||
throw new ServiceException("无效的父级节点");
|
||||
}else{
|
||||
if("2".equals(getParentOne.getLevel())){
|
||||
throw new ServiceException("不允许添加三级节点");
|
||||
}else{
|
||||
menuNutritionType.setLevel("2");
|
||||
}
|
||||
}
|
||||
try {
|
||||
if(menuNutritionType.getParentId() == 0L){
|
||||
return menuNutritionTypeMapper.insertMenuNutritionType(menuNutritionType);
|
||||
}else{
|
||||
if(getParentOne == null){
|
||||
throw new ServiceException("无效的父级节点");
|
||||
}else{
|
||||
if("2".equals(getParentOne.getLevel())){
|
||||
throw new ServiceException("不允许添加三级节点");
|
||||
}else{
|
||||
menuNutritionType.setLevel("2");
|
||||
}
|
||||
}
|
||||
return menuNutritionTypeMapper.insertMenuNutritionType(menuNutritionType);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
or parent_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="selectTypeList" parameterType="String" resultType="String">
|
||||
|
|
|
|||
Loading…
Reference in New Issue