完成食材管理页面
This commit is contained in:
		| @@ -1,67 +1,91 @@ | ||||
| package com.stdiet.custom.domain; | ||||
|  | ||||
| import java.math.BigDecimal; | ||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | ||||
| import org.apache.commons.lang3.builder.ToStringStyle; | ||||
| import com.stdiet.common.annotation.Excel; | ||||
| import com.stdiet.common.core.domain.BaseEntity; | ||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | ||||
| import org.apache.commons.lang3.builder.ToStringStyle; | ||||
|  | ||||
| import java.math.BigDecimal; | ||||
|  | ||||
| /** | ||||
|  * 食材对象 sys_ingredient | ||||
|  *  | ||||
|  * | ||||
|  * @author wonder | ||||
|  * @date 2020-12-15 | ||||
|  */ | ||||
| public class SysIngredient extends BaseEntity | ||||
| { | ||||
| public class SysIngredient extends BaseEntity { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     /** id */ | ||||
|     /** | ||||
|      * id | ||||
|      */ | ||||
|     private Long id; | ||||
|  | ||||
|     /** 食材名称 */ | ||||
|     /** | ||||
|      * 食材名称 | ||||
|      */ | ||||
|     @Excel(name = "食材名称") | ||||
|     private String name; | ||||
|  | ||||
|     /** 食材类别 */ | ||||
|     /** | ||||
|      * 食材类别 | ||||
|      */ | ||||
|     @Excel(name = "食材类别") | ||||
|     private String type; | ||||
|  | ||||
|     /** 推荐分量估算 */ | ||||
|     /** | ||||
|      * 推荐分量估算 | ||||
|      */ | ||||
|     @Excel(name = "推荐分量估算") | ||||
|     private Long recEstimation; | ||||
|  | ||||
|     /** 推荐分量估算单位id */ | ||||
|     /** | ||||
|      * 推荐分量估算单位id | ||||
|      */ | ||||
|     @Excel(name = "推荐分量估算单位id") | ||||
|     private Long recEstUnit; | ||||
|  | ||||
|     /** 推荐分量 */ | ||||
|     /** | ||||
|      * 推荐分量 | ||||
|      */ | ||||
|     @Excel(name = "推荐分量") | ||||
|     private Long recPortion; | ||||
|  | ||||
|     /** 蛋白质比例 */ | ||||
|     /** | ||||
|      * 蛋白质比例 | ||||
|      */ | ||||
|     @Excel(name = "蛋白质比例") | ||||
|     private BigDecimal proteinRatio; | ||||
|  | ||||
|     /** 脂肪比例 */ | ||||
|     /** | ||||
|      * 脂肪比例 | ||||
|      */ | ||||
|     @Excel(name = "脂肪比例") | ||||
|     private BigDecimal fatRatio; | ||||
|  | ||||
|     /** 碳水比例 */ | ||||
|     /** | ||||
|      * 碳水比例 | ||||
|      */ | ||||
|     @Excel(name = "碳水比例") | ||||
|     private BigDecimal carbonRatio; | ||||
|  | ||||
|     /** 地域 */ | ||||
|     /** | ||||
|      * 地域 | ||||
|      */ | ||||
|     @Excel(name = "地域") | ||||
|     private String area; | ||||
|  | ||||
|     /** 忌口 */ | ||||
|     @Excel(name = "忌口") | ||||
|     /** | ||||
|      * 忌口 | ||||
|      */ | ||||
|     @Excel(name = "忌口人群") | ||||
|     private String notRec; | ||||
|  | ||||
|     /** 推荐 */ | ||||
|     @Excel(name = "推荐") | ||||
|     private String recommend; | ||||
|     /** | ||||
|      * 推荐 | ||||
|      */ | ||||
|     @Excel(name = "推荐人群") | ||||
|     private String rec; | ||||
|  | ||||
|     private Long[] recIds; | ||||
|  | ||||
| @@ -75,143 +99,122 @@ public class SysIngredient extends BaseEntity | ||||
|         return notRecIds; | ||||
|     } | ||||
|  | ||||
|     public void setNotRecIds(Long[] notRecIds) { | ||||
|         this.notRecIds = notRecIds; | ||||
|     public Long getId() { | ||||
|         return id; | ||||
|     } | ||||
|  | ||||
|     public void setRedIds(Long[] recIds) { | ||||
|         this.recIds = recIds; | ||||
|     } | ||||
|  | ||||
|     public void setId(Long id) | ||||
|     { | ||||
|     public void setId(Long id) { | ||||
|         this.id = id; | ||||
|     } | ||||
|  | ||||
|     public Long getId()  | ||||
|     { | ||||
|         return id; | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|     public void setName(String name)  | ||||
|     { | ||||
|  | ||||
|     public void setName(String name) { | ||||
|         this.name = name; | ||||
|     } | ||||
|  | ||||
|     public String getName()  | ||||
|     { | ||||
|         return name; | ||||
|     public String getType() { | ||||
|         return type; | ||||
|     } | ||||
|     public void setType(String type)  | ||||
|     { | ||||
|  | ||||
|     public void setType(String type) { | ||||
|         this.type = type; | ||||
|     } | ||||
|  | ||||
|     public String getType()  | ||||
|     { | ||||
|         return type; | ||||
|     public Long getRecEstimation() { | ||||
|         return recEstimation; | ||||
|     } | ||||
|     public void setRecEstimation(Long recEstimation)  | ||||
|     { | ||||
|  | ||||
|     public void setRecEstimation(Long recEstimation) { | ||||
|         this.recEstimation = recEstimation; | ||||
|     } | ||||
|  | ||||
|     public Long getRecEstimation()  | ||||
|     { | ||||
|         return recEstimation; | ||||
|     public Long getRecEstUnit() { | ||||
|         return recEstUnit; | ||||
|     } | ||||
|     public void setRecEstUnit(Long recEstUnit)  | ||||
|     { | ||||
|  | ||||
|     public void setRecEstUnit(Long recEstUnit) { | ||||
|         this.recEstUnit = recEstUnit; | ||||
|     } | ||||
|  | ||||
|     public Long getRecEstUnit()  | ||||
|     { | ||||
|         return recEstUnit; | ||||
|     public Long getRecPortion() { | ||||
|         return recPortion; | ||||
|     } | ||||
|     public void setRecPortion(Long recPortion)  | ||||
|     { | ||||
|  | ||||
|     public void setRecPortion(Long recPortion) { | ||||
|         this.recPortion = recPortion; | ||||
|     } | ||||
|  | ||||
|     public Long getRecPortion()  | ||||
|     { | ||||
|         return recPortion; | ||||
|     public BigDecimal getProteinRatio() { | ||||
|         return proteinRatio; | ||||
|     } | ||||
|     public void setProteinRatio(BigDecimal proteinRatio)  | ||||
|     { | ||||
|  | ||||
|     public void setProteinRatio(BigDecimal proteinRatio) { | ||||
|         this.proteinRatio = proteinRatio; | ||||
|     } | ||||
|  | ||||
|     public BigDecimal getProteinRatio()  | ||||
|     { | ||||
|         return proteinRatio; | ||||
|     public BigDecimal getFatRatio() { | ||||
|         return fatRatio; | ||||
|     } | ||||
|     public void setFatRatio(BigDecimal fatRatio)  | ||||
|     { | ||||
|  | ||||
|     public void setFatRatio(BigDecimal fatRatio) { | ||||
|         this.fatRatio = fatRatio; | ||||
|     } | ||||
|  | ||||
|     public BigDecimal getFatRatio()  | ||||
|     { | ||||
|         return fatRatio; | ||||
|     public BigDecimal getCarbonRatio() { | ||||
|         return carbonRatio; | ||||
|     } | ||||
|     public void setCarbonRatio(BigDecimal carbonRatio)  | ||||
|     { | ||||
|  | ||||
|     public void setCarbonRatio(BigDecimal carbonRatio) { | ||||
|         this.carbonRatio = carbonRatio; | ||||
|     } | ||||
|  | ||||
|     public BigDecimal getCarbonRatio()  | ||||
|     { | ||||
|         return carbonRatio; | ||||
|     public String getArea() { | ||||
|         return area; | ||||
|     } | ||||
|     public void setArea(String area)  | ||||
|     { | ||||
|  | ||||
|     public void setArea(String area) { | ||||
|         this.area = area; | ||||
|     } | ||||
|  | ||||
|     public String getArea()  | ||||
|     { | ||||
|         return area; | ||||
|     public String getNotRec() { | ||||
|         return notRec; | ||||
|     } | ||||
|     public void setNotRec(String notRec) | ||||
|     { | ||||
|  | ||||
|     public void setNotRec(String notRec) { | ||||
|         this.notRec = notRec; | ||||
|     } | ||||
|  | ||||
|     public String getNotRec() | ||||
|     { | ||||
|         return notRec; | ||||
|     } | ||||
|     public void setRecommend(String recommend) | ||||
|     { | ||||
|         this.recommend = recommend; | ||||
|     public String getRec() { | ||||
|         return rec; | ||||
|     } | ||||
|  | ||||
|     public String getRecommend() | ||||
|     { | ||||
|         return recommend; | ||||
|     public void setRec(String rec) { | ||||
|         this.rec = rec; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String toString() { | ||||
|         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||||
|             .append("id", getId()) | ||||
|             .append("name", getName()) | ||||
|             .append("type", getType()) | ||||
|             .append("recEstimation", getRecEstimation()) | ||||
|             .append("recEstUnit", getRecEstUnit()) | ||||
|             .append("recPortion", getRecPortion()) | ||||
|             .append("proteinRatio", getProteinRatio()) | ||||
|             .append("fatRatio", getFatRatio()) | ||||
|             .append("carbonRatio", getCarbonRatio()) | ||||
|             .append("remark", getRemark()) | ||||
|             .append("area", getArea()) | ||||
|             .append("notRec", getNotRec()) | ||||
|             .append("recommend", getRecommend()) | ||||
|             .append("createBy", getCreateBy()) | ||||
|             .append("createTime", getCreateTime()) | ||||
|             .append("updateBy", getUpdateBy()) | ||||
|             .append("updateTime", getUpdateTime()) | ||||
|             .toString(); | ||||
|         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) | ||||
|                 .append("id", getId()) | ||||
|                 .append("name", getName()) | ||||
|                 .append("type", getType()) | ||||
|                 .append("recEstimation", getRecEstimation()) | ||||
|                 .append("recEstUnit", getRecEstUnit()) | ||||
|                 .append("recPortion", getRecPortion()) | ||||
|                 .append("proteinRatio", getProteinRatio()) | ||||
|                 .append("fatRatio", getFatRatio()) | ||||
|                 .append("carbonRatio", getCarbonRatio()) | ||||
|                 .append("remark", getRemark()) | ||||
|                 .append("area", getArea()) | ||||
|                 .append("notRec", getNotRec()) | ||||
|                 .append("recommend", getRec()) | ||||
|                 .append("createBy", getCreateBy()) | ||||
|                 .append("createTime", getCreateTime()) | ||||
|                 .append("updateBy", getUpdateBy()) | ||||
|                 .append("updateTime", getUpdateTime()) | ||||
|                 .toString(); | ||||
|     } | ||||
| } | ||||
| @@ -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(); | ||||
|     } | ||||
| } | ||||
| @@ -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); | ||||
| } | ||||
| @@ -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); | ||||
| } | ||||
| @@ -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); | ||||
|     } | ||||
| } | ||||
| @@ -17,10 +17,27 @@ | ||||
|         <result property="createTime"    column="create_time"    /> | ||||
|         <result property="updateBy"    column="update_by"    /> | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
|         <result property="rec"    column="rec"    /> | ||||
|         <result property="notRec"    column="not_rec"    /> | ||||
|     </resultMap> | ||||
|  | ||||
|     <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 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> | ||||
|  | ||||
|     <select id="selectSysIngredientList" parameterType="SysIngredient" resultMap="SysIngredientResult"> | ||||
| @@ -68,14 +85,14 @@ | ||||
|     </insert> | ||||
|  | ||||
|     <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"> | ||||
|             (#{item.ingredientId},#{item.recommandId}) | ||||
|         </foreach> | ||||
|     </insert> | ||||
|  | ||||
|     <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"> | ||||
|             (#{item.ingredientId},#{item.notRecommandId}) | ||||
|         </foreach> | ||||
|   | ||||
| @@ -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> | ||||
		Reference in New Issue
	
	Block a user