From a45060a87c2588d13c86043c26598f5feadbdc4f Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Fri, 23 Apr 2021 11:30:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=8A=BD=E5=B1=89?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stdiet-ui/src/components/OrderDrawer/index.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/stdiet-ui/src/components/OrderDrawer/index.vue b/stdiet-ui/src/components/OrderDrawer/index.vue index 2d8237515..2d7af068a 100644 --- a/stdiet-ui/src/components/OrderDrawer/index.vue +++ b/stdiet-ui/src/components/OrderDrawer/index.vue @@ -33,6 +33,7 @@ :data="orderList" v-loading="loading" row-key="orderId" + height="700" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" > From a24a9e8674687aaf384bcddf12a1a6cbc0514698 Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Tue, 27 Apr 2021 11:55:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A3=9F=E8=B0=B1?= =?UTF-8?q?=E5=88=B6=E4=BD=9C=E6=97=B6=E6=8C=89=E7=97=85=E7=97=87=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/SysDishesController.java | 11 +--- .../com/stdiet/custom/domain/SysDishes.java | 6 ++ .../custom/domain/SysDishesIngredient.java | 3 + .../stdiet/custom/domain/SysIngredient.java | 1 - .../custom/domain/SysIngredientNotRec.java | 30 --------- .../custom/domain/SysIngredientRec.java | 30 --------- .../custom/domain/SysPhysicalSigns.java | 61 +++++-------------- .../custom/domain/SysPhysicalSignsObj.java | 11 ++++ .../stdiet/custom/mapper/SysDishesMapper.java | 34 +++++++---- .../custom/mapper/SysIngredientMapper.java | 7 +-- .../custom/service/ISysDishesService.java | 2 + .../service/impl/SysDishesServiceImpl.java | 58 +++++++++++++++++- .../impl/SysIngredientServiceImpl.java | 23 ++++--- .../mapper/custom/SysDishesMapper.xml | 35 ++++++++++- .../mapper/custom/SysIngredientMapper.xml | 4 +- .../mapper/custom/SysPhysicalSignsMapper.xml | 20 +++--- stdiet-ui/src/store/modules/recipes.js | 27 ++++++++ .../custom/dishes/EditDishesDrawer/index.vue | 46 ++++++++++---- stdiet-ui/src/views/custom/dishes/index.vue | 10 ++- .../AddDishesDrawer/SelectDishes.vue | 30 ++++++++- 20 files changed, 275 insertions(+), 174 deletions(-) delete mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredientNotRec.java delete mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredientRec.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/domain/SysPhysicalSignsObj.java diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysDishesController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysDishesController.java index 513f585d4..af5b66e53 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysDishesController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysDishesController.java @@ -37,16 +37,7 @@ public class SysDishesController extends BaseController { @GetMapping("/list") public TableDataInfo list(SysDishes sysDishes) { startPage(); - List list = sysDishesService.selectSysDishesList(sysDishes); - for (SysDishes dishes : list) { - List 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)); } /** diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysDishes.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysDishes.java index 8473a063d..68d0f41b4 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysDishes.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysDishes.java @@ -89,4 +89,10 @@ public class SysDishes { private Integer[] dishClass; + private Long[] notRecIds; + + private Long[] recIds; + + private String physical; + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysDishesIngredient.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysDishesIngredient.java index 092dce023..87ee817fe 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysDishesIngredient.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysDishesIngredient.java @@ -31,5 +31,8 @@ public class SysDishesIngredient extends SysIngredient { private String cus_weight; + private String recIdsStr; + + private String notRecIdsStr; } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredient.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredient.java index 0898611a0..296723132 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredient.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredient.java @@ -101,7 +101,6 @@ public class SysIngredient { */ private String remark; - private Long[] recIds; private Long[] notRecIds; diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredientNotRec.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredientNotRec.java deleted file mode 100644 index 059347528..000000000 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredientNotRec.java +++ /dev/null @@ -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 + - '}'; - } -} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredientRec.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredientRec.java deleted file mode 100644 index c1cb0ec09..000000000 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredientRec.java +++ /dev/null @@ -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 + - '}'; - } -} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysPhysicalSigns.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysPhysicalSigns.java index b5a70c8a9..6b633c702 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysPhysicalSigns.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysPhysicalSigns.java @@ -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(); - } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysPhysicalSignsObj.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysPhysicalSignsObj.java new file mode 100644 index 000000000..ff5066c4a --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysPhysicalSignsObj.java @@ -0,0 +1,11 @@ +package com.stdiet.custom.domain; + +import lombok.Data; + +@Data +public class SysPhysicalSignsObj { + + Long targetId; + + Long physicalSignsId; +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysDishesMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysDishesMapper.java index 29d909707..58cea23e5 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysDishesMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysDishesMapper.java @@ -1,23 +1,22 @@ 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接口 - * + * * @author wonder * @date 2020-12-28 */ -public interface SysDishesMapper -{ +public interface SysDishesMapper { /** * 查询菜品 - * + * * @param id 菜品ID * @return 菜品 */ @@ -27,7 +26,7 @@ public interface SysDishesMapper /** * 查询菜品列表 - * + * * @param sysDishes 菜品 * @return 菜品集合 */ @@ -35,7 +34,7 @@ public interface SysDishesMapper /** * 新增菜品 - * + * * @param sysDishes 菜品 * @return 结果 */ @@ -43,7 +42,7 @@ public interface SysDishesMapper /** * 修改菜品 - * + * * @param sysDishes 菜品 * @return 结果 */ @@ -51,7 +50,7 @@ public interface SysDishesMapper /** * 删除菜品 - * + * * @param id 菜品ID * @return 结果 */ @@ -59,7 +58,7 @@ public interface SysDishesMapper /** * 批量删除菜品 - * + * * @param ids 需要删除的数据ID * @return 结果 */ @@ -72,4 +71,13 @@ public interface SysDishesMapper public int bashInsertDishesIngredent(List sysDishesIngredients); String getDishesMenuTypeById(Long id); + + int batchInsertDishesRec(List sysPhysicalSignsObj); + + int batchInsertDishesNotRec(List sysPhysicalSignsObj); + + int deleteDishesRecByDishesId(Long dishesId); + + int deleteDishesNotRecByDishesId(Long dishesId); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java index 063113307..fc4586508 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java @@ -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 ingredientRecList); + int batchIngredientRec(List ingredientRecList); - int batchIngredientNotRec(List ingredientNotRecList); + int batchIngredientNotRec(List ingredientNotRecList); int deleteIngredientRecByIngredientId(Long recId); diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysDishesService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysDishesService.java index d10d38c01..03f058e11 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysDishesService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysDishesService.java @@ -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); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysDishesServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysDishesServiceImpl.java index 322b978ba..906493262 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysDishesServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysDishesServiceImpl.java @@ -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 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 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); } + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java index 50cb3f521..1b1635d13 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java @@ -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 list = new ArrayList(); + List list = new ArrayList(); 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 list = new ArrayList(); + List list = new ArrayList(); 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); } diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysDishesMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysDishesMapper.xml index a9a167234..d19bc5ef0 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysDishesMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysDishesMapper.xml @@ -21,6 +21,7 @@ + @@ -32,7 +33,9 @@ + + @@ -47,6 +50,9 @@ and name like concat('%', #{name}, '%') and FIND_IN_SET(#{type}, type) + + and id in(SELECT DISTINCT(dishes_id) FROM sys_dishes_rec WHERE physical_signs_id = #{physical}) + and big_class = #{bigClass} and small_class = #{smallClass} and review_status = #{reviewStatus} @@ -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} + + + insert into sys_dishes_rec(dishes_id, physical_signs_id) values + + (#{item.targetId},#{item.physicalSignsId}) + + + + + insert into sys_dishes_not_rec(dishes_id, physical_signs_id) values + + (#{item.targetId},#{item.physicalSignsId}) + + + + + delete from sys_dishes_rec where dishes_id=#{dishesId} + + + + delete from sys_dishes_not_rec where dishes_id=#{dishesId} + + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml index c5d659d78..60ac3c111 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml @@ -149,14 +149,14 @@ insert into sys_ingredient_rec(ingredient_id, physical_signs_id) values - (#{item.ingredientId},#{item.recommandId}) + (#{item.targetId},#{item.physicalSignsId}) insert into sys_ingredient_not_rec(ingredient_id, physical_signs_id) values - (#{item.ingredientId},#{item.notRecommandId}) + (#{item.targetId},#{item.physicalSignsId}) diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml index 45466aca3..0c6493d6b 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysPhysicalSignsMapper.xml @@ -5,27 +5,30 @@ - - - - + + + + + - 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 @@ -63,4 +66,5 @@ + \ No newline at end of file diff --git a/stdiet-ui/src/store/modules/recipes.js b/stdiet-ui/src/store/modules/recipes.js index 2724e3c44..1fbe644f8 100644 --- a/stdiet-ui/src/store/modules/recipes.js +++ b/stdiet-ui/src/store/modules/recipes.js @@ -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) => { // 健康数据 diff --git a/stdiet-ui/src/views/custom/dishes/EditDishesDrawer/index.vue b/stdiet-ui/src/views/custom/dishes/EditDishesDrawer/index.vue index 2a0b99129..3e5377105 100644 --- a/stdiet-ui/src/views/custom/dishes/EditDishesDrawer/index.vue +++ b/stdiet-ui/src/views/custom/dishes/EditDishesDrawer/index.vue @@ -149,7 +149,10 @@ @@ -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) { diff --git a/stdiet-ui/src/views/custom/dishes/index.vue b/stdiet-ui/src/views/custom/dishes/index.vue index cd0424756..1690b4d8a 100644 --- a/stdiet-ui/src/views/custom/dishes/index.vue +++ b/stdiet-ui/src/views/custom/dishes/index.vue @@ -137,7 +137,11 @@ - + + + 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", diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/SelectDishes.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/SelectDishes.vue index 6da82ef87..4dd62b3e1 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/SelectDishes.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/SelectDishes.vue @@ -52,6 +52,20 @@ + + + + + @@ -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); + }, }, };