食堂:营养信息及营养类别

This commit is contained in:
jjLv 2025-05-27 13:35:44 +08:00
parent e3f241575f
commit a777d11def
12 changed files with 259 additions and 143 deletions

View File

@ -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<CookNutrition> list = cookNutritionService.getListByCategoryId(menuNutrition);
return success(list);
}
}

View File

@ -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<CookNutritionType> 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<CookNutritionType> 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<NutritionTypeVO> nutritionTypeList = this.cookNutritionTypeService.getNutritionTypeList();
return AjaxResult.success(nutritionTypeList);
}
}

View File

@ -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<Long> 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")

View File

@ -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<CookNutrition> getListByCategoryId(CookNutrition menuNutrition);
}

View File

@ -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<NutritionTypeVO> selectBigTypeList();
/**
* 获取所有食材小类
* @return 食材小类列表
*/
public List<NutritionTypeVO> selectLittleTypeList(String id);
}

View File

@ -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<CookNutrition> getListByCategoryId(CookNutrition menuNutrition);
}

View File

@ -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<NutritionTypeVO> getNutritionTypeList();
}

View File

@ -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<CookNutrition> getListByCategoryId(CookNutrition menuNutrition) {
return cookNutritionMapper.getListByCategoryId(menuNutrition);
}
}

View File

@ -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<NutritionTypeVO> getNutritionTypeList() {
List<NutritionTypeVO> bigTypeList =cookNutritionTypeMapper.selectBigTypeList();
List<NutritionTypeVO> nutritionTypeVOList = new ArrayList<>();
for(NutritionTypeVO bean : bigTypeList){
NutritionTypeVO nutritionTypeVO = new NutritionTypeVO();
List<NutritionTypeVO> littleTypeList = cookNutritionTypeMapper.selectLittleTypeList(bean.getId()+"");
nutritionTypeVO.setId(Integer.parseInt(bean.getId()+""));
nutritionTypeVO.setName(bean.getName());
nutritionTypeVO.setLittleTypeList(littleTypeList);
nutritionTypeVOList.add(nutritionTypeVO);
}
return nutritionTypeVOList;
}
}

View File

@ -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<NutritionTypeVO> littleTypeList;
@ApiModelProperty("名称")
private String name;
}

View File

@ -7,7 +7,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="nutritionId" column="nutrition_id" />
<result property="nutritionName" column="nutrition_name" />
<result property="nutritionCode" column="nutrition_code" />
<result property="nutritionTypeId" column="nutrition_type_id" />
<result property="imgUrl" column="img_url" />
<result property="weight" column="weight" />
<result property="price" column="price" />
@ -101,107 +100,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="smallTypeName" column="small_type_name" />
<result property="smallTypeId" column="small_type_id" />
<result property="bigTypeName" column="big_type_name" />
<result property="bigTypeId" column="big_type_id" />
</resultMap>
<sql id="selectCookNutritionVo">
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
</sql>
<select id="selectCookNutritionList" parameterType="com.bonus.canteen.core.cook.domain.CookNutrition" resultMap="CookNutritionResult">
<include refid="selectCookNutritionVo"/>
<where>
<if test="nutritionName != null and nutritionName != ''"> and nutrition_name like concat('%', #{nutritionName}, '%')</if>
<if test="nutritionCode != null and nutritionCode != ''"> and nutrition_code = #{nutritionCode}</if>
<if test="nutritionTypeId != null "> and nutrition_type_id = #{nutritionTypeId}</if>
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
<if test="weight != null "> and weight = #{weight}</if>
<if test="price != null "> and price = #{price}</if>
<if test="color != null and color != ''"> and color = #{color}</if>
<if test="label != null and label != ''"> and label = #{label}</if>
<if test="processingMethod != null and processingMethod != ''"> and processing_method = #{processingMethod}</if>
<if test="processingTime != null "> and processing_time = #{processingTime}</if>
<if test="recommendedCombination != null and recommendedCombination != ''"> and recommended_combination = #{recommendedCombination}</if>
<if test="combinationNotRecommended != null and combinationNotRecommended != ''"> and combination_not_recommended = #{combinationNotRecommended}</if>
<if test="edible != null "> and edible = #{edible}</if>
<if test="water != null "> and water = #{water}</if>
<if test="calories != null "> and calories = #{calories}</if>
<if test="protein != null "> and protein = #{protein}</if>
<if test="fat != null "> and fat = #{fat}</if>
<if test="carbohydrate != null "> and carbohydrate = #{carbohydrate}</if>
<if test="dietaryFiber != null "> and dietary_fiber = #{dietaryFiber}</if>
<if test="cholesterol != null "> and cholesterol = #{cholesterol}</if>
<if test="ash != null "> and ash = #{ash}</if>
<if test="vitaminA != null "> and vitamin_a = #{vitaminA}</if>
<if test="carotene != null "> and carotene = #{carotene}</if>
<if test="thiamine != null "> and thiamine = #{thiamine}</if>
<if test="riboflavin != null "> and riboflavin = #{riboflavin}</if>
<if test="niacin != null "> and niacin = #{niacin}</if>
<if test="vitaminC != null "> and vitamin_c = #{vitaminC}</if>
<if test="vitaminD != null "> and vitamin_d = #{vitaminD}</if>
<if test="vitaminE != null "> and vitamin_e = #{vitaminE}</if>
<if test="choline != null "> and choline = #{choline}</if>
<if test="biotin != null "> and biotin = #{biotin}</if>
<if test="pantothenicAcid != null "> and pantothenic_acid = #{pantothenicAcid}</if>
<if test="guanine != null "> and guanine = #{guanine}</if>
<if test="adenine != null "> and adenine = #{adenine}</if>
<if test="hypoxanthine != null "> and hypoxanthine = #{hypoxanthine}</if>
<if test="xanthine != null "> and xanthine = #{xanthine}</if>
<if test="purine != null "> and purine = #{purine}</if>
<if test="glycemicIndex != null "> and glycemic_index = #{glycemicIndex}</if>
<if test="totalPhytosterolContent != null "> and total_phytosterol_content = #{totalPhytosterolContent}</if>
<if test="cerealSterol != null "> and cereal_sterol = #{cerealSterol}</if>
<if test="cameliaSterol != null "> and camelia_sterol = #{cameliaSterol}</if>
<if test="sterol != null "> and sterol = #{sterol}</if>
<if test="cerealSteranol != null "> and cereal_steranol = #{cerealSteranol}</if>
<if test="rapesanol != null "> and rapesanol = #{rapesanol}</if>
<if test="rapeseedSteranol != null "> and rapeseed_steranol = #{rapeseedSteranol}</if>
<if test="luteinZeaxanthin != null "> and lutein_zeaxanthin = #{luteinZeaxanthin}</if>
<if test="quercetin != null "> and quercetin = #{quercetin}</if>
<if test="myricetin != null "> and myricetin = #{myricetin}</if>
<if test="luteolin != null "> and luteolin = #{luteolin}</if>
<if test="kaemPferol != null "> and kaem_pferol = #{kaemPferol}</if>
<if test="apigenin != null "> and apigenin = #{apigenin}</if>
<if test="isoflavone != null "> and isoflavone = #{isoflavone}</if>
<if test="daidzein != null "> and daidzein = #{daidzein}</if>
<if test="genistein != null "> and genistein = #{genistein}</if>
<if test="glycitein != null "> and glycitein = #{glycitein}</if>
<if test="anthocyan != null "> and anthocyan = #{anthocyan}</if>
<if test="resveratrol != null "> and resveratrol = #{resveratrol}</if>
<if test="polydatin != null "> and polydatin = #{polydatin}</if>
<if test="originPlace != null and originPlace != ''"> and origin_place = #{originPlace}</if>
<if test="calcium != null "> and calcium = #{calcium}</if>
<if test="phosphorus != null "> and phosphorus = #{phosphorus}</if>
<if test="kalium != null "> and kalium = #{kalium}</if>
<if test="sodium != null "> and sodium = #{sodium}</if>
<if test="magnesium != null "> and magnesium = #{magnesium}</if>
<if test="iron != null "> and iron = #{iron}</if>
<if test="zinc != null "> and zinc = #{zinc}</if>
<if test="selenium != null "> and selenium = #{selenium}</if>
<if test="cuprum != null "> and cuprum = #{cuprum}</if>
<if test="manganese != null "> and manganese = #{manganese}</if>
<if test="isoleucine != null "> and isoleucine = #{isoleucine}</if>
<if test="leucine != null "> and leucine = #{leucine}</if>
<if test="lysine != null "> and lysine = #{lysine}</if>
<if test="saaTotal != null "> and saa_total = #{saaTotal}</if>
<if test="aaaTotal != null "> and aaa_total = #{aaaTotal}</if>
<if test="threonine != null "> and threonine = #{threonine}</if>
<if test="tryptophan != null "> and tryptophan = #{tryptophan}</if>
<if test="valine != null "> and valine = #{valine}</if>
<if test="arginine != null "> and arginine = #{arginine}</if>
<if test="histidine != null "> and histidine = #{histidine}</if>
<if test="alanine != null "> and alanine = #{alanine}</if>
<if test="asparticAcid != null "> and aspartic_acid = #{asparticAcid}</if>
<if test="glutamate != null "> and glutamate = #{glutamate}</if>
<if test="glycine != null "> and glycine = #{glycine}</if>
<if test="proline != null "> and proline = #{proline}</if>
<if test="serine != null "> and serine = #{serine}</if>
<if test="fattyAcid != null "> and fatty_acid = #{fattyAcid}</if>
<if test="saturatedFattyAcid != null "> and saturated_fatty_acid = #{saturatedFattyAcid}</if>
<if test="monounsaturatedFattyAcid != null "> and monounsaturated_fatty_acid = #{monounsaturatedFattyAcid}</if>
<if test="polyunsaturatedFattyAcid != null "> and polyunsaturated_fatty_acid = #{polyunsaturatedFattyAcid}</if>
<if test="iodine != null "> and iodine = #{iodine}</if>
<if test="folic != null "> and folic = #{folic}</if>
<if test="retinol != null "> and retinol = #{retinol}</if>
<if test="nutritionName != null and nutritionName != ''">and nutrition_name like concat('%',
#{nutritionName}, '%')
</if>
<if test="nutritionTypeIds != null and nutritionTypeIds.size() > 0">
and cn.nutrition_type_id in
<foreach item="item" index="index" collection="nutritionTypeIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
@ -209,6 +145,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectCookNutritionVo"/>
where nutrition_id = #{nutritionId}
</select>
<select id="checkIsExist" resultType="java.lang.Integer">
select count(1) from cook_material where nutrition_id = #{nutritionId}
</select>
<select id="getListByCategoryId" resultType="com.bonus.canteen.core.cook.domain.CookNutrition">
<include refid="selectCookNutritionVo"/>
<where>
<if test="categoryId != null and categoryId != ''"> and cn.nutrition_type_id = #{categoryId}</if>
</where>
</select>
<insert id="insertCookNutrition" parameterType="com.bonus.canteen.core.cook.domain.CookNutrition" useGeneratedKeys="true" keyProperty="nutritionId">
insert into cook_nutrition

View File

@ -31,7 +31,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectCookNutritionTypeVo"/>
where nutrition_type_id = #{nutritionTypeId}
</select>
<select id="selectCookNutritionTypeByNutritionTypeName"
resultType="com.bonus.canteen.core.cook.domain.CookNutritionType">
<include refid="selectCookNutritionTypeVo"/>
where nutrition_type_name = #{nutritionTypeName}
<if test="nutritionTypeId != null and nutritionTypeId != '' "> and parent_id = #{nutritionTypeId}</if>
</select>
<select id="checkIsExistChildren" resultType="java.lang.Integer">
select count(1) from cook_nutrition_type where parent_id in
<foreach item="nutritionTypeId" collection="nutritionTypeIds" open="(" separator="," close=")">
#{nutritionTypeId}
</foreach>
</select>
<select id="selectBigTypeList" resultType="com.bonus.canteen.core.cook.vo.NutritionTypeVO">
select nutrition_type_id as id, nutrition_type_name as name from cook_nutrition_type
where level = 0
</select>
<select id="selectLittleTypeList" resultType="com.bonus.canteen.core.cook.vo.NutritionTypeVO">
select nutrition_type_id as id, nutrition_type_name as name from cook_nutrition_type
where level = 1 and parent_id = #{parentId}
</select>
<insert id="insertCookNutritionType" parameterType="com.bonus.canteen.core.cook.domain.CookNutritionType" useGeneratedKeys="true" keyProperty="nutritionTypeId">
insert into cook_nutrition_type
<trim prefix="(" suffix=")" suffixOverrides=",">