Merge branch 'develop' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
		| @@ -0,0 +1,27 @@ | ||||
| package com.stdiet.custom.domain; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.util.Date; | ||||
|  | ||||
| @Data | ||||
| public class SysIngredentFile { | ||||
|  | ||||
|     Long id; | ||||
|  | ||||
|     Long igdId; | ||||
|  | ||||
|     String fileUrl; | ||||
|  | ||||
|     String fileName; | ||||
|  | ||||
|     Integer delFlag; | ||||
|  | ||||
|     Long createBy; | ||||
|  | ||||
|     Date createTime; | ||||
|  | ||||
|     Long updateBy; | ||||
|  | ||||
|     Date updateTime; | ||||
| } | ||||
| @@ -15,8 +15,6 @@ import java.util.Date; | ||||
|  */ | ||||
| @Data | ||||
| public class SysIngredient { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     /** | ||||
|      * id | ||||
|      */ | ||||
| @@ -107,4 +105,9 @@ public class SysIngredient { | ||||
|  | ||||
|     private Long[] notRecIds; | ||||
|  | ||||
|     /** | ||||
|      * 食材信息 | ||||
|      */ | ||||
|     private String info; | ||||
|  | ||||
| } | ||||
| @@ -1,6 +1,8 @@ | ||||
| package com.stdiet.custom.mapper; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.custom.domain.SysIngredentFile; | ||||
| import com.stdiet.custom.domain.SysIngredient; | ||||
| import com.stdiet.custom.domain.SysIngredientNotRec; | ||||
| import com.stdiet.custom.domain.SysIngredientRec; | ||||
| @@ -80,4 +82,6 @@ public interface SysIngredientMapper | ||||
|      * @return | ||||
|      */ | ||||
|     public SysIngredient selectSysIngredientByName(@Param("name") String name); | ||||
|  | ||||
|     int batchInsertIngredientImage(List<SysIngredentFile> ingredentFiles); | ||||
| } | ||||
| @@ -60,6 +60,9 @@ public class SysIngredientServiceImpl implements ISysIngredientService { | ||||
|         insertRecommand(sysIngredient); | ||||
|         // | ||||
|         insertNotRecommand(sysIngredient); | ||||
|         // | ||||
|          | ||||
|  | ||||
|         return rows; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -37,6 +37,7 @@ | ||||
|         where del_flag = 0 | ||||
|         <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if> | ||||
|         <if test="phone != null  and phone != ''"> and phone like concat('%', #{phone}, '%')</if> | ||||
|         <if test="fansChannel != null "> and fans_channel = #{fansChannel}</if> | ||||
|         order by create_time desc | ||||
|     </select> | ||||
|  | ||||
|   | ||||
| @@ -5,21 +5,23 @@ | ||||
| <mapper namespace="com.stdiet.custom.mapper.SysIngredientMapper"> | ||||
|  | ||||
|     <resultMap type="SysIngredient" id="SysIngredientResult"> | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="name"    column="name"    /> | ||||
|         <result property="type"    column="type"    /> | ||||
|         <result property="proteinRatio"    column="protein_ratio"    /> | ||||
|         <result property="fatRatio"    column="fat_ratio"    /> | ||||
|         <result property="carbonRatio"    column="carbon_ratio"    /> | ||||
|         <result property="area"    column="area"    /> | ||||
|         <result property="remark"    column="remark"    /> | ||||
|         <result property="createBy"    column="create_by"    /> | ||||
|         <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"    /> | ||||
|         <result property="reviewStatus"    column="review_status"    /> | ||||
|         <result property="id" column="id"/> | ||||
|         <result property="name" column="name"/> | ||||
|         <result property="type" column="type"/> | ||||
|         <result property="proteinRatio" column="protein_ratio"/> | ||||
|         <result property="fatRatio" column="fat_ratio"/> | ||||
|         <result property="carbonRatio" column="carbon_ratio"/> | ||||
|         <result property="area" column="area"/> | ||||
|         <result property="remark" column="remark"/> | ||||
|         <result property="createBy" column="create_by"/> | ||||
|         <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"/> | ||||
|         <result property="reviewStatus" column="review_status"/> | ||||
|         <result property="info" column="info"/> | ||||
|         <association property="imgFiles" column="id" select="selectIngredentFileById"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysIngredientVo"> | ||||
| @@ -43,44 +45,44 @@ | ||||
|     <sql id="selectSysIngredientByPhyVo"> | ||||
|         SELECT * FROM sys_ingredient igd | ||||
|         RIGHT JOIN( | ||||
|             SELECT * FROM( | ||||
|                 SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_rec | ||||
|                 <where> | ||||
|                     <if test="recIds != null"> | ||||
|                         physical_signs_id in | ||||
|                         <foreach collection="recIds" item="item" index="index" open="(" separator="," close=")"> | ||||
|                             #{item} | ||||
|                         </foreach> | ||||
|                     </if> | ||||
|                 </where> | ||||
|             ) recId | ||||
|             LEFT JOIN ( | ||||
|                     SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM( | ||||
|                             SELECT physical_signs_id as id, ingredient_id | ||||
|                             FROM sys_ingredient_rec | ||||
|                     ) rec JOIN sys_physical_signs phy USING(id) | ||||
|                     GROUP BY id | ||||
|             ) recM USING(id) | ||||
|             INNER JOIN ( | ||||
|                 SELECT * FROM( | ||||
|                     SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_not_rec | ||||
|                     <where> | ||||
|                         <if test="notRecIds != null"> | ||||
|                             physical_signs_id in | ||||
|                             <foreach collection="notRecIds" item="item" index="index" open="(" separator="," close=")"> | ||||
|                                 #{item} | ||||
|                             </foreach> | ||||
|                         </if> | ||||
|                     </where> | ||||
|                 ) notRecId | ||||
|                 LEFT JOIN ( | ||||
|                         SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM( | ||||
|                                 SELECT physical_signs_id as id, ingredient_id | ||||
|                                 FROM sys_ingredient_not_rec | ||||
|                         ) notRec JOIN sys_physical_signs phy USING(id) | ||||
|                         GROUP BY id | ||||
|                 ) notRecM USING(id) | ||||
|             ) notRecT USING(id) | ||||
|         SELECT * FROM( | ||||
|         SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_rec | ||||
|         <where> | ||||
|             <if test="recIds != null"> | ||||
|                 physical_signs_id in | ||||
|                 <foreach collection="recIds" item="item" index="index" open="(" separator="," close=")"> | ||||
|                     #{item} | ||||
|                 </foreach> | ||||
|             </if> | ||||
|         </where> | ||||
|         ) recId | ||||
|         LEFT JOIN ( | ||||
|         SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM( | ||||
|         SELECT physical_signs_id as id, ingredient_id | ||||
|         FROM sys_ingredient_rec | ||||
|         ) rec JOIN sys_physical_signs phy USING(id) | ||||
|         GROUP BY id | ||||
|         ) recM USING(id) | ||||
|         INNER JOIN ( | ||||
|         SELECT * FROM( | ||||
|         SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_not_rec | ||||
|         <where> | ||||
|             <if test="notRecIds != null"> | ||||
|                 physical_signs_id in | ||||
|                 <foreach collection="notRecIds" item="item" index="index" open="(" separator="," close=")"> | ||||
|                     #{item} | ||||
|                 </foreach> | ||||
|             </if> | ||||
|         </where> | ||||
|         ) notRecId | ||||
|         LEFT JOIN ( | ||||
|         SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM( | ||||
|         SELECT physical_signs_id as id, ingredient_id | ||||
|         FROM sys_ingredient_not_rec | ||||
|         ) notRec JOIN sys_physical_signs phy USING(id) | ||||
|         GROUP BY id | ||||
|         ) notRecM USING(id) | ||||
|         ) notRecT USING(id) | ||||
|         ) recT USING(id) | ||||
|     </sql> | ||||
|  | ||||
| @@ -97,10 +99,10 @@ | ||||
|             </otherwise> | ||||
|         </choose> | ||||
|         <where> | ||||
|             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if> | ||||
|             <if test="type != null  and type != ''"> and type = #{type}</if> | ||||
|             <if test="area != null  and area != ''"> and area = #{area}</if> | ||||
|             <if test="reviewStatus != null and reviewStatus != ''"> and review_status = #{reviewStatus}</if> | ||||
|             <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if> | ||||
|             <if test="type != null  and type != ''">and type = #{type}</if> | ||||
|             <if test="area != null  and area != ''">and area = #{area}</if> | ||||
|             <if test="reviewStatus != null and reviewStatus != ''">and review_status = #{reviewStatus}</if> | ||||
|         </where> | ||||
|     </select> | ||||
|  | ||||
| @@ -141,14 +143,14 @@ | ||||
|         </trim> | ||||
|     </insert> | ||||
|  | ||||
|     <insert id="batchIngredientRec" > | ||||
|     <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}) | ||||
|         </foreach> | ||||
|     </insert> | ||||
|  | ||||
|     <insert id="batchIngredientNotRec" > | ||||
|     <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}) | ||||
| @@ -213,4 +215,28 @@ | ||||
|         where name = #{name} limit 1 | ||||
|     </select> | ||||
|  | ||||
|     <!--    添加食材图片--> | ||||
|     <insert id="batchInsertIngredientImage"> | ||||
|         insert into sys_ingredient_file(igd_id, file_url, file_name, create_by, create_time, update_by, update_time ) | ||||
|         values | ||||
|         <foreach collection="list" separator="," item="item" index="index"> | ||||
|             (#{item.ingredientId},#{item.fileUrl},#{item.fileName},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime}) | ||||
|         </foreach> | ||||
|     </insert> | ||||
|  | ||||
|     <resultMap id="SysIngredentFileResult" type="SysIngredentFile"> | ||||
|         <result property="id" column="id"/> | ||||
|         <result property="fileName" column="file_name"/> | ||||
|         <result property="fileUrl" column="file_url"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <!--    查找图片--> | ||||
|     <select id="selectIngredentFileById" parameterType="Long" resultMap="SysIngredentFileResult"> | ||||
|         select id, file_url, file_name from sys_ingredent_file where igd_id = #{id} and del_flag = 0 | ||||
|     </select> | ||||
|  | ||||
|     <!--    删除图片记录--> | ||||
|     <update id="deleteIngredentFileById" parameterType="Long"> | ||||
|         update sys_ingredent_file set del_flag=1 where id=#{id} | ||||
|     </update> | ||||
| </mapper> | ||||
		Reference in New Issue
	
	Block a user