Bonus-Cloud-JYY-Canteen/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuCollectionDishesMapper.xml

90 lines
4.6 KiB
XML
Raw Normal View History

2025-04-20 20:20:28 +08:00
<?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.menu.mapper.MenuCollectionDishesMapper">
<resultMap type="com.bonus.canteen.core.menu.domain.MenuCollectionDishes" id="MenuCollectionDishesResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="shopstallId" column="shopstall_id" />
<result property="dishesId" column="dishes_id" />
<result property="revision" column="revision" />
<result property="delFlag" column="del_flag" />
<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="selectMenuCollectionDishesVo">
select id, user_id, shopstall_id, dishes_id, revision, del_flag, create_by, create_time, update_by, update_time from menu_collection_dishes
</sql>
<select id="selectMenuCollectionDishesList" parameterType="com.bonus.canteen.core.menu.domain.MenuCollectionDishes" resultMap="MenuCollectionDishesResult">
<include refid="selectMenuCollectionDishesVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="shopstallId != null "> and shopstall_id = #{shopstallId}</if>
<if test="dishesId != null "> and dishes_id = #{dishesId}</if>
<if test="revision != null "> and revision = #{revision}</if>
</where>
</select>
<select id="selectMenuCollectionDishesById" parameterType="Long" resultMap="MenuCollectionDishesResult">
<include refid="selectMenuCollectionDishesVo"/>
where id = #{id}
</select>
<insert id="insertMenuCollectionDishes" parameterType="com.bonus.canteen.core.menu.domain.MenuCollectionDishes" useGeneratedKeys="true" keyProperty="id">
insert into menu_collection_dishes
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="shopstallId != null">shopstall_id,</if>
<if test="dishesId != null">dishes_id,</if>
<if test="revision != null">revision,</if>
<if test="delFlag != null">del_flag,</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="userId != null">#{userId},</if>
<if test="shopstallId != null">#{shopstallId},</if>
<if test="dishesId != null">#{dishesId},</if>
<if test="revision != null">#{revision},</if>
<if test="delFlag != null">#{delFlag},</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="updateMenuCollectionDishes" parameterType="com.bonus.canteen.core.menu.domain.MenuCollectionDishes">
update menu_collection_dishes
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="shopstallId != null">shopstall_id = #{shopstallId},</if>
<if test="dishesId != null">dishes_id = #{dishesId},</if>
<if test="revision != null">revision = #{revision},</if>
<if test="delFlag != null">del_flag = #{delFlag},</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="deleteMenuCollectionDishesById" parameterType="Long">
delete from menu_collection_dishes where id = #{id}
</delete>
<delete id="deleteMenuCollectionDishesByIds" parameterType="String">
delete from menu_collection_dishes where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>