新增食材管理

This commit is contained in:
huangdeliang
2020-12-15 21:11:45 +08:00
parent a3fc7d7da7
commit 27bf41b006
11 changed files with 1123 additions and 6 deletions

View File

@ -0,0 +1,121 @@
<?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.SysIngredientMapper">
<resultMap type="SysIngredient" id="SysIngredientResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="recEstimation" column="rec_estimation" />
<result property="recEstUnit" column="rec_est_unit" />
<result property="recPortion" column="rec_portion" />
<result property="proteinRatio" column="protein_ratio" />
<result property="fatRatio" column="fat_ratio" />
<result property="carbonRatio" column="carbon_ratio" />
<result property="remark" column="remark" />
<result property="area" column="area" />
<result property="notRec" column="not_rec" />
<result property="recommend" column="recommend" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysIngredientVo">
select id, name, type, rec_estimation, rec_est_unit, rec_portion, protein_ratio, fat_ratio, carbon_ratio, remark, area, not_rec, recommend, create_by, create_time, update_by, update_time from sys_ingredient
</sql>
<select id="selectSysIngredientList" parameterType="SysIngredient" resultMap="SysIngredientResult">
<include refid="selectSysIngredientVo"/>
<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="notRec != null and notRec != ''"> and not_rec like concat('%', #{notRec}, '%')</if>
<if test="recommend != null and recommend != ''"> and recommend like concat('%', #{recommend}, '%')</if>
</where>
</select>
<select id="selectSysIngredientById" parameterType="Long" resultMap="SysIngredientResult">
<include refid="selectSysIngredientVo"/>
where id = #{id}
</select>
<insert id="insertSysIngredient" parameterType="SysIngredient" useGeneratedKeys="true" keyProperty="id">
insert into sys_ingredient
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="type != null">type,</if>
<if test="recEstimation != null">rec_estimation,</if>
<if test="recEstUnit != null">rec_est_unit,</if>
<if test="recPortion != null">rec_portion,</if>
<if test="proteinRatio != null">protein_ratio,</if>
<if test="fatRatio != null">fat_ratio,</if>
<if test="carbonRatio != null">carbon_ratio,</if>
<if test="remark != null">remark,</if>
<if test="area != null">area,</if>
<if test="notRec != null">not_rec,</if>
<if test="recommend != null">recommend,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="recEstimation != null">#{recEstimation},</if>
<if test="recEstUnit != null">#{recEstUnit},</if>
<if test="recPortion != null">#{recPortion},</if>
<if test="proteinRatio != null">#{proteinRatio},</if>
<if test="fatRatio != null">#{fatRatio},</if>
<if test="carbonRatio != null">#{carbonRatio},</if>
<if test="remark != null">#{remark},</if>
<if test="area != null">#{area},</if>
<if test="notRec != null">#{notRec},</if>
<if test="recommend != null">#{recommend},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysIngredient" parameterType="SysIngredient">
update sys_ingredient
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="recEstimation != null">rec_estimation = #{recEstimation},</if>
<if test="recEstUnit != null">rec_est_unit = #{recEstUnit},</if>
<if test="recPortion != null">rec_portion = #{recPortion},</if>
<if test="proteinRatio != null">protein_ratio = #{proteinRatio},</if>
<if test="fatRatio != null">fat_ratio = #{fatRatio},</if>
<if test="carbonRatio != null">carbon_ratio = #{carbonRatio},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="area != null">area = #{area},</if>
<if test="notRec != null">not_rec = #{notRec},</if>
<if test="recommend != null">recommend = #{recommend},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysIngredientById" parameterType="Long">
delete from sys_ingredient where id = #{id}
</delete>
<delete id="deleteSysIngredientByIds" parameterType="String">
delete from sys_ingredient where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>