!23 新建食材、菜品页面

Merge pull request !23 from 德仔/develop
This commit is contained in:
德仔 2020-12-29 10:19:58 +08:00 committed by Gitee
commit b1a94bc630
25 changed files with 1920 additions and 179 deletions

Binary file not shown.

View File

@ -83,7 +83,7 @@ spring:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/stdiet_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/stdiet_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
password: Ttj4fAHU password: S6QAUjVMFwWe
username: root username: root
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@ -83,7 +83,7 @@ spring:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://47.115.23.82:3306/stdiet_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://47.115.23.82:3306/stdiet_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
password: Ttj4fAHU password: S6QAUjVMFwWe
username: root username: root
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@ -83,7 +83,7 @@ spring:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/stdiet?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/stdiet?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
password: Ttj4fAHU password: S6QAUjVMFwWe
username: root username: root
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@ -0,0 +1,103 @@
package com.stdiet.web.controller.custom;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.custom.domain.SysDishes;
import com.stdiet.custom.service.ISysDishesService;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.core.page.TableDataInfo;
/**
* 菜品Controller
*
* @author wonder
* @date 2020-12-28
*/
@RestController
@RequestMapping("/custom/dishes")
public class SysDishesController extends BaseController
{
@Autowired
private ISysDishesService sysDishesService;
/**
* 查询菜品列表
*/
@PreAuthorize("@ss.hasPermi('custom:dishes:list')")
@GetMapping("/list")
public TableDataInfo list(SysDishes sysDishes)
{
startPage();
List<SysDishes> list = sysDishesService.selectSysDishesList(sysDishes);
return getDataTable(list);
}
/**
* 导出菜品列表
*/
@PreAuthorize("@ss.hasPermi('custom:dishes:export')")
@Log(title = "菜品", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysDishes sysDishes)
{
List<SysDishes> list = sysDishesService.selectSysDishesList(sysDishes);
ExcelUtil<SysDishes> util = new ExcelUtil<SysDishes>(SysDishes.class);
return util.exportExcel(list, "dishes");
}
/**
* 获取菜品详细信息
*/
@PreAuthorize("@ss.hasPermi('custom:dishes:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysDishesService.selectSysDishesById(id));
}
/**
* 新增菜品
*/
@PreAuthorize("@ss.hasPermi('custom:dishes:add')")
@Log(title = "菜品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysDishes sysDishes)
{
return toAjax(sysDishesService.insertSysDishes(sysDishes));
}
/**
* 修改菜品
*/
@PreAuthorize("@ss.hasPermi('custom:dishes:edit')")
@Log(title = "菜品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysDishes sysDishes)
{
return toAjax(sysDishesService.updateSysDishes(sysDishes));
}
/**
* 删除菜品
*/
@PreAuthorize("@ss.hasPermi('custom:dishes:remove')")
@Log(title = "菜品", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysDishesService.deleteSysDishesByIds(ids));
}
}

View File

@ -37,8 +37,8 @@ public class SysIngredientController extends BaseController
* 查询食材列表 * 查询食材列表
*/ */
@PreAuthorize("@ss.hasPermi('custom:ingredient:list')") @PreAuthorize("@ss.hasPermi('custom:ingredient:list')")
@GetMapping("/list") @PostMapping("/list")
public TableDataInfo list(SysIngredient sysIngredient) public TableDataInfo list(@RequestBody SysIngredient sysIngredient)
{ {
startPage(); startPage();
List<SysIngredient> list = sysIngredientService.selectSysIngredientList(sysIngredient); List<SysIngredient> list = sysIngredientService.selectSysIngredientList(sysIngredient);

View File

@ -0,0 +1,103 @@
package com.stdiet.web.controller.custom;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.custom.domain.SysPhysicalSigns;
import com.stdiet.custom.service.ISysPhysicalSignsService;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.core.page.TableDataInfo;
/**
* 体征Controller
*
* @author wonder
* @date 2020-12-23
*/
@RestController
@RequestMapping("/custom/physicalSigns")
public class SysPhysicalSignsController extends BaseController
{
@Autowired
private ISysPhysicalSignsService sysPhysicalSignsService;
/**
* 查询体征列表
*/
@PreAuthorize("@ss.hasPermi('custom:physicalSigns:list')")
@GetMapping("/list")
public TableDataInfo list(SysPhysicalSigns sysPhysicalSigns)
{
startPage();
List<SysPhysicalSigns> list = sysPhysicalSignsService.selectSysPhysicalSignsList(sysPhysicalSigns);
return getDataTable(list);
}
/**
* 导出体征列表
*/
@PreAuthorize("@ss.hasPermi('custom:physicalSigns:export')")
@Log(title = "体征", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysPhysicalSigns sysPhysicalSigns)
{
List<SysPhysicalSigns> list = sysPhysicalSignsService.selectSysPhysicalSignsList(sysPhysicalSigns);
ExcelUtil<SysPhysicalSigns> util = new ExcelUtil<SysPhysicalSigns>(SysPhysicalSigns.class);
return util.exportExcel(list, "physicalSigns");
}
/**
* 获取体征详细信息
*/
@PreAuthorize("@ss.hasPermi('custom:physicalSigns:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysPhysicalSignsService.selectSysPhysicalSignsById(id));
}
/**
* 新增体征
*/
@PreAuthorize("@ss.hasPermi('custom:physicalSigns:add')")
@Log(title = "体征", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysPhysicalSigns sysPhysicalSigns)
{
return toAjax(sysPhysicalSignsService.insertSysPhysicalSigns(sysPhysicalSigns));
}
/**
* 修改体征
*/
@PreAuthorize("@ss.hasPermi('custom:physicalSigns:edit')")
@Log(title = "体征", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysPhysicalSigns sysPhysicalSigns)
{
return toAjax(sysPhysicalSignsService.updateSysPhysicalSigns(sysPhysicalSigns));
}
/**
* 删除体征
*/
@PreAuthorize("@ss.hasPermi('custom:physicalSigns:remove')")
@Log(title = "体征", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysPhysicalSignsService.deleteSysPhysicalSignsByIds(ids));
}
}

View File

@ -0,0 +1,83 @@
package com.stdiet.custom.domain;
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_dishes
*
* @author wonder
* @date 2020-12-28
*/
public class SysDishes 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 String methods;
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 setMethods(String methods)
{
this.methods = methods;
}
public String getMethods()
{
return methods;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("type", getType())
.append("methods", getMethods())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -1,10 +1,11 @@
package com.stdiet.custom.domain; 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.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity; import com.stdiet.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/** /**
* 食材对象 sys_ingredient * 食材对象 sys_ingredient
@ -12,56 +13,79 @@ import com.stdiet.common.core.domain.BaseEntity;
* @author wonder * @author wonder
* @date 2020-12-15 * @date 2020-12-15
*/ */
public class SysIngredient extends BaseEntity public class SysIngredient extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** id */ /**
* id
*/
private Long id; private Long id;
/** 食材名称 */ /**
* 食材名称
*/
@Excel(name = "食材名称") @Excel(name = "食材名称")
private String name; private String name;
/** 食材类别 */ /**
* 食材类别
*/
@Excel(name = "食材类别") @Excel(name = "食材类别")
private String type; private String type;
/** 推荐分量估算 */ /**
* 推荐分量估算
*/
@Excel(name = "推荐分量估算") @Excel(name = "推荐分量估算")
private Long recEstimation; private Long recEstimation;
/** 推荐分量估算单位id */ /**
* 推荐分量估算单位id
*/
@Excel(name = "推荐分量估算单位id") @Excel(name = "推荐分量估算单位id")
private Long recEstUnit; private Long recEstUnit;
/** 推荐分量 */ /**
* 推荐分量
*/
@Excel(name = "推荐分量") @Excel(name = "推荐分量")
private Long recPortion; private Long recPortion;
/** 蛋白质比例 */ /**
* 蛋白质比例
*/
@Excel(name = "蛋白质比例") @Excel(name = "蛋白质比例")
private BigDecimal proteinRatio; private BigDecimal proteinRatio;
/** 脂肪比例 */ /**
* 脂肪比例
*/
@Excel(name = "脂肪比例") @Excel(name = "脂肪比例")
private BigDecimal fatRatio; private BigDecimal fatRatio;
/** 碳水比例 */ /**
* 碳水比例
*/
@Excel(name = "碳水比例") @Excel(name = "碳水比例")
private BigDecimal carbonRatio; private BigDecimal carbonRatio;
/** 地域 */ /**
* 地域
*/
@Excel(name = "地域") @Excel(name = "地域")
private String area; private String area;
/** 忌口 */ /**
@Excel(name = "忌口") * 忌口
*/
@Excel(name = "忌口人群")
private String notRec; private String notRec;
/** 推荐 */ /**
@Excel(name = "推荐") * 推荐
private String recommend; */
@Excel(name = "推荐人群")
private String rec;
private Long[] recIds; private Long[] recIds;
@ -75,126 +99,105 @@ public class SysIngredient extends BaseEntity
return notRecIds; return notRecIds;
} }
public void setNotRecIds(Long[] notRecIds) { public Long getId() {
this.notRecIds = notRecIds; return id;
} }
public void setRedIds(Long[] recIds) { public void setId(Long id) {
this.recIds = recIds;
}
public void setId(Long id)
{
this.id = id; this.id = id;
} }
public Long getId() public String getName() {
{ return name;
return id;
} }
public void setName(String name)
{ public void setName(String name) {
this.name = name; this.name = name;
} }
public String getName() public String getType() {
{ return type;
return name;
} }
public void setType(String type)
{ public void setType(String type) {
this.type = type; this.type = type;
} }
public String getType() public Long getRecEstimation() {
{ return recEstimation;
return type;
} }
public void setRecEstimation(Long recEstimation)
{ public void setRecEstimation(Long recEstimation) {
this.recEstimation = recEstimation; this.recEstimation = recEstimation;
} }
public Long getRecEstimation() public Long getRecEstUnit() {
{ return recEstUnit;
return recEstimation;
} }
public void setRecEstUnit(Long recEstUnit)
{ public void setRecEstUnit(Long recEstUnit) {
this.recEstUnit = recEstUnit; this.recEstUnit = recEstUnit;
} }
public Long getRecEstUnit() public Long getRecPortion() {
{ return recPortion;
return recEstUnit;
} }
public void setRecPortion(Long recPortion)
{ public void setRecPortion(Long recPortion) {
this.recPortion = recPortion; this.recPortion = recPortion;
} }
public Long getRecPortion() public BigDecimal getProteinRatio() {
{ return proteinRatio;
return recPortion;
} }
public void setProteinRatio(BigDecimal proteinRatio)
{ public void setProteinRatio(BigDecimal proteinRatio) {
this.proteinRatio = proteinRatio; this.proteinRatio = proteinRatio;
} }
public BigDecimal getProteinRatio() public BigDecimal getFatRatio() {
{ return fatRatio;
return proteinRatio;
} }
public void setFatRatio(BigDecimal fatRatio)
{ public void setFatRatio(BigDecimal fatRatio) {
this.fatRatio = fatRatio; this.fatRatio = fatRatio;
} }
public BigDecimal getFatRatio() public BigDecimal getCarbonRatio() {
{ return carbonRatio;
return fatRatio;
} }
public void setCarbonRatio(BigDecimal carbonRatio)
{ public void setCarbonRatio(BigDecimal carbonRatio) {
this.carbonRatio = carbonRatio; this.carbonRatio = carbonRatio;
} }
public BigDecimal getCarbonRatio() public String getArea() {
{ return area;
return carbonRatio;
} }
public void setArea(String area)
{ public void setArea(String area) {
this.area = area; this.area = area;
} }
public String getArea() public String getNotRec() {
{ return notRec;
return area;
} }
public void setNotRec(String notRec)
{ public void setNotRec(String notRec) {
this.notRec = notRec; this.notRec = notRec;
} }
public String getNotRec() public String getRec() {
{ return rec;
return notRec;
}
public void setRecommend(String recommend)
{
this.recommend = recommend;
} }
public String getRecommend() public void setRec(String rec) {
{ this.rec = rec;
return recommend;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("name", getName()) .append("name", getName())
.append("type", getType()) .append("type", getType())
@ -207,7 +210,7 @@ public class SysIngredient extends BaseEntity
.append("remark", getRemark()) .append("remark", getRemark())
.append("area", getArea()) .append("area", getArea())
.append("notRec", getNotRec()) .append("notRec", getNotRec())
.append("recommend", getRecommend()) .append("recommend", getRec())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())

View File

@ -0,0 +1,66 @@
package com.stdiet.custom.domain;
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_physical_signs
*
* @author wonder
* @date 2020-12-23
*/
public class SysPhysicalSigns extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 体征名称 */
@Excel(name = "体征名称")
private String name;
/** 体征类别 */
@Excel(name = "体征类别")
private Long typeId;
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 setTypeId(Long typeId)
{
this.typeId = typeId;
}
public Long getTypeId()
{
return typeId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("typeId", getTypeId())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysDishes;
/**
* 菜品Mapper接口
*
* @author wonder
* @date 2020-12-28
*/
public interface SysDishesMapper
{
/**
* 查询菜品
*
* @param id 菜品ID
* @return 菜品
*/
public SysDishes selectSysDishesById(Long id);
/**
* 查询菜品列表
*
* @param sysDishes 菜品
* @return 菜品集合
*/
public List<SysDishes> selectSysDishesList(SysDishes sysDishes);
/**
* 新增菜品
*
* @param sysDishes 菜品
* @return 结果
*/
public int insertSysDishes(SysDishes sysDishes);
/**
* 修改菜品
*
* @param sysDishes 菜品
* @return 结果
*/
public int updateSysDishes(SysDishes sysDishes);
/**
* 删除菜品
*
* @param id 菜品ID
* @return 结果
*/
public int deleteSysDishesById(Long id);
/**
* 批量删除菜品
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysDishesByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysPhysicalSigns;
/**
* 体征Mapper接口
*
* @author wonder
* @date 2020-12-23
*/
public interface SysPhysicalSignsMapper
{
/**
* 查询体征
*
* @param id 体征ID
* @return 体征
*/
public SysPhysicalSigns selectSysPhysicalSignsById(Long id);
/**
* 查询体征列表
*
* @param sysPhysicalSigns 体征
* @return 体征集合
*/
public List<SysPhysicalSigns> selectSysPhysicalSignsList(SysPhysicalSigns sysPhysicalSigns);
/**
* 新增体征
*
* @param sysPhysicalSigns 体征
* @return 结果
*/
public int insertSysPhysicalSigns(SysPhysicalSigns sysPhysicalSigns);
/**
* 修改体征
*
* @param sysPhysicalSigns 体征
* @return 结果
*/
public int updateSysPhysicalSigns(SysPhysicalSigns sysPhysicalSigns);
/**
* 删除体征
*
* @param id 体征ID
* @return 结果
*/
public int deleteSysPhysicalSignsById(Long id);
/**
* 批量删除体征
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysPhysicalSignsByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.custom.domain.SysDishes;
/**
* 菜品Service接口
*
* @author wonder
* @date 2020-12-28
*/
public interface ISysDishesService
{
/**
* 查询菜品
*
* @param id 菜品ID
* @return 菜品
*/
public SysDishes selectSysDishesById(Long id);
/**
* 查询菜品列表
*
* @param sysDishes 菜品
* @return 菜品集合
*/
public List<SysDishes> selectSysDishesList(SysDishes sysDishes);
/**
* 新增菜品
*
* @param sysDishes 菜品
* @return 结果
*/
public int insertSysDishes(SysDishes sysDishes);
/**
* 修改菜品
*
* @param sysDishes 菜品
* @return 结果
*/
public int updateSysDishes(SysDishes sysDishes);
/**
* 批量删除菜品
*
* @param ids 需要删除的菜品ID
* @return 结果
*/
public int deleteSysDishesByIds(Long[] ids);
/**
* 删除菜品信息
*
* @param id 菜品ID
* @return 结果
*/
public int deleteSysDishesById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.custom.domain.SysPhysicalSigns;
/**
* 体征Service接口
*
* @author wonder
* @date 2020-12-23
*/
public interface ISysPhysicalSignsService
{
/**
* 查询体征
*
* @param id 体征ID
* @return 体征
*/
public SysPhysicalSigns selectSysPhysicalSignsById(Long id);
/**
* 查询体征列表
*
* @param sysPhysicalSigns 体征
* @return 体征集合
*/
public List<SysPhysicalSigns> selectSysPhysicalSignsList(SysPhysicalSigns sysPhysicalSigns);
/**
* 新增体征
*
* @param sysPhysicalSigns 体征
* @return 结果
*/
public int insertSysPhysicalSigns(SysPhysicalSigns sysPhysicalSigns);
/**
* 修改体征
*
* @param sysPhysicalSigns 体征
* @return 结果
*/
public int updateSysPhysicalSigns(SysPhysicalSigns sysPhysicalSigns);
/**
* 批量删除体征
*
* @param ids 需要删除的体征ID
* @return 结果
*/
public int deleteSysPhysicalSignsByIds(Long[] ids);
/**
* 删除体征信息
*
* @param id 体征ID
* @return 结果
*/
public int deleteSysPhysicalSignsById(Long id);
}

View File

@ -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.SysDishesMapper;
import com.stdiet.custom.domain.SysDishes;
import com.stdiet.custom.service.ISysDishesService;
/**
* 菜品Service业务层处理
*
* @author wonder
* @date 2020-12-28
*/
@Service
public class SysDishesServiceImpl implements ISysDishesService
{
@Autowired
private SysDishesMapper sysDishesMapper;
/**
* 查询菜品
*
* @param id 菜品ID
* @return 菜品
*/
@Override
public SysDishes selectSysDishesById(Long id)
{
return sysDishesMapper.selectSysDishesById(id);
}
/**
* 查询菜品列表
*
* @param sysDishes 菜品
* @return 菜品
*/
@Override
public List<SysDishes> selectSysDishesList(SysDishes sysDishes)
{
return sysDishesMapper.selectSysDishesList(sysDishes);
}
/**
* 新增菜品
*
* @param sysDishes 菜品
* @return 结果
*/
@Override
public int insertSysDishes(SysDishes sysDishes)
{
sysDishes.setCreateTime(DateUtils.getNowDate());
return sysDishesMapper.insertSysDishes(sysDishes);
}
/**
* 修改菜品
*
* @param sysDishes 菜品
* @return 结果
*/
@Override
public int updateSysDishes(SysDishes sysDishes)
{
sysDishes.setUpdateTime(DateUtils.getNowDate());
return sysDishesMapper.updateSysDishes(sysDishes);
}
/**
* 批量删除菜品
*
* @param ids 需要删除的菜品ID
* @return 结果
*/
@Override
public int deleteSysDishesByIds(Long[] ids)
{
return sysDishesMapper.deleteSysDishesByIds(ids);
}
/**
* 删除菜品信息
*
* @param id 菜品ID
* @return 结果
*/
@Override
public int deleteSysDishesById(Long id)
{
return sysDishesMapper.deleteSysDishesById(id);
}
}

View File

@ -0,0 +1,93 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysPhysicalSignsMapper;
import com.stdiet.custom.domain.SysPhysicalSigns;
import com.stdiet.custom.service.ISysPhysicalSignsService;
/**
* 体征Service业务层处理
*
* @author wonder
* @date 2020-12-23
*/
@Service
public class SysPhysicalSignsServiceImpl implements ISysPhysicalSignsService
{
@Autowired
private SysPhysicalSignsMapper sysPhysicalSignsMapper;
/**
* 查询体征
*
* @param id 体征ID
* @return 体征
*/
@Override
public SysPhysicalSigns selectSysPhysicalSignsById(Long id)
{
return sysPhysicalSignsMapper.selectSysPhysicalSignsById(id);
}
/**
* 查询体征列表
*
* @param sysPhysicalSigns 体征
* @return 体征
*/
@Override
public List<SysPhysicalSigns> selectSysPhysicalSignsList(SysPhysicalSigns sysPhysicalSigns)
{
return sysPhysicalSignsMapper.selectSysPhysicalSignsList(sysPhysicalSigns);
}
/**
* 新增体征
*
* @param sysPhysicalSigns 体征
* @return 结果
*/
@Override
public int insertSysPhysicalSigns(SysPhysicalSigns sysPhysicalSigns)
{
return sysPhysicalSignsMapper.insertSysPhysicalSigns(sysPhysicalSigns);
}
/**
* 修改体征
*
* @param sysPhysicalSigns 体征
* @return 结果
*/
@Override
public int updateSysPhysicalSigns(SysPhysicalSigns sysPhysicalSigns)
{
return sysPhysicalSignsMapper.updateSysPhysicalSigns(sysPhysicalSigns);
}
/**
* 批量删除体征
*
* @param ids 需要删除的体征ID
* @return 结果
*/
@Override
public int deleteSysPhysicalSignsByIds(Long[] ids)
{
return sysPhysicalSignsMapper.deleteSysPhysicalSignsByIds(ids);
}
/**
* 删除体征信息
*
* @param id 体征ID
* @return 结果
*/
@Override
public int deleteSysPhysicalSignsById(Long id)
{
return sysPhysicalSignsMapper.deleteSysPhysicalSignsById(id);
}
}

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stdiet.custom.mapper.SysDishesMapper">
<resultMap type="SysDishes" id="SysDishesResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="methods" column="methods" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysDishesVo">
select id, name, type, methods, create_by, create_time, update_by, update_time from sys_dishes
</sql>
<select id="selectSysDishesList" parameterType="SysDishes" resultMap="SysDishesResult">
<include refid="selectSysDishesVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
</where>
</select>
<select id="selectSysDishesById" parameterType="Long" resultMap="SysDishesResult">
<include refid="selectSysDishesVo"/>
where id = #{id}
</select>
<insert id="insertSysDishes" parameterType="SysDishes" useGeneratedKeys="true" keyProperty="id">
insert into sys_dishes
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="type != null">type,</if>
<if test="methods != null">methods,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="methods != null">#{methods},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysDishes" parameterType="SysDishes">
update sys_dishes
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="methods != null">methods = #{methods},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysDishesById" parameterType="Long">
delete from sys_dishes where id = #{id}
</delete>
<delete id="deleteSysDishesByIds" parameterType="String">
delete from sys_dishes where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -17,14 +17,84 @@
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="rec" column="rec" />
<result property="notRec" column="not_rec" />
</resultMap> </resultMap>
<sql id="selectSysIngredientVo"> <sql id="selectSysIngredientVo">
select id, name, type, protein_ratio, fat_ratio, carbon_ratio, area, remark, create_by, create_time, update_by, update_time from sys_ingredient SELECT * FROM sys_ingredient igd
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_not_rec
) notRec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) notRecT USING(id)
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_rec
) rec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) recT USING(id)
</sql>
<sql id="selectSysIngredientByPhyVo">
SELECT * FROM sys_ingredient igd
RIGHT JOIN(
SELECT * FROM(
SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_rec
<where>
<if test="recIds != null">
physical_signs_id in
<foreach collection="recIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) recId
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_rec
) rec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) recM USING(id)
INNER JOIN (
SELECT * FROM(
SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_not_rec
<where>
<if test="notRecIds != null">
physical_signs_id in
<foreach collection="notRecIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) notRecId
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_not_rec
) notRec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) notRecM USING(id)
) notRecT USING(id)
) recT USING(id)
</sql> </sql>
<select id="selectSysIngredientList" parameterType="SysIngredient" resultMap="SysIngredientResult"> <select id="selectSysIngredientList" parameterType="SysIngredient" resultMap="SysIngredientResult">
<choose>
<when test="recIds == null and notRecIds == null">
<include refid="selectSysIngredientVo"/> <include refid="selectSysIngredientVo"/>
</when>
<otherwise>
<include refid="selectSysIngredientByPhyVo">
<property name="recIds" value="#{recIds}"/>
<property name="notRecIds" value="#{notRecIds}"/>
</include>
</otherwise>
</choose>
<where> <where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and type = #{type}</if>
@ -68,14 +138,14 @@
</insert> </insert>
<insert id="batchIngredientRec" > <insert id="batchIngredientRec" >
insert into sys_ingredient_rec(ingredient_id, rec_id) values insert into sys_ingredient_rec(ingredient_id, physical_signs_id) values
<foreach collection="list" separator="," item="item" index="index"> <foreach collection="list" separator="," item="item" index="index">
(#{item.ingredientId},#{item.recommandId}) (#{item.ingredientId},#{item.recommandId})
</foreach> </foreach>
</insert> </insert>
<insert id="batchIngredientNotRec" > <insert id="batchIngredientNotRec" >
insert into sys_ingredient_not_rec(ingredient_id, not_rec_id) values insert into sys_ingredient_not_rec(ingredient_id, physical_signs_id) values
<foreach collection="list" separator="," item="item" index="index"> <foreach collection="list" separator="," item="item" index="index">
(#{item.ingredientId},#{item.notRecommandId}) (#{item.ingredientId},#{item.notRecommandId})
</foreach> </foreach>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stdiet.custom.mapper.SysPhysicalSignsMapper">
<resultMap type="SysPhysicalSigns" id="SysPhysicalSignsResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="typeId" column="type_id" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysPhysicalSignsVo">
select id, name, type_id, remark from sys_physical_signs
</sql>
<select id="selectSysPhysicalSignsList" parameterType="SysPhysicalSigns" resultMap="SysPhysicalSignsResult">
<include refid="selectSysPhysicalSignsVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
</where>
</select>
<select id="selectSysPhysicalSignsById" parameterType="Long" resultMap="SysPhysicalSignsResult">
<include refid="selectSysPhysicalSignsVo"/>
where id = #{id}
</select>
<insert id="insertSysPhysicalSigns" parameterType="SysPhysicalSigns" useGeneratedKeys="true" keyProperty="id">
insert into sys_physical_signs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="typeId != null">type_id,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="typeId != null">#{typeId},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysPhysicalSigns" parameterType="SysPhysicalSigns">
update sys_physical_signs
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysPhysicalSignsById" parameterType="Long">
delete from sys_physical_signs where id = #{id}
</delete>
<delete id="deleteSysPhysicalSignsByIds" parameterType="String">
delete from sys_physical_signs where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询菜品列表
export function listDishes(query) {
return request({
url: '/custom/dishes/list',
method: 'get',
params: query
})
}
// 查询菜品详细
export function getDishes(id) {
return request({
url: '/custom/dishes/' + id,
method: 'get'
})
}
// 新增菜品
export function addDishes(data) {
return request({
url: '/custom/dishes',
method: 'post',
data: data
})
}
// 修改菜品
export function updateDishes(data) {
return request({
url: '/custom/dishes',
method: 'put',
data: data
})
}
// 删除菜品
export function delDishes(id) {
return request({
url: '/custom/dishes/' + id,
method: 'delete'
})
}
// 导出菜品
export function exportDishes(query) {
return request({
url: '/custom/dishes/export',
method: 'get',
params: query
})
}

View File

@ -2,10 +2,15 @@ import request from '@/utils/request'
// 查询食材列表 // 查询食材列表
export function listIngredient(query) { export function listIngredient(query) {
const {recIds, notRecIds} = query;
return request({ return request({
url: '/custom/ingredient/list', url: '/custom/ingredient/list',
method: 'get', method: 'post',
params: query data: {
...query,
recIds: recIds && recIds.length ? recIds : null,
notRecIds: notRecIds && notRecIds.length ? notRecIds : null,
}
}) })
} }

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询体征列表
export function listPhysicalSigns(query) {
return request({
url: '/custom/physicalSigns/list',
method: 'get',
params: query
})
}
// 查询体征详细
export function getPhysicalSigns(id) {
return request({
url: '/custom/physicalSigns/' + id,
method: 'get'
})
}
// 新增体征
export function addPhysicalSigns(data) {
return request({
url: '/custom/physicalSigns',
method: 'post',
data: data
})
}
// 修改体征
export function updatePhysicalSigns(data) {
return request({
url: '/custom/physicalSigns',
method: 'put',
data: data
})
}
// 删除体征
export function delPhysicalSigns(id) {
return request({
url: '/custom/physicalSigns/' + id,
method: 'delete'
})
}
// 导出体征
export function exportPhysicalSigns(query) {
return request({
url: '/custom/physicalSigns/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,317 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="菜品名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入菜品名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="菜品类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择菜品类型" clearable size="small">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:dishes:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['custom:dishes:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dishesList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="id" align="center" prop="id" />-->
<el-table-column label="菜品名称" align="center" prop="name" />
<el-table-column label="菜品类型" align="center" prop="type" :formatter="typeFormat" />
<el-table-column label="做法" align="center" prop="methods" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:dishes:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:dishes:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改菜品对话框 -->
<el-dialog :title="title" :visible.sync="open" width="720px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="菜品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入菜品名称" />
</el-form-item>
<el-form-item label="菜品类型" prop="type">
<el-select v-model="form.type" placeholder="请选择菜品类型">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="食材" prop="ingIds">
<el-transfer
style="text-align: left; display: inline-block"
v-model="form.ingIds"
filterable
:render-content="renderFunc"
:titles="['备选', '已选']"
:button-texts="['', '']"
:format="{
noChecked: '${total}',
hasChecked: '${checked}/${total}',
}"
@change="handleChange"
:data="data"
>
<el-select class="transfer-footer" slot="left-footer" size="small"
v-model="ingType"
v-for="dict in ingTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"/>
<div class="transfer-footer" slot="right-footer" size="small" />
</el-transfer>
</el-form-item>
<el-form-item label="做法" prop="methods">
<el-input v-model="form.methods" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDishes, getDishes, delDishes, addDishes, updateDishes, exportDishes } from "@/api/custom/dishes";
export default {
name: "Dishes",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
dishesList: [],
//
title: "",
//
open: false,
ingType: 1,
//
ingTypeOptions: [],
//
typeOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getDicts("cus_dishes_type").then(response => {
this.typeOptions = response.data;
});
this.getDicts("cus_ing_type").then(response => {
this.ingTypeOptions = response.data;
});
},
methods: {
/** 查询菜品列表 */
getList() {
this.loading = true;
listDishes(this.queryParams).then(response => {
this.dishesList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.type);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
type: null,
methods: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
ingIds: []
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加菜品";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDishes(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改菜品";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDishes(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addDishes(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除菜品编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delDishes(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有菜品数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportDishes(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
},
renderFunc(h, option) {
if (this.form.ingIds.includes(option.key)) {
return <span>
{option.key} - {option.label}
</span>
}
return <span>{option.label}</span>;
},
}
};
</script>

View File

@ -30,6 +30,26 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="忌口人群" prop="notRecIds">
<el-select v-model="queryParams.notRecIds" multiple placeholder="请选择体征">
<el-option
v-for="dict in physicalSignsOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="推荐人群" prop="recIds">
<el-select v-model="queryParams.recIds" multiple placeholder="请选择体征">
<el-option
v-for="dict in physicalSignsOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue">
</el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -47,28 +67,28 @@
>新增 >新增
</el-button> </el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="success"--> <!-- type="success"-->
<!-- icon="el-icon-edit"--> <!-- icon="el-icon-edit"-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- :disabled="single"--> <!-- :disabled="single"-->
<!-- @click="handleUpdate"--> <!-- @click="handleUpdate"-->
<!-- v-hasPermi="['custom:ingredient:edit']"--> <!-- v-hasPermi="['custom:ingredient:edit']"-->
<!-- >修改--> <!-- >修改-->
<!-- </el-button>--> <!-- </el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="danger"--> <!-- type="danger"-->
<!-- icon="el-icon-delete"--> <!-- icon="el-icon-delete"-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- :disabled="multiple"--> <!-- :disabled="multiple"-->
<!-- @click="handleDelete"--> <!-- @click="handleDelete"-->
<!-- v-hasPermi="['custom:ingredient:remove']"--> <!-- v-hasPermi="['custom:ingredient:remove']"-->
<!-- >删除--> <!-- >删除-->
<!-- </el-button>--> <!-- </el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -91,8 +111,8 @@
<el-table-column label="脂肪比例(100g)" align="center" prop="fatRatio"/> <el-table-column label="脂肪比例(100g)" align="center" prop="fatRatio"/>
<el-table-column label="碳水比例(100g)" align="center" prop="carbonRatio"/> <el-table-column label="碳水比例(100g)" align="center" prop="carbonRatio"/>
<el-table-column label="地域" align="center" prop="area" :formatter="areaFormat"/> <el-table-column label="地域" align="center" prop="area" :formatter="areaFormat"/>
<el-table-column label="忌口人群" align="center" prop="notRecIds" :formatter="notRecFormat"/> <el-table-column label="忌口人群" align="center" prop="notRec"/>
<el-table-column label="推荐人群" align="center" prop="recIds" :formatter="recommendFormat"/> <el-table-column label="推荐人群" align="center" prop="rec"/>
<el-table-column label="备注" align="center" prop="remark"/> <el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
@ -177,26 +197,26 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="忌口人群" label-width="90px"> <el-form-item label="忌口人群" label-width="90px">
<el-checkbox-group v-model="form.notRecIds"> <el-select v-model="form.notRecIds" multiple placeholder="请选择体征">
<el-checkbox <el-option
v-for="dict in notRecOptions" v-for="dict in physicalSignsOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictValue"> :label="dict.dictLabel"
{{dict.dictLabel}} :value="dict.dictValue">
</el-checkbox> </el-option>
</el-checkbox-group> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="推荐人群" label-width="90px"> <el-form-item label="推荐人群" label-width="90px">
<el-checkbox-group v-model="form.recIds"> <el-select v-model="form.recIds" multiple placeholder="请选择体征">
<el-checkbox <el-option
v-for="dict in recommendOptions" v-for="dict in physicalSignsOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictValue"> :label="dict.dictLabel"
{{dict.dictLabel}} :value="dict.dictValue">
</el-checkbox> </el-option>
</el-checkbox-group> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -224,6 +244,8 @@
updateIngredient updateIngredient
} from "@/api/custom/ingredient"; } from "@/api/custom/ingredient";
import {listPhysicalSigns} from "@/api/custom/physicalSigns";
export default { export default {
name: "Ingredient", name: "Ingredient",
data() { data() {
@ -250,10 +272,8 @@
typeOptions: [], typeOptions: [],
// //
areaOptions: [], areaOptions: [],
// //
notRecOptions: [], physicalSignsOptions: [],
//
recommendOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -278,12 +298,12 @@
this.getDicts("cus_area").then(response => { this.getDicts("cus_area").then(response => {
this.areaOptions = response.data; this.areaOptions = response.data;
}); });
this.getDicts("cus_not_rec_group").then(response => { listPhysicalSigns().then(response => {
this.notRecOptions = response.data; this.physicalSignsOptions = response.rows.map(obj => ({
}); dictLabel: obj.name,
this.getDicts("cus_rec_group").then(response => { dictValue: obj.id
this.recommendOptions = response.data; }))
}); })
}, },
methods: { methods: {
/** 查询食材列表 */ /** 查询食材列表 */
@ -303,14 +323,6 @@
areaFormat(row, column) { areaFormat(row, column) {
return this.selectDictLabel(this.areaOptions, row.area); return this.selectDictLabel(this.areaOptions, row.area);
}, },
//
notRecFormat(row, column) {
return this.selectDictLabels(this.notRecOptions, row.notRecIds.join(','));
},
//
recommendFormat(row, column) {
return this.selectDictLabels(this.recommendOptions, row.recIds.join(','));
},
// //
cancel() { cancel() {
this.open = false; this.open = false;
@ -364,8 +376,8 @@
const id = row.id || this.ids const id = row.id || this.ids
getIngredient(id).then(response => { getIngredient(id).then(response => {
this.form = response.data; this.form = response.data;
// this.form.notRecIds = this.form.notRecIds.split(","); this.form.notRecIds = this.form.rec ? this.form.rec.split(',').map(label => this.physicalSignsOptions.find(pObj => pObj.dictLabel === label).dictValue) : [];
// this.form.recIds = this.form.recIds.split(","); this.form.recIds = this.form.notRec ? this.form.notRec.split(',').map(label => this.physicalSignsOptions.find(pObj => pObj.dictLabel === label).dictValue) : [];
this.open = true; this.open = true;
this.title = "修改食材"; this.title = "修改食材";
}); });
@ -374,8 +386,6 @@
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
// this.form.notRecIds = this.form.notRecIds.join(",");
// this.form.recIds = this.form.recIds.join(",");
if (this.form.id != null) { if (this.form.id != null) {
updateIngredient(this.form).then(response => { updateIngredient(this.form).then(response => {
if (response.code === 200) { if (response.code === 200) {

View File

@ -0,0 +1,294 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="体征名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入体征名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="体征类别" prop="typeId">
<el-select v-model="queryParams.typeId" placeholder="请选择体征类别" clearable size="small">
<el-option
v-for="dict in typeIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:physicalSigns:add']"
>新增</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['custom:physicalSigns:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['custom:physicalSigns:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['custom:physicalSigns:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="physicalSignsList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="id" align="center" prop="id" />-->
<el-table-column label="体征名称" align="center" prop="name" />
<el-table-column label="体征类别" align="center" prop="typeId" :formatter="typeIdFormat" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:physicalSigns:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:physicalSigns:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改体征对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="体征名称" prop="name">
<el-input v-model="form.name" placeholder="请输入体征名称" />
</el-form-item>
<el-form-item label="体征类别" prop="typeId">
<el-select v-model="form.typeId" placeholder="请选择体征类别">
<el-option
v-for="dict in typeIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPhysicalSigns, getPhysicalSigns, delPhysicalSigns, addPhysicalSigns, updatePhysicalSigns, exportPhysicalSigns } from "@/api/custom/physicalSigns";
export default {
name: "PhysicalSigns",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
physicalSignsList: [],
//
title: "",
//
open: false,
//
typeIdOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
typeId: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getDicts("cus_signs_type").then(response => {
this.typeIdOptions = response.data;
});
},
methods: {
/** 查询体征列表 */
getList() {
this.loading = true;
listPhysicalSigns(this.queryParams).then(response => {
this.physicalSignsList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
typeIdFormat(row, column) {
return this.selectDictLabel(this.typeIdOptions, row.typeId);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
typeId: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加体征";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getPhysicalSigns(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改体征";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updatePhysicalSigns(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addPhysicalSigns(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除体征编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delPhysicalSigns(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有体征数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportPhysicalSigns(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
}
}
};
</script>