commit
f6f4efa6fc
@ -37,16 +37,7 @@ public class SysDishesController extends BaseController {
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDishes sysDishes) {
|
||||
startPage();
|
||||
List<SysDishes> list = sysDishesService.selectSysDishesList(sysDishes);
|
||||
for (SysDishes dishes : list) {
|
||||
List<SysDishesIngredient> ingredients = sysDishesService.selectSysIngreditentsById(dishes.getId());
|
||||
if (StringUtils.isNull(ingredients)) {
|
||||
dishes.setIgdList(new ArrayList<>());
|
||||
} else {
|
||||
dishes.setIgdList(ingredients);
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
return getDataTable(sysDishesService.selectSysDishesList(sysDishes));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,4 +89,10 @@ public class SysDishes {
|
||||
|
||||
private Integer[] dishClass;
|
||||
|
||||
private Long[] notRecIds;
|
||||
|
||||
private Long[] recIds;
|
||||
|
||||
private String physical;
|
||||
|
||||
}
|
@ -31,5 +31,8 @@ public class SysDishesIngredient extends SysIngredient {
|
||||
|
||||
private String cus_weight;
|
||||
|
||||
private String recIdsStr;
|
||||
|
||||
private String notRecIdsStr;
|
||||
|
||||
}
|
@ -101,7 +101,6 @@ public class SysIngredient {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
private Long[] recIds;
|
||||
|
||||
private Long[] notRecIds;
|
||||
|
@ -1,30 +0,0 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
public class SysIngredientNotRec {
|
||||
private Long ingredientId;
|
||||
private Long notRecommandId;
|
||||
|
||||
public Long getIngredientId() {
|
||||
return ingredientId;
|
||||
}
|
||||
|
||||
public void setIngredientId(Long ingredientId) {
|
||||
this.ingredientId = ingredientId;
|
||||
}
|
||||
|
||||
public Long getRecommandId() {
|
||||
return notRecommandId;
|
||||
}
|
||||
|
||||
public void setRecommandId(Long recommandId) {
|
||||
this.notRecommandId = recommandId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysIngredientRec{" +
|
||||
"ingredientId=" + ingredientId +
|
||||
", notRecommandId=" + notRecommandId +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
public class SysIngredientRec {
|
||||
private Long ingredientId;
|
||||
private Long recommandId;
|
||||
|
||||
public Long getIngredientId() {
|
||||
return ingredientId;
|
||||
}
|
||||
|
||||
public void setIngredientId(Long ingredientId) {
|
||||
this.ingredientId = ingredientId;
|
||||
}
|
||||
|
||||
public Long getRecommandId() {
|
||||
return recommandId;
|
||||
}
|
||||
|
||||
public void setRecommandId(Long recommandId) {
|
||||
this.recommandId = recommandId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysIngredientRec{" +
|
||||
"ingredientId=" + ingredientId +
|
||||
", recommandId=" + recommandId +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
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;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 体征对象 sys_physical_signs
|
||||
@ -11,56 +9,27 @@ import com.stdiet.common.core.domain.BaseEntity;
|
||||
* @author wonder
|
||||
* @date 2020-12-23
|
||||
*/
|
||||
public class SysPhysicalSigns extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@Data
|
||||
public class SysPhysicalSigns {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 体征名称 */
|
||||
/**
|
||||
* 体征名称
|
||||
*/
|
||||
@Excel(name = "体征名称")
|
||||
private String name;
|
||||
|
||||
/** 体征类别 */
|
||||
@Excel(name = "体征类别")
|
||||
/**
|
||||
* 体征类别
|
||||
*/
|
||||
private Long typeId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
@Excel(name = "体征类别")
|
||||
private String typeName;
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
private String remark;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysPhysicalSignsObj {
|
||||
|
||||
Long targetId;
|
||||
|
||||
Long physicalSignsId;
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysDishes;
|
||||
import com.stdiet.custom.domain.SysDishesIngredient;
|
||||
import com.stdiet.custom.domain.SysIngredient;
|
||||
import com.stdiet.custom.domain.SysPhysicalSignsObj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜品Mapper接口
|
||||
@ -13,8 +13,7 @@ import com.stdiet.custom.domain.SysIngredient;
|
||||
* @author wonder
|
||||
* @date 2020-12-28
|
||||
*/
|
||||
public interface SysDishesMapper
|
||||
{
|
||||
public interface SysDishesMapper {
|
||||
/**
|
||||
* 查询菜品
|
||||
*
|
||||
@ -72,4 +71,13 @@ public interface SysDishesMapper
|
||||
public int bashInsertDishesIngredent(List<SysDishesIngredient> sysDishesIngredients);
|
||||
|
||||
String getDishesMenuTypeById(Long id);
|
||||
|
||||
int batchInsertDishesRec(List<SysPhysicalSignsObj> sysPhysicalSignsObj);
|
||||
|
||||
int batchInsertDishesNotRec(List<SysPhysicalSignsObj> sysPhysicalSignsObj);
|
||||
|
||||
int deleteDishesRecByDishesId(Long dishesId);
|
||||
|
||||
int deleteDishesNotRecByDishesId(Long dishesId);
|
||||
|
||||
}
|
@ -2,8 +2,7 @@ package com.stdiet.custom.mapper;
|
||||
|
||||
import com.stdiet.custom.domain.SysIngredentFile;
|
||||
import com.stdiet.custom.domain.SysIngredient;
|
||||
import com.stdiet.custom.domain.SysIngredientNotRec;
|
||||
import com.stdiet.custom.domain.SysIngredientRec;
|
||||
import com.stdiet.custom.domain.SysPhysicalSignsObj;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@ -63,9 +62,9 @@ public interface SysIngredientMapper {
|
||||
*/
|
||||
// int deleteSysIngredientByIds(Long[] ids);
|
||||
|
||||
int batchIngredientRec(List<SysIngredientRec> ingredientRecList);
|
||||
int batchIngredientRec(List<SysPhysicalSignsObj> ingredientRecList);
|
||||
|
||||
int batchIngredientNotRec(List<SysIngredientNotRec> ingredientNotRecList);
|
||||
int batchIngredientNotRec(List<SysPhysicalSignsObj> ingredientNotRecList);
|
||||
|
||||
int deleteIngredientRecByIngredientId(Long recId);
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import com.stdiet.custom.domain.SysDishes;
|
||||
import com.stdiet.custom.domain.SysDishesIngredient;
|
||||
import com.stdiet.custom.domain.SysIngredient;
|
||||
import com.stdiet.custom.domain.SysPhysicalSignsObj;
|
||||
|
||||
/**
|
||||
* 菜品Service接口
|
||||
@ -64,4 +65,5 @@ public interface ISysDishesService
|
||||
public int deleteSysDishesById(Long id);
|
||||
|
||||
public String getDishesMenuTypeById(Long id);
|
||||
|
||||
}
|
@ -2,8 +2,7 @@ package com.stdiet.custom.service.impl;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.custom.domain.SysDishes;
|
||||
import com.stdiet.custom.domain.SysDishesIngredient;
|
||||
import com.stdiet.custom.domain.*;
|
||||
import com.stdiet.custom.mapper.SysDishesMapper;
|
||||
import com.stdiet.custom.service.ISysDishesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -71,6 +70,10 @@ public class SysDishesServiceImpl implements ISysDishesService {
|
||||
sysDishes.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = sysDishesMapper.insertSysDishes(sysDishes);
|
||||
//
|
||||
insertRecommand(sysDishes);
|
||||
//
|
||||
insertNotRecommand(sysDishes);
|
||||
//
|
||||
insertDishesIngredient(sysDishes);
|
||||
return rows;
|
||||
}
|
||||
@ -96,11 +99,61 @@ public class SysDishesServiceImpl implements ISysDishesService {
|
||||
public int updateSysDishes(SysDishes sysDishes) {
|
||||
sysDishes.setUpdateTime(DateUtils.getNowDate());
|
||||
Long dishesId = sysDishes.getId();
|
||||
//
|
||||
sysDishesMapper.deleteDishesRecByDishesId(dishesId);
|
||||
insertRecommand(sysDishes);
|
||||
//
|
||||
sysDishesMapper.deleteDishesNotRecByDishesId(dishesId);
|
||||
insertNotRecommand(sysDishes);
|
||||
//
|
||||
sysDishesMapper.deleteIngredientById(dishesId);
|
||||
insertDishesIngredient(sysDishes);
|
||||
//
|
||||
return sysDishesMapper.updateSysDishes(sysDishes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增推荐标签
|
||||
*
|
||||
* @param sysDishes
|
||||
*/
|
||||
public void insertRecommand(SysDishes sysDishes) {
|
||||
Long[] recIds = sysDishes.getRecIds();
|
||||
if (StringUtils.isNotNull(recIds)) {
|
||||
List<SysPhysicalSignsObj> list = new ArrayList<>();
|
||||
for (Long recId : recIds) {
|
||||
SysPhysicalSignsObj rec = new SysPhysicalSignsObj();
|
||||
rec.setTargetId(sysDishes.getId());
|
||||
rec.setPhysicalSignsId(recId);
|
||||
list.add(rec);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
sysDishesMapper.batchInsertDishesRec(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增不推荐标签
|
||||
*
|
||||
* @param sysDishes
|
||||
*/
|
||||
public void insertNotRecommand(SysDishes sysDishes) {
|
||||
Long[] notRecIds = sysDishes.getNotRecIds();
|
||||
if (StringUtils.isNotNull(notRecIds)) {
|
||||
List<SysPhysicalSignsObj> list = new ArrayList<>();
|
||||
for (Long recId : notRecIds) {
|
||||
SysPhysicalSignsObj notRec = new SysPhysicalSignsObj();
|
||||
notRec.setTargetId(sysDishes.getId());
|
||||
notRec.setPhysicalSignsId(recId);
|
||||
list.add(notRec);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
sysDishesMapper.batchInsertDishesNotRec(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜品
|
||||
*
|
||||
@ -129,4 +182,5 @@ public class SysDishesServiceImpl implements ISysDishesService {
|
||||
public String getDishesMenuTypeById(Long id) {
|
||||
return sysDishesMapper.getDishesMenuTypeById(id);
|
||||
}
|
||||
|
||||
}
|
@ -6,8 +6,7 @@ import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import com.stdiet.custom.domain.SysIngredentFile;
|
||||
import com.stdiet.custom.domain.SysIngredient;
|
||||
import com.stdiet.custom.domain.SysIngredientNotRec;
|
||||
import com.stdiet.custom.domain.SysIngredientRec;
|
||||
import com.stdiet.custom.domain.SysPhysicalSignsObj;
|
||||
import com.stdiet.custom.mapper.SysIngredientMapper;
|
||||
import com.stdiet.custom.service.ISysIngredientService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -96,11 +95,11 @@ public class SysIngredientServiceImpl implements ISysIngredientService {
|
||||
public void insertRecommand(SysIngredient ingredient) {
|
||||
Long[] recIds = ingredient.getRecIds();
|
||||
if (StringUtils.isNotNull(recIds)) {
|
||||
List<SysIngredientRec> list = new ArrayList<SysIngredientRec>();
|
||||
List<SysPhysicalSignsObj> list = new ArrayList<SysPhysicalSignsObj>();
|
||||
for (Long recId : recIds) {
|
||||
SysIngredientRec rec = new SysIngredientRec();
|
||||
rec.setIngredientId(ingredient.getId());
|
||||
rec.setRecommandId(recId);
|
||||
SysPhysicalSignsObj rec = new SysPhysicalSignsObj();
|
||||
rec.setTargetId(ingredient.getId());
|
||||
rec.setPhysicalSignsId(recId);
|
||||
list.add(rec);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
@ -117,11 +116,11 @@ public class SysIngredientServiceImpl implements ISysIngredientService {
|
||||
public void insertNotRecommand(SysIngredient ingredient) {
|
||||
Long[] notRecIds = ingredient.getNotRecIds();
|
||||
if (StringUtils.isNotNull(notRecIds)) {
|
||||
List<SysIngredientNotRec> list = new ArrayList<SysIngredientNotRec>();
|
||||
List<SysPhysicalSignsObj> list = new ArrayList<SysPhysicalSignsObj>();
|
||||
for (Long recId : notRecIds) {
|
||||
SysIngredientNotRec notRec = new SysIngredientNotRec();
|
||||
notRec.setIngredientId(ingredient.getId());
|
||||
notRec.setRecommandId(recId);
|
||||
SysPhysicalSignsObj notRec = new SysPhysicalSignsObj();
|
||||
notRec.setTargetId(ingredient.getId());
|
||||
notRec.setPhysicalSignsId(recId);
|
||||
list.add(notRec);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
@ -160,12 +159,16 @@ public class SysIngredientServiceImpl implements ISysIngredientService {
|
||||
public int updateSysIngredient(SysIngredient sysIngredient) {
|
||||
sysIngredient.setUpdateTime(DateUtils.getNowDate());
|
||||
Long ingredientId = sysIngredient.getId();
|
||||
//
|
||||
sysIngredientMapper.deleteIngredientNotRecByIngredientId(ingredientId);
|
||||
insertNotRecommand(sysIngredient);
|
||||
//
|
||||
sysIngredientMapper.deleteIngredientRecByIngredientId(ingredientId);
|
||||
insertRecommand(sysIngredient);
|
||||
//
|
||||
sysIngredientMapper.deleteIngredientImageById(ingredientId);
|
||||
insertImageFiles(sysIngredient);
|
||||
//
|
||||
return sysIngredientMapper.updateSysIngredient(sysIngredient);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
<!-- 非持久化字段 -->
|
||||
<result property="bigClassName" column="bigClassName"/>
|
||||
<result property="smallClassName" column="smallClassName"/>
|
||||
<association property="igdList" column="id" select="selectSysIngreditentsById"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="SysDishesIngredient" id="SysDishesIngredientResult">
|
||||
@ -32,7 +33,9 @@
|
||||
<result property="carbonRatio" column="carbon_ratio"/>
|
||||
<result property="area" column="area"/>
|
||||
<result property="rec" column="rec"/>
|
||||
<result property="recIdsStr" column="rec_ids"/>
|
||||
<result property="notRec" column="not_rec"/>
|
||||
<result property="notRecIdsStr" column="not_rec_ids"/>
|
||||
<result property="cusWeight" column="cus_weight"/>
|
||||
<result property="cusUnit" column="cus_unit"/>
|
||||
<result property="weight" column="weight"/>
|
||||
@ -47,6 +50,9 @@
|
||||
<where>
|
||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||
<if test="type != null and type != ''">and FIND_IN_SET(#{type}, type)</if>
|
||||
<if test="physical != null and physical != ''">
|
||||
and id in(SELECT DISTINCT(dishes_id) FROM sys_dishes_rec WHERE physical_signs_id = #{physical})
|
||||
</if>
|
||||
<if test="bigClass != null">and big_class = #{bigClass}</if>
|
||||
<if test="smallClass != null">and small_class = #{smallClass}</if>
|
||||
<if test="reviewStatus != null and type != ''">and review_status = #{reviewStatus}</if>
|
||||
@ -63,17 +69,17 @@
|
||||
WHERE dishes_id = #{id}
|
||||
) dishes
|
||||
LEFT JOIN (
|
||||
SELECT id, name, type, protein_ratio, fat_ratio, carbon_ratio, area, not_rec, rec
|
||||
SELECT id, name, type, protein_ratio, fat_ratio, carbon_ratio, area, not_rec, not_rec_ids, rec, rec_ids
|
||||
FROM sys_ingredient igd
|
||||
LEFT JOIN (
|
||||
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
|
||||
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec, GROUP_CONCAT(notRec.id SEPARATOR ',') not_rec_ids 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 ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec, GROUP_CONCAT(rec.id SEPARATOR ',') rec_ids FROM(
|
||||
SELECT physical_signs_id as id, ingredient_id
|
||||
FROM sys_ingredient_rec
|
||||
) rec JOIN sys_physical_signs phy USING(id)
|
||||
@ -175,4 +181,27 @@
|
||||
select type from sys_dishes where id=#{id}
|
||||
</select>
|
||||
|
||||
<!-- 推荐,不推荐-->
|
||||
<insert id="batchInsertDishesRec">
|
||||
insert into sys_dishes_rec(dishes_id, physical_signs_id) values
|
||||
<foreach collection="list" separator="," item="item" index="index">
|
||||
(#{item.targetId},#{item.physicalSignsId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertDishesNotRec">
|
||||
insert into sys_dishes_not_rec(dishes_id, physical_signs_id) values
|
||||
<foreach collection="list" separator="," item="item" index="index">
|
||||
(#{item.targetId},#{item.physicalSignsId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteDishesRecByDishesId" parameterType="Long">
|
||||
delete from sys_dishes_rec where dishes_id=#{dishesId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDishesNotRecByDishesId" parameterType="Long">
|
||||
delete from sys_dishes_not_rec where dishes_id=#{dishesId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -149,14 +149,14 @@
|
||||
<insert id="batchIngredientRec">
|
||||
insert into sys_ingredient_rec(ingredient_id, physical_signs_id) values
|
||||
<foreach collection="list" separator="," item="item" index="index">
|
||||
(#{item.ingredientId},#{item.recommandId})
|
||||
(#{item.targetId},#{item.physicalSignsId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchIngredientNotRec">
|
||||
insert into sys_ingredient_not_rec(ingredient_id, physical_signs_id) values
|
||||
<foreach collection="list" separator="," item="item" index="index">
|
||||
(#{item.ingredientId},#{item.notRecommandId})
|
||||
(#{item.targetId},#{item.physicalSignsId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
@ -5,27 +5,30 @@
|
||||
<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" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="typeId" column="type_id"/>
|
||||
<result property="typeName" column="type_name"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysPhysicalSignsVo">
|
||||
select id, name, type_id, remark from sys_physical_signs
|
||||
SELECT name, id, sdd.dict_label AS type_name, type_id FROM sys_physical_signs
|
||||
LEFT JOIN (SELECT * FROM sys_dict_data WHERE dict_type = 'cus_signs_type') AS sdd ON sdd.dict_value = type_id
|
||||
</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>
|
||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||
<if test="typeId != null ">and type_id = #{typeId}</if>
|
||||
</where>
|
||||
ORDER BY type_id ASC
|
||||
</select>
|
||||
|
||||
<select id="selectSysPhysicalSignsById" parameterType="Long" resultMap="SysPhysicalSignsResult">
|
||||
<include refid="selectSysPhysicalSignsVo"/>
|
||||
where id = #{id}
|
||||
where sps.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysPhysicalSigns" parameterType="SysPhysicalSigns" useGeneratedKeys="true" keyProperty="id">
|
||||
@ -63,4 +66,5 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
@ -33,6 +33,7 @@
|
||||
:data="orderList"
|
||||
v-loading="loading"
|
||||
row-key="orderId"
|
||||
height="700"
|
||||
default-expand-all
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
|
@ -14,6 +14,7 @@ import { getRecipesPlan, updateRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { addShortCut } from "@/utils/shortCutUtils";
|
||||
import { messageTypes } from "@/utils";
|
||||
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
|
||||
|
||||
const oriState = {
|
||||
cusId: undefined,
|
||||
@ -46,6 +47,7 @@ const oriState = {
|
||||
notRecIgds: [],
|
||||
avoidFoodIds: [],
|
||||
igdTypeOptions: [],
|
||||
physicalSignsOptions: [],
|
||||
//
|
||||
curShortCutObj: {}
|
||||
};
|
||||
@ -175,6 +177,31 @@ const actions = {
|
||||
getDicts("cus_ing_type").then(response => {
|
||||
commit("updateStateData", { igdTypeOptions: response.data });
|
||||
});
|
||||
listPhysicalSigns().then(response => {
|
||||
commit("updateStateData", {
|
||||
physicalSignsOptions: response.rows.reduce((arr, cur) => {
|
||||
const tarTypeObj = arr.find(obj => obj.value === cur.typeId);
|
||||
if (!tarTypeObj) {
|
||||
arr.push({
|
||||
value: cur.typeId,
|
||||
label: cur.typeName,
|
||||
children: [
|
||||
{
|
||||
value: cur.id,
|
||||
label: cur.name
|
||||
}
|
||||
]
|
||||
});
|
||||
} else {
|
||||
tarTypeObj.children.push({
|
||||
value: cur.id,
|
||||
label: cur.name
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}, [])
|
||||
});
|
||||
});
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
// 健康数据
|
||||
|
@ -149,7 +149,10 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="handleOnDelete(scope.row)"
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handleOnDelete(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
@ -252,6 +255,8 @@ export default {
|
||||
//
|
||||
selRec: [],
|
||||
selNotRec: [],
|
||||
selRecIds: [],
|
||||
selNotRecIds: [],
|
||||
};
|
||||
},
|
||||
props: [
|
||||
@ -265,24 +270,41 @@ export default {
|
||||
"form.igdList": function (val) {
|
||||
const selRec = [];
|
||||
const selNotRec = [];
|
||||
const selRecIds = [];
|
||||
const selNotRecIds = [];
|
||||
val.forEach((obj) => {
|
||||
if (obj.rec) {
|
||||
obj.rec.split(",").forEach((rec) => {
|
||||
if (!selRec.includes(rec)) {
|
||||
selRec.push(rec);
|
||||
}
|
||||
});
|
||||
obj.rec
|
||||
.split(",")
|
||||
.forEach((rec) => !selRec.includes(rec) && selRec.push(rec));
|
||||
}
|
||||
if (obj.notRec) {
|
||||
obj.notRec.split(",").forEach((notRec) => {
|
||||
if (!selNotRec.includes(notRec)) {
|
||||
selNotRec.push(notRec);
|
||||
}
|
||||
});
|
||||
obj.notRec
|
||||
.split(",")
|
||||
.forEach(
|
||||
(notRec) => !selNotRec.includes(notRec) && selNotRec.push(notRec)
|
||||
);
|
||||
}
|
||||
if (obj.recIdsStr) {
|
||||
obj.recIdsStr
|
||||
.split(",")
|
||||
.forEach(
|
||||
(recId) => !selRecIds.includes(recId) && selRecIds.push(recId)
|
||||
);
|
||||
}
|
||||
if (obj.notRecIdsStr) {
|
||||
obj.notRecIdsStr
|
||||
.split(",")
|
||||
.forEach(
|
||||
(notRecId) =>
|
||||
!selNotRecIds.includes(notRecId) && selNotRecIds.push(notRecId)
|
||||
);
|
||||
}
|
||||
});
|
||||
this.selRec = selRec;
|
||||
this.selNotRec = selNotRec;
|
||||
this.selRecIds = selRecIds;
|
||||
this.selNotRecIds = selNotRecIds;
|
||||
},
|
||||
|
||||
showNotRec() {
|
||||
@ -362,6 +384,8 @@ export default {
|
||||
const data = JSON.parse(JSON.stringify(this.form));
|
||||
// console.log({ data });
|
||||
data.type = data.type.join(",");
|
||||
data.recIds = this.selRecIds;
|
||||
data.notRecIds = this.selNotRecIds;
|
||||
if (data.id != null) {
|
||||
updateDishes(data).then((response) => {
|
||||
if (response.code === 200) {
|
||||
|
@ -137,7 +137,11 @@
|
||||
<autohideinfo :data="scope.row.notRecTags" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="做法" align="center" prop="methods" />
|
||||
<el-table-column label="做法" align="center" prop="methods">
|
||||
<template slot-scope="scope">
|
||||
<auto-hide-message :data="scope.row.methods" :maxLength="20" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
@ -188,12 +192,14 @@
|
||||
<script>
|
||||
import { delDishes, exportDishes, listDishes } from "@/api/custom/dishes";
|
||||
import AutoHideInfo from "@/components/AutoHideInfo";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import EditDishesDrawer from "./EditDishesDrawer";
|
||||
|
||||
export default {
|
||||
name: "Dishes",
|
||||
components: {
|
||||
autohideinfo: AutoHideInfo,
|
||||
AutoHideMessage,
|
||||
EditDishesDrawer,
|
||||
},
|
||||
data() {
|
||||
@ -374,7 +380,7 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$confirm('是否确认删除菜品「' + row.name + '」的数据项?', "警告", {
|
||||
this.$confirm("是否确认删除菜品「" + row.name + "」的数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
|
@ -52,6 +52,20 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="推荐体征" prop="physical">
|
||||
<el-cascader
|
||||
:disabled="lockType"
|
||||
v-model="queryParams.physical"
|
||||
placeholder="请选择推荐体征"
|
||||
clearable
|
||||
:options="physicalSignsOptions"
|
||||
size="mini"
|
||||
width="120px"
|
||||
@change="handleOnPhysicalSignsChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
@ -71,7 +85,7 @@
|
||||
v-loading="loading"
|
||||
size="mini"
|
||||
:data="dishesList"
|
||||
height="600"
|
||||
height="550"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
@ -141,6 +155,7 @@ export default {
|
||||
smallClass: null,
|
||||
bigClass: null,
|
||||
reviewStatus: "yes",
|
||||
physical: null,
|
||||
},
|
||||
//菜品种类查询参数
|
||||
dishClassQueryParam: [],
|
||||
@ -155,6 +170,7 @@ export default {
|
||||
"typeOptions",
|
||||
"dishBigClassOptions",
|
||||
"dishSmallClassOptions",
|
||||
"physicalSignsOptions",
|
||||
]),
|
||||
...mapGetters(["dishClassOptions"]),
|
||||
},
|
||||
@ -174,7 +190,13 @@ export default {
|
||||
this.queryParams.smallClass = null;
|
||||
}
|
||||
this.loading = true;
|
||||
listDishes(this.queryParams).then((result) => {
|
||||
const qParams = {
|
||||
...this.queryParams,
|
||||
};
|
||||
if (this.queryParams.physical) {
|
||||
qParams.physical = this.queryParams.physical[1];
|
||||
}
|
||||
listDishes(qParams).then((result) => {
|
||||
this.dishesList = result.rows.map((d) => {
|
||||
const recTags = [],
|
||||
notRecTags = [];
|
||||
@ -249,6 +271,10 @@ export default {
|
||||
}
|
||||
return "";
|
||||
},
|
||||
handleOnPhysicalSignsChange(val) {
|
||||
const [typeId, id] = val;
|
||||
console.log(val);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user