Files
SchoolFood/fp-system/src/main/resources/mapper/FoodRepoMapper.xml

42 lines
1.7 KiB
XML
Raw Normal View History

2026-07-15 15:17:50 +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.zf.foodpurchase.fdsafe.mapper.FoodRepoMapper">
<insert id="insert" parameterType="FoodRepo" useGeneratedKeys="true" keyProperty="id">
insert into food_repo(
<if test="foodProductId != null">food_product_id,</if>
<if test="repoId != null">repo_id,</if>
<if test="foodProductNum != null">food_product_num</if>
)values(
<if test="foodProductId != null">#{foodProductId},</if>
<if test="repoId != null">#{repoId},</if>
<if test="foodProductNum != null">#{foodProductNum}</if>)
</insert>
<update id="update">
update food_repo
<set>
<if test="foodProductId != null">food_product_id=#{foodProductId},</if>
<if test="repoId != null">repo_id=#{repoId},</if>
<if test="foodProductNum != null">food_product_num=#{foodProductNum}</if>
</set>
where id=#{id}
</update>
<select id="selectByProductIdAndRepoId" resultType="FoodRepo">
2026-07-31 15:19:38 +08:00
select id, food_product_id foodProductId, repo_id repoId, food_product_num foodProductNum
2026-07-15 15:17:50 +08:00
from food_repo where food_product_id=#{productId} and repo_id=#{repoId}
</select>
2026-07-31 15:19:38 +08:00
<select id="selectByRepoId" resultType="FoodRepo">
select id, food_product_id foodProductId, repo_id repoId, food_product_num foodProductNum
from food_repo where repo_id in
<foreach collection="repoIds" item="repoId" index="index"
separator="," open="(" close=")">
#{repoId}
</foreach>
</select>
2026-07-15 15:17:50 +08:00
</mapper>