101 lines
5.4 KiB
XML
101 lines
5.4 KiB
XML
|
|
<?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.bonus.canteen.core.cook.mapper.CookRecipeMapper">
|
||
|
|
<resultMap type="com.bonus.canteen.core.cook.domain.CookRecipe" id="CookRecipeResult">
|
||
|
|
<result property="recipeId" column="recipe_id" />
|
||
|
|
<result property="recipeName" column="recipe_name" />
|
||
|
|
<result property="recipeType" column="recipe_type" />
|
||
|
|
<result property="stallId" column="stall_id" />
|
||
|
|
<result property="canteenId" column="canteen_id" />
|
||
|
|
<result property="planId" column="plan_id" />
|
||
|
|
<result property="effectDate" column="effect_date" />
|
||
|
|
<result property="expireDate" column="expire_date" />
|
||
|
|
<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="selectCookRecipeVo">
|
||
|
|
select recipe_id, recipe_name, recipe_type, stall_id, canteen_id, plan_id, effect_date, expire_date, create_by, create_time, update_by, update_time from cook_recipe
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectCookRecipeList" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe" resultMap="CookRecipeResult">
|
||
|
|
<include refid="selectCookRecipeVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="recipeName != null and recipeName != ''"> and recipe_name like concat('%', #{recipeName}, '%')</if>
|
||
|
|
<if test="recipeType != null "> and recipe_type = #{recipeType}</if>
|
||
|
|
<if test="stallId != null "> and stall_id = #{stallId}</if>
|
||
|
|
<if test="canteenId != null "> and canteen_id = #{canteenId}</if>
|
||
|
|
<if test="planId != null and planId != ''"> and plan_id = #{planId}</if>
|
||
|
|
<if test="effectDate != null "> and effect_date = #{effectDate}</if>
|
||
|
|
<if test="expireDate != null "> and expire_date = #{expireDate}</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectCookRecipeByRecipeId" parameterType="Long" resultMap="CookRecipeResult">
|
||
|
|
<include refid="selectCookRecipeVo"/>
|
||
|
|
where recipe_id = #{recipeId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertCookRecipe" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe" useGeneratedKeys="true" keyProperty="recipeId">
|
||
|
|
insert into cook_recipe
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="recipeName != null and recipeName != ''">recipe_name,</if>
|
||
|
|
<if test="recipeType != null">recipe_type,</if>
|
||
|
|
<if test="stallId != null">stall_id,</if>
|
||
|
|
<if test="canteenId != null">canteen_id,</if>
|
||
|
|
<if test="planId != null">plan_id,</if>
|
||
|
|
<if test="effectDate != null">effect_date,</if>
|
||
|
|
<if test="expireDate != null">expire_date,</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="recipeName != null and recipeName != ''">#{recipeName},</if>
|
||
|
|
<if test="recipeType != null">#{recipeType},</if>
|
||
|
|
<if test="stallId != null">#{stallId},</if>
|
||
|
|
<if test="canteenId != null">#{canteenId},</if>
|
||
|
|
<if test="planId != null">#{planId},</if>
|
||
|
|
<if test="effectDate != null">#{effectDate},</if>
|
||
|
|
<if test="expireDate != null">#{expireDate},</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="updateCookRecipe" parameterType="com.bonus.canteen.core.cook.domain.CookRecipe">
|
||
|
|
update cook_recipe
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="recipeName != null and recipeName != ''">recipe_name = #{recipeName},</if>
|
||
|
|
<if test="recipeType != null">recipe_type = #{recipeType},</if>
|
||
|
|
<if test="stallId != null">stall_id = #{stallId},</if>
|
||
|
|
<if test="canteenId != null">canteen_id = #{canteenId},</if>
|
||
|
|
<if test="planId != null">plan_id = #{planId},</if>
|
||
|
|
<if test="effectDate != null">effect_date = #{effectDate},</if>
|
||
|
|
<if test="expireDate != null">expire_date = #{expireDate},</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 recipe_id = #{recipeId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteCookRecipeByRecipeId" parameterType="Long">
|
||
|
|
delete from cook_recipe where recipe_id = #{recipeId}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteCookRecipeByRecipeIds" parameterType="String">
|
||
|
|
delete from cook_recipe where recipe_id in
|
||
|
|
<foreach item="recipeId" collection="array" open="(" separator="," close=")">
|
||
|
|
#{recipeId}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
</mapper>
|