diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookNutritionController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookNutritionController.java index 8715617..59cb622 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookNutritionController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookNutritionController.java @@ -2,6 +2,8 @@ package com.bonus.canteen.core.cook.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.bonus.canteen.core.cook.vo.NutritionTypeVO; import com.bonus.common.log.enums.OperaType; //import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit; import io.swagger.annotations.Api; @@ -41,7 +43,6 @@ public class CookNutritionController extends BaseController { * 查询食材营养基础信息列表 */ @ApiOperation(value = "查询食材营养基础信息列表") - //@RequiresPermissions("cook:nutrition:list") @GetMapping("/list") public TableDataInfo list(CookNutrition cookNutrition) { startPage(); @@ -53,8 +54,6 @@ public class CookNutritionController extends BaseController { * 导出食材营养基础信息列表 */ @ApiOperation(value = "导出食材营养基础信息列表") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:nutrition:export") @SysLog(title = "食材营养基础信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出食材营养基础信息") @PostMapping("/export") public void export(HttpServletResponse response, CookNutrition cookNutrition) { @@ -67,8 +66,7 @@ public class CookNutritionController extends BaseController { * 获取食材营养基础信息详细信息 */ @ApiOperation(value = "获取食材营养基础信息详细信息") - //@RequiresPermissions("cook:nutrition:query") - @GetMapping(value = "/{nutritionId}") + @GetMapping(value = "/getInfo/{nutritionId}") public AjaxResult getInfo(@PathVariable("nutritionId") Long nutritionId) { return success(cookNutritionService.selectCookNutritionByNutritionId(nutritionId)); } @@ -77,10 +75,8 @@ public class CookNutritionController extends BaseController { * 新增食材营养基础信息 */ @ApiOperation(value = "新增食材营养基础信息") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:nutrition:add") @SysLog(title = "食材营养基础信息", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增食材营养基础信息") - @PostMapping + @PostMapping("/add") public AjaxResult add(@RequestBody CookNutrition cookNutrition) { try { return toAjax(cookNutritionService.insertCookNutrition(cookNutrition)); @@ -93,8 +89,6 @@ public class CookNutritionController extends BaseController { * 修改食材营养基础信息 */ @ApiOperation(value = "修改食材营养基础信息") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:nutrition:edit") @SysLog(title = "食材营养基础信息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改食材营养基础信息") @PostMapping("/edit") public AjaxResult edit(@RequestBody CookNutrition cookNutrition) { @@ -109,11 +103,16 @@ public class CookNutritionController extends BaseController { * 删除食材营养基础信息 */ @ApiOperation(value = "删除食材营养基础信息") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:nutrition:remove") @SysLog(title = "食材营养基础信息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除食材营养基础信息") @PostMapping("/del/{nutritionIds}") public AjaxResult remove(@PathVariable Long[] nutritionIds) { return toAjax(cookNutritionService.deleteCookNutritionByNutritionIds(nutritionIds)); } + + @ApiOperation(value = "根据categoryId获取营养类别集合") + @PostMapping ("/getListByCategoryId") + public AjaxResult getListByCategoryId(@RequestBody CookNutrition menuNutrition) { + List list = cookNutritionService.getListByCategoryId(menuNutrition); + return success(list); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookNutritionTypeController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookNutritionTypeController.java index bd22904..0561667 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookNutritionTypeController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookNutritionTypeController.java @@ -2,6 +2,8 @@ package com.bonus.canteen.core.cook.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.bonus.canteen.core.cook.vo.NutritionTypeVO; import com.bonus.common.log.enums.OperaType; //import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit; import io.swagger.annotations.Api; @@ -41,21 +43,17 @@ public class CookNutritionTypeController extends BaseController { * 查询食材营养基础类型列表 */ @ApiOperation(value = "查询食材营养基础类型列表") - //@RequiresPermissions("cook:type:list") @GetMapping("/list") - public TableDataInfo list(CookNutritionType cookNutritionType) { - startPage(); + public AjaxResult list(CookNutritionType cookNutritionType) { List list = cookNutritionTypeService.selectCookNutritionTypeList(cookNutritionType); - return getDataTable(list); + return AjaxResult.success(list); } /** * 导出食材营养基础类型列表 */ @ApiOperation(value = "导出食材营养基础类型列表") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:type:export") - @SysLog(title = "食材营养基础类型", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出食材营养基础类型") + @SysLog(title = "食材营养基础类型", businessType = OperaType.EXPORT, logType = 1,module = "营养->导出食材营养基础类型") @PostMapping("/export") public void export(HttpServletResponse response, CookNutritionType cookNutritionType) { List list = cookNutritionTypeService.selectCookNutritionTypeList(cookNutritionType); @@ -67,8 +65,7 @@ public class CookNutritionTypeController extends BaseController { * 获取食材营养基础类型详细信息 */ @ApiOperation(value = "获取食材营养基础类型详细信息") - //@RequiresPermissions("cook:type:query") - @GetMapping(value = "/{nutritionTypeId}") + @GetMapping(value = "/getInfo/{nutritionTypeId}") public AjaxResult getInfo(@PathVariable("nutritionTypeId") Long nutritionTypeId) { return success(cookNutritionTypeService.selectCookNutritionTypeByNutritionTypeId(nutritionTypeId)); } @@ -77,10 +74,8 @@ public class CookNutritionTypeController extends BaseController { * 新增食材营养基础类型 */ @ApiOperation(value = "新增食材营养基础类型") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:type:add") - @SysLog(title = "食材营养基础类型", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增食材营养基础类型") - @PostMapping + @SysLog(title = "食材营养基础类型", businessType = OperaType.INSERT, logType = 1,module = "营养->新增食材营养基础类型") + @PostMapping("/add") public AjaxResult add(@RequestBody CookNutritionType cookNutritionType) { try { return toAjax(cookNutritionTypeService.insertCookNutritionType(cookNutritionType)); @@ -93,9 +88,7 @@ public class CookNutritionTypeController extends BaseController { * 修改食材营养基础类型 */ @ApiOperation(value = "修改食材营养基础类型") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:type:edit") - @SysLog(title = "食材营养基础类型", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改食材营养基础类型") + @SysLog(title = "食材营养基础类型", businessType = OperaType.UPDATE, logType = 1,module = "营养->修改食材营养基础类型") @PostMapping("/edit") public AjaxResult edit(@RequestBody CookNutritionType cookNutritionType) { try { @@ -109,11 +102,19 @@ public class CookNutritionTypeController extends BaseController { * 删除食材营养基础类型 */ @ApiOperation(value = "删除食材营养基础类型") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:type:remove") - @SysLog(title = "食材营养基础类型", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除食材营养基础类型") + @SysLog(title = "食材营养基础类型", businessType = OperaType.DELETE, logType = 1,module = "营养->删除食材营养基础类型") @PostMapping("/del/{nutritionTypeIds}") public AjaxResult remove(@PathVariable Long[] nutritionTypeIds) { return toAjax(cookNutritionTypeService.deleteCookNutritionTypeByNutritionTypeIds(nutritionTypeIds)); } + + + @PostMapping({"/nutritionTypeList"}) + @ApiOperation("获取所有食材类别") + @SysLog(title = "营养基础类型", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除营养基础类型") + public AjaxResult getNutritionTypeList() { + List nutritionTypeList = this.cookNutritionTypeService.getNutritionTypeList(); + return AjaxResult.success(nutritionTypeList); + } + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookNutrition.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookNutrition.java index a73d206..baf07cb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookNutrition.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookNutrition.java @@ -1,6 +1,8 @@ package com.bonus.canteen.core.cook.domain; import java.math.BigDecimal; +import java.util.List; + import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -19,7 +21,7 @@ import com.bonus.common.core.web.domain.BaseEntity; @ToString public class CookNutrition extends BaseEntity { private static final long serialVersionUID = 1L; - + private List nutritionTypeIds; /** 食材营养id */ private Long nutritionId; @@ -27,17 +29,36 @@ public class CookNutrition extends BaseEntity { @Excel(name = "食材名称") @ApiModelProperty(value = "食材名称") private String nutritionName; + /** 类别id */ + @ApiModelProperty(value = "类别id") + private Long categoryId; + @ApiModelProperty(value = "类别ids") + private Long[] categoryIds; /** 食材编码 */ @Excel(name = "食材编码") @ApiModelProperty(value = "食材编码") private String nutritionCode; - - /** 类别id */ - @Excel(name = "类别id") @ApiModelProperty(value = "类别id") private Long nutritionTypeId; + @Excel(name = "类别名称") + @ApiModelProperty(value = "小类名称") + private String nutritionTypeName; + /** 类别id */ + @ApiModelProperty(value = "小类id") + private Long smallTypeId; + + @Excel(name = "小类名称") + @ApiModelProperty(value = "小类名称") + private String smallTypeName; + @ApiModelProperty(value = "大类id") + private Long bigTypeId; + + @Excel(name = "大类名称") + @ApiModelProperty(value = "大类名称") + private String bigTypeName; + /** 食材图片url */ @Excel(name = "食材图片url") @ApiModelProperty(value = "食材图片url") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookNutritionMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookNutritionMapper.java index 6ae75b3..bbdc74b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookNutritionMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookNutritionMapper.java @@ -2,6 +2,7 @@ package com.bonus.canteen.core.cook.mapper; import java.util.List; import com.bonus.canteen.core.cook.domain.CookNutrition; +import com.bonus.canteen.core.cook.vo.NutritionTypeVO; /** * 食材营养基础信息Mapper接口 @@ -57,4 +58,18 @@ public interface CookNutritionMapper { * @return 结果 */ public int deleteCookNutritionByNutritionIds(Long[] nutritionIds); + /** + * 检查食材营养基础信息是否存在 + * + * @param nutritionId 食材营养基础信息主键 + * @return 结果 + */ + public int checkIsExist(Long nutritionId); + + /** + * 根据categoryId获取营养类别集合 + * @param menuNutrition 食材营养信息 + * @return 营养类别集合 + */ + public List getListByCategoryId(CookNutrition menuNutrition); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookNutritionTypeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookNutritionTypeMapper.java index 76ff61c..c12f798 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookNutritionTypeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookNutritionTypeMapper.java @@ -2,6 +2,8 @@ package com.bonus.canteen.core.cook.mapper; import java.util.List; import com.bonus.canteen.core.cook.domain.CookNutritionType; +import com.bonus.canteen.core.cook.vo.NutritionTypeVO; +import org.apache.ibatis.annotations.Param; /** * 食材营养基础类型Mapper接口 @@ -57,4 +59,30 @@ public interface CookNutritionTypeMapper { * @return 结果 */ public int deleteCookNutritionTypeByNutritionTypeIds(Long[] nutritionTypeIds); + /** + * 根据名称查询食材营养基础类型 + * + * @param nutritionTypeName 食材营养基础类型名称 + * @param nutritionTypeId 食材营养基础类型id + * @return 食材营养基础类型 + */ + CookNutritionType selectCookNutritionTypeByNutritionTypeName(@Param("nutritionTypeName") String nutritionTypeName, @Param("nutritionTypeId") Long nutritionTypeId); + /** + * 根据id查询食材营养基础类型是否存在子级 + * + * @param nutritionTypeIds 食材营养基础类型id + * @return 结果 + */ + int checkIsExistChildren(@Param("nutritionTypeIds") Long[] nutritionTypeIds); + + /** + * 获取所有食材类别 + * @return 食材类别列表 + */ + public List selectBigTypeList(); + /** + * 获取所有食材小类 + * @return 食材小类列表 + */ + public List selectLittleTypeList(String id); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookNutritionService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookNutritionService.java index 84ba839..30beec2 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookNutritionService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookNutritionService.java @@ -2,6 +2,7 @@ package com.bonus.canteen.core.cook.service; import java.util.List; import com.bonus.canteen.core.cook.domain.CookNutrition; +import com.bonus.canteen.core.cook.vo.NutritionTypeVO; /** * 食材营养基础信息Service接口 @@ -57,4 +58,11 @@ public interface ICookNutritionService { * @return 结果 */ public int deleteCookNutritionByNutritionId(Long nutritionId); + + /** + * 根据categoryId获取营养类别集合 + * @param menuNutrition 食材营养信息 + * @return 营养类别集合 + */ + public List getListByCategoryId(CookNutrition menuNutrition); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookNutritionTypeService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookNutritionTypeService.java index 403d188..d9ca9d7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookNutritionTypeService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookNutritionTypeService.java @@ -2,6 +2,7 @@ package com.bonus.canteen.core.cook.service; import java.util.List; import com.bonus.canteen.core.cook.domain.CookNutritionType; +import com.bonus.canteen.core.cook.vo.NutritionTypeVO; /** * 食材营养基础类型Service接口 @@ -51,10 +52,8 @@ public interface ICookNutritionTypeService { public int deleteCookNutritionTypeByNutritionTypeIds(Long[] nutritionTypeIds); /** - * 删除食材营养基础类型信息 - * - * @param nutritionTypeId 食材营养基础类型主键 - * @return 结果 + * 获取所有食材类别 + * @return 食材类别列表 */ - public int deleteCookNutritionTypeByNutritionTypeId(Long nutritionTypeId); + public List getNutritionTypeList(); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionServiceImpl.java index 36d1460..fa728ce 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionServiceImpl.java @@ -1,6 +1,10 @@ package com.bonus.canteen.core.cook.service.impl; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; + +import com.bonus.canteen.core.cook.vo.NutritionTypeVO; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -82,6 +86,13 @@ public class CookNutritionServiceImpl implements ICookNutritionService { */ @Override public int deleteCookNutritionByNutritionIds(Long[] nutritionIds) { + //判断营养基础信息是否被关联 + for (Long nutritionId : nutritionIds) { + int code = cookNutritionMapper.checkIsExist(nutritionId); + if (code > 0) { + throw new ServiceException("存在关联数据,不允许删除!"); + } + } return cookNutritionMapper.deleteCookNutritionByNutritionIds(nutritionIds); } @@ -95,4 +106,17 @@ public class CookNutritionServiceImpl implements ICookNutritionService { public int deleteCookNutritionByNutritionId(Long nutritionId) { return cookNutritionMapper.deleteCookNutritionByNutritionId(nutritionId); } + + /** + * 根据categoryId获取营养类别集合 + * + * @param menuNutrition 食材营养信息 + * @return 营养类别集合 + */ + @Override + public List getListByCategoryId(CookNutrition menuNutrition) { + return cookNutritionMapper.getListByCategoryId(menuNutrition); + } + + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionTypeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionTypeServiceImpl.java index 98592da..04fab68 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionTypeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionTypeServiceImpl.java @@ -1,6 +1,9 @@ package com.bonus.canteen.core.cook.service.impl; +import java.util.ArrayList; import java.util.List; + +import com.bonus.canteen.core.cook.vo.NutritionTypeVO; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -52,6 +55,17 @@ public class CookNutritionTypeServiceImpl implements ICookNutritionTypeService { public int insertCookNutritionType(CookNutritionType cookNutritionType) { cookNutritionType.setCreateTime(DateUtils.getNowDate()); try { + if (cookNutritionType.getParentId() == null){ + cookNutritionType.setParentId(0L); + cookNutritionType.setLevel("0"); + }else{ + cookNutritionType.setLevel("1"); + } + //判断名称是否重复 + CookNutritionType nutritionType = cookNutritionTypeMapper.selectCookNutritionTypeByNutritionTypeName(cookNutritionType.getNutritionTypeName(),null); + if (nutritionType != null) { + throw new ServiceException("营养类别名称重复"); + } return cookNutritionTypeMapper.insertCookNutritionType(cookNutritionType); } catch (Exception e) { throw new ServiceException(e.getMessage()); @@ -68,6 +82,17 @@ public class CookNutritionTypeServiceImpl implements ICookNutritionTypeService { public int updateCookNutritionType(CookNutritionType cookNutritionType) { cookNutritionType.setUpdateTime(DateUtils.getNowDate()); try { + if (cookNutritionType.getParentId() == null){ + cookNutritionType.setParentId(0L); + cookNutritionType.setLevel("1"); + }else{ + cookNutritionType.setLevel("2"); + } + //判断名称是否重复 + CookNutritionType nutritionType = cookNutritionTypeMapper.selectCookNutritionTypeByNutritionTypeName(cookNutritionType.getNutritionTypeName(),cookNutritionType.getNutritionTypeId()); + if (nutritionType != null) { + throw new ServiceException("营养类别名称重复"); + } return cookNutritionTypeMapper.updateCookNutritionType(cookNutritionType); } catch (Exception e) { throw new ServiceException(e.getMessage()); @@ -82,17 +107,32 @@ public class CookNutritionTypeServiceImpl implements ICookNutritionTypeService { */ @Override public int deleteCookNutritionTypeByNutritionTypeIds(Long[] nutritionTypeIds) { + // 检查是否有食材使用该营养类型子集 + int code = cookNutritionTypeMapper.checkIsExistChildren(nutritionTypeIds); + if (code > 0) { + throw new ServiceException("删除失败,营养类型下存在子集"); + } return cookNutritionTypeMapper.deleteCookNutritionTypeByNutritionTypeIds(nutritionTypeIds); } /** - * 删除食材营养基础类型信息 - * - * @param nutritionTypeId 食材营养基础类型主键 - * @return 结果 + * 获取所有食材类别 + * + * @return 食材类别列表 */ @Override - public int deleteCookNutritionTypeByNutritionTypeId(Long nutritionTypeId) { - return cookNutritionTypeMapper.deleteCookNutritionTypeByNutritionTypeId(nutritionTypeId); + public List getNutritionTypeList() { + List bigTypeList =cookNutritionTypeMapper.selectBigTypeList(); + List nutritionTypeVOList = new ArrayList<>(); + for(NutritionTypeVO bean : bigTypeList){ + NutritionTypeVO nutritionTypeVO = new NutritionTypeVO(); + List littleTypeList = cookNutritionTypeMapper.selectLittleTypeList(bean.getId()+""); + nutritionTypeVO.setId(Integer.parseInt(bean.getId()+"")); + nutritionTypeVO.setName(bean.getName()); + nutritionTypeVO.setLittleTypeList(littleTypeList); + nutritionTypeVOList.add(nutritionTypeVO); + } + + return nutritionTypeVOList; } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/NutritionTypeVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/NutritionTypeVO.java new file mode 100644 index 0000000..8478d81 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/NutritionTypeVO.java @@ -0,0 +1,16 @@ +package com.bonus.canteen.core.cook.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; +@Data +public class NutritionTypeVO { + + @ApiModelProperty("唯一标识") + private Integer id; + @ApiModelProperty("小类集合") + private List littleTypeList; + @ApiModelProperty("名称") + private String name; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookNutritionMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookNutritionMapper.xml index da581cf..5fd1ab1 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookNutritionMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookNutritionMapper.xml @@ -7,7 +7,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -101,107 +100,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + - select nutrition_id, nutrition_name, nutrition_code, nutrition_type_id, img_url, weight, price, color, label, processing_method, processing_time, recommended_combination, combination_not_recommended, edible, water, calories, protein, fat, carbohydrate, dietary_fiber, cholesterol, ash, vitamin_a, carotene, thiamine, riboflavin, niacin, vitamin_c, vitamin_d, vitamin_e, choline, biotin, pantothenic_acid, guanine, adenine, hypoxanthine, xanthine, purine, glycemic_index, total_phytosterol_content, cereal_sterol, camelia_sterol, sterol, cereal_steranol, rapesanol, rapeseed_steranol, lutein_zeaxanthin, quercetin, myricetin, luteolin, kaem_pferol, apigenin, isoflavone, daidzein, genistein, glycitein, anthocyan, resveratrol, polydatin, origin_place, calcium, phosphorus, kalium, sodium, magnesium, iron, zinc, selenium, cuprum, manganese, isoleucine, leucine, lysine, saa_total, aaa_total, threonine, tryptophan, valine, arginine, histidine, alanine, aspartic_acid, glutamate, glycine, proline, serine, fatty_acid, saturated_fatty_acid, monounsaturated_fatty_acid, polyunsaturated_fatty_acid, iodine, folic, retinol, create_by, create_time, update_by, update_time from cook_nutrition + select cn.nutrition_id, nutrition_name, nutrition_code, img_url, weight, price, color, label, + processing_method, processing_time, recommended_combination, combination_not_recommended, edible, water, + calories, protein, fat, carbohydrate, dietary_fiber, cholesterol, ash, vitamin_a, carotene, thiamine, + riboflavin, niacin, vitamin_c, vitamin_d, vitamin_e, choline, biotin, pantothenic_acid, guanine, adenine, + hypoxanthine, xanthine, purine, glycemic_index, total_phytosterol_content, cereal_sterol, camelia_sterol, + sterol, cereal_steranol, rapesanol, rapeseed_steranol, lutein_zeaxanthin, quercetin, myricetin, luteolin, + kaem_pferol, apigenin, isoflavone, daidzein, genistein, glycitein, anthocyan, resveratrol, polydatin, + origin_place, calcium, phosphorus, kalium, sodium, magnesium, iron, zinc, selenium, cuprum, manganese, + isoleucine, leucine, lysine, saa_total, aaa_total, threonine, tryptophan, valine, arginine, histidine, + alanine, aspartic_acid, glutamate, glycine, proline, serine, fatty_acid, saturated_fatty_acid, + monounsaturated_fatty_acid, polyunsaturated_fatty_acid, iodine, folic, retinol, cn.create_by, cn.create_time, + cn.update_by, cn.update_time, + cnt.nutrition_type_id as small_type_id, cnt.nutrition_type_name as small_type_name, + cnt1.nutrition_type_id as big_type_id, cnt1.nutrition_type_name as big_type_name + from cook_nutrition cn + left join cook_nutrition_type cnt on cn.nutrition_type_id = cnt.nutrition_type_id + left join cook_nutrition_type cnt1 on cnt1.nutrition_type_id = cnt.parent_id @@ -209,7 +145,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where nutrition_id = #{nutritionId} - + + + + insert into cook_nutrition diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookNutritionTypeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookNutritionTypeMapper.xml index 6d77b1d..bfe9d2e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookNutritionTypeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookNutritionTypeMapper.xml @@ -31,7 +31,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where nutrition_type_id = #{nutritionTypeId} - + + + + insert into cook_nutrition_type