新增食材管理
This commit is contained in:
@ -0,0 +1,197 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 食材对象 sys_ingredient
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-12-15
|
||||
*/
|
||||
public class SysIngredient extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 食材名称 */
|
||||
@Excel(name = "食材名称")
|
||||
private String name;
|
||||
|
||||
/** 食材类别 */
|
||||
@Excel(name = "食材类别")
|
||||
private String type;
|
||||
|
||||
/** 推荐分量估算 */
|
||||
@Excel(name = "推荐分量估算")
|
||||
private Long recEstimation;
|
||||
|
||||
/** 推荐分量估算单位id */
|
||||
@Excel(name = "推荐分量估算单位id")
|
||||
private Long recEstUnit;
|
||||
|
||||
/** 推荐分量 */
|
||||
@Excel(name = "推荐分量")
|
||||
private Long recPortion;
|
||||
|
||||
/** 蛋白质比例 */
|
||||
@Excel(name = "蛋白质比例")
|
||||
private BigDecimal proteinRatio;
|
||||
|
||||
/** 脂肪比例 */
|
||||
@Excel(name = "脂肪比例")
|
||||
private BigDecimal fatRatio;
|
||||
|
||||
/** 碳水比例 */
|
||||
@Excel(name = "碳水比例")
|
||||
private BigDecimal carbonRatio;
|
||||
|
||||
/** 地域 */
|
||||
@Excel(name = "地域")
|
||||
private String area;
|
||||
|
||||
/** 忌口 */
|
||||
@Excel(name = "忌口")
|
||||
private String notRec;
|
||||
|
||||
/** 推荐 */
|
||||
@Excel(name = "推荐")
|
||||
private String recommend;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setRecEstimation(Long recEstimation)
|
||||
{
|
||||
this.recEstimation = recEstimation;
|
||||
}
|
||||
|
||||
public Long getRecEstimation()
|
||||
{
|
||||
return recEstimation;
|
||||
}
|
||||
public void setRecEstUnit(Long recEstUnit)
|
||||
{
|
||||
this.recEstUnit = recEstUnit;
|
||||
}
|
||||
|
||||
public Long getRecEstUnit()
|
||||
{
|
||||
return recEstUnit;
|
||||
}
|
||||
public void setRecPortion(Long recPortion)
|
||||
{
|
||||
this.recPortion = recPortion;
|
||||
}
|
||||
|
||||
public Long getRecPortion()
|
||||
{
|
||||
return recPortion;
|
||||
}
|
||||
public void setProteinRatio(BigDecimal proteinRatio)
|
||||
{
|
||||
this.proteinRatio = proteinRatio;
|
||||
}
|
||||
|
||||
public BigDecimal getProteinRatio()
|
||||
{
|
||||
return proteinRatio;
|
||||
}
|
||||
public void setFatRatio(BigDecimal fatRatio)
|
||||
{
|
||||
this.fatRatio = fatRatio;
|
||||
}
|
||||
|
||||
public BigDecimal getFatRatio()
|
||||
{
|
||||
return fatRatio;
|
||||
}
|
||||
public void setCarbonRatio(BigDecimal carbonRatio)
|
||||
{
|
||||
this.carbonRatio = carbonRatio;
|
||||
}
|
||||
|
||||
public BigDecimal getCarbonRatio()
|
||||
{
|
||||
return carbonRatio;
|
||||
}
|
||||
public void setArea(String area)
|
||||
{
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public String getArea()
|
||||
{
|
||||
return area;
|
||||
}
|
||||
public void setNotRec(String notRec)
|
||||
{
|
||||
this.notRec = notRec;
|
||||
}
|
||||
|
||||
public String getNotRec()
|
||||
{
|
||||
return notRec;
|
||||
}
|
||||
public void setRecommend(String recommend)
|
||||
{
|
||||
this.recommend = recommend;
|
||||
}
|
||||
|
||||
public String getRecommend()
|
||||
{
|
||||
return recommend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("type", getType())
|
||||
.append("recEstimation", getRecEstimation())
|
||||
.append("recEstUnit", getRecEstUnit())
|
||||
.append("recPortion", getRecPortion())
|
||||
.append("proteinRatio", getProteinRatio())
|
||||
.append("fatRatio", getFatRatio())
|
||||
.append("carbonRatio", getCarbonRatio())
|
||||
.append("remark", getRemark())
|
||||
.append("area", getArea())
|
||||
.append("notRec", getNotRec())
|
||||
.append("recommend", getRecommend())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysIngredient;
|
||||
|
||||
/**
|
||||
* 食材Mapper接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-12-15
|
||||
*/
|
||||
public interface SysIngredientMapper
|
||||
{
|
||||
/**
|
||||
* 查询食材
|
||||
*
|
||||
* @param id 食材ID
|
||||
* @return 食材
|
||||
*/
|
||||
public SysIngredient selectSysIngredientById(Long id);
|
||||
|
||||
/**
|
||||
* 查询食材列表
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 食材集合
|
||||
*/
|
||||
public List<SysIngredient> selectSysIngredientList(SysIngredient sysIngredient);
|
||||
|
||||
/**
|
||||
* 新增食材
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysIngredient(SysIngredient sysIngredient);
|
||||
|
||||
/**
|
||||
* 修改食材
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysIngredient(SysIngredient sysIngredient);
|
||||
|
||||
/**
|
||||
* 删除食材
|
||||
*
|
||||
* @param id 食材ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysIngredientById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除食材
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysIngredientByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysIngredient;
|
||||
|
||||
/**
|
||||
* 食材Service接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-12-15
|
||||
*/
|
||||
public interface ISysIngredientService
|
||||
{
|
||||
/**
|
||||
* 查询食材
|
||||
*
|
||||
* @param id 食材ID
|
||||
* @return 食材
|
||||
*/
|
||||
public SysIngredient selectSysIngredientById(Long id);
|
||||
|
||||
/**
|
||||
* 查询食材列表
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 食材集合
|
||||
*/
|
||||
public List<SysIngredient> selectSysIngredientList(SysIngredient sysIngredient);
|
||||
|
||||
/**
|
||||
* 新增食材
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysIngredient(SysIngredient sysIngredient);
|
||||
|
||||
/**
|
||||
* 修改食材
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysIngredient(SysIngredient sysIngredient);
|
||||
|
||||
/**
|
||||
* 批量删除食材
|
||||
*
|
||||
* @param ids 需要删除的食材ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysIngredientByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除食材信息
|
||||
*
|
||||
* @param id 食材ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysIngredientById(Long id);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysIngredientMapper;
|
||||
import com.stdiet.custom.domain.SysIngredient;
|
||||
import com.stdiet.custom.service.ISysIngredientService;
|
||||
|
||||
/**
|
||||
* 食材Service业务层处理
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-12-15
|
||||
*/
|
||||
@Service
|
||||
public class SysIngredientServiceImpl implements ISysIngredientService
|
||||
{
|
||||
@Autowired
|
||||
private SysIngredientMapper sysIngredientMapper;
|
||||
|
||||
/**
|
||||
* 查询食材
|
||||
*
|
||||
* @param id 食材ID
|
||||
* @return 食材
|
||||
*/
|
||||
@Override
|
||||
public SysIngredient selectSysIngredientById(Long id)
|
||||
{
|
||||
return sysIngredientMapper.selectSysIngredientById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询食材列表
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 食材
|
||||
*/
|
||||
@Override
|
||||
public List<SysIngredient> selectSysIngredientList(SysIngredient sysIngredient)
|
||||
{
|
||||
return sysIngredientMapper.selectSysIngredientList(sysIngredient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增食材
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysIngredient(SysIngredient sysIngredient)
|
||||
{
|
||||
sysIngredient.setCreateTime(DateUtils.getNowDate());
|
||||
return sysIngredientMapper.insertSysIngredient(sysIngredient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改食材
|
||||
*
|
||||
* @param sysIngredient 食材
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysIngredient(SysIngredient sysIngredient)
|
||||
{
|
||||
sysIngredient.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysIngredientMapper.updateSysIngredient(sysIngredient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除食材
|
||||
*
|
||||
* @param ids 需要删除的食材ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysIngredientByIds(Long[] ids)
|
||||
{
|
||||
return sysIngredientMapper.deleteSysIngredientByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除食材信息
|
||||
*
|
||||
* @param id 食材ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysIngredientById(Long id)
|
||||
{
|
||||
return sysIngredientMapper.deleteSysIngredientById(id);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user