Bonus-Cloud-JYY-Smart-Canteen/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/FetchMaterialDetailMapper.xml

101 lines
5.9 KiB
XML
Raw Normal View History

2025-07-07 13:18:25 +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.ims.mapper.FetchMaterialDetailMapper">
<resultMap type="com.bonus.canteen.core.ims.domain.FetchMaterialDetail" id="FetchMaterialDetailResult">
<result property="fetchDetailId" column="fetch_detail_id" />
<result property="fetchMaterialId" column="fetch_material_id" />
<result property="fetchMaterialCode" column="fetch_material_code" />
<result property="materialId" column="material_id" />
<result property="inventoryId" column="inventory_id" />
<result property="fetchNum" column="fetch_num" />
<result property="stallId" column="stall_id" />
<result property="outCount" column="out_count" />
<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="selectFetchMaterialDetailVo">
select fetch_detail_id, fetch_material_id, fetch_material_code, material_id, inventory_id, fetch_num, stall_id, out_count, create_by, create_time, update_by, update_time from ims_fetch_material_detail
</sql>
<select id="selectFetchMaterialDetailList" parameterType="com.bonus.canteen.core.ims.domain.FetchMaterialDetail" resultMap="FetchMaterialDetailResult">
<include refid="selectFetchMaterialDetailVo"/>
<where>
<if test="fetchMaterialId != null "> and fetch_material_id = #{fetchMaterialId}</if>
<if test="fetchMaterialCode != null and fetchMaterialCode != ''"> and fetch_material_code = #{fetchMaterialCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="inventoryId != null "> and inventory_id = #{inventoryId}</if>
<if test="fetchNum != null "> and fetch_num = #{fetchNum}</if>
<if test="stallId != null "> and stall_id = #{stallId}</if>
<if test="outCount != null "> and out_count = #{outCount}</if>
</where>
</select>
<select id="selectFetchMaterialDetailByFetchDetailId" parameterType="Long" resultMap="FetchMaterialDetailResult">
<include refid="selectFetchMaterialDetailVo"/>
where fetch_detail_id = #{fetchDetailId}
</select>
<insert id="insertFetchMaterialDetail" parameterType="com.bonus.canteen.core.ims.domain.FetchMaterialDetail" useGeneratedKeys="true" keyProperty="fetchDetailId">
insert into ims_fetch_material_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fetchMaterialId != null">fetch_material_id,</if>
<if test="fetchMaterialCode != null and fetchMaterialCode != ''">fetch_material_code,</if>
<if test="materialId != null">material_id,</if>
<if test="inventoryId != null">inventory_id,</if>
<if test="fetchNum != null">fetch_num,</if>
<if test="stallId != null">stall_id,</if>
<if test="outCount != null">out_count,</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="fetchMaterialId != null">#{fetchMaterialId},</if>
<if test="fetchMaterialCode != null and fetchMaterialCode != ''">#{fetchMaterialCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="inventoryId != null">#{inventoryId},</if>
<if test="fetchNum != null">#{fetchNum},</if>
<if test="stallId != null">#{stallId},</if>
<if test="outCount != null">#{outCount},</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="updateFetchMaterialDetail" parameterType="com.bonus.canteen.core.ims.domain.FetchMaterialDetail">
update ims_fetch_material_detail
<trim prefix="SET" suffixOverrides=",">
<if test="fetchMaterialId != null">fetch_material_id = #{fetchMaterialId},</if>
<if test="fetchMaterialCode != null and fetchMaterialCode != ''">fetch_material_code = #{fetchMaterialCode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="inventoryId != null">inventory_id = #{inventoryId},</if>
<if test="fetchNum != null">fetch_num = #{fetchNum},</if>
<if test="stallId != null">stall_id = #{stallId},</if>
<if test="outCount != null">out_count = #{outCount},</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 fetch_detail_id = #{fetchDetailId}
</update>
<delete id="deleteFetchMaterialDetailByFetchDetailId" parameterType="Long">
delete from ims_fetch_material_detail where fetch_detail_id = #{fetchDetailId}
</delete>
<delete id="deleteFetchMaterialDetailByFetchDetailIds" parameterType="String">
delete from ims_fetch_material_detail where fetch_detail_id in
<foreach item="fetchDetailId" collection="array" open="(" separator="," close=")">
#{fetchDetailId}
</foreach>
</delete>
</mapper>