| @@ -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,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<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> | ||||
		Reference in New Issue
	
	Block a user