173 lines
8.7 KiB
XML
173 lines
8.7 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.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="deleteFetchMaterialDetailByFetchMaterialId" parameterType="Long">
|
|
delete from ims_fetch_material_detail where fetch_material_id = #{fetchMaterialId}
|
|
</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>
|
|
|
|
<select id="pageFetchMaterialDetail" resultType="com.bonus.canteen.core.ims.vo.FetchMaterialDetailPageVO">
|
|
|
|
SELECT a.fetch_detail_id,
|
|
a.fetch_material_id,
|
|
a.material_id,
|
|
a.inventory_id,
|
|
b.material_name,
|
|
b.material_code,
|
|
b.material_type_id ,
|
|
d.material_type_name ,
|
|
b.unit_id,
|
|
c.unit_name,
|
|
e.material_num,
|
|
a.fetch_num,
|
|
a.create_by as createBy,
|
|
a.create_time as createTime,
|
|
a.update_by as updateBy,
|
|
a.update_time as updateTime,
|
|
a.stall_id,
|
|
ast.stall_name,
|
|
a.out_count,
|
|
b.sales_mode,
|
|
b.bar_code
|
|
FROM ims_fetch_material_detail a
|
|
LEFT JOIN cook_material b on b.material_id = a.material_id
|
|
LEFT JOIN ims_unit c on c.unit_id = b.unit_id
|
|
LEFT JOIN cook_material_type d on d.material_type_id = b.material_type_id
|
|
left join ims_inventory e on e.inventory_id = a.inventory_id
|
|
left join basic_stall ast on ast.stall_id = a.stall_id
|
|
WHERE a.fetch_material_id = #{content.fetchMaterialId}
|
|
<if test ="content.fetchStatus != null ">
|
|
<if test ="content.fetchStatus == 2 ">
|
|
and a.fetch_num > a.out_count
|
|
</if>
|
|
</if>
|
|
<if test="content.categoryIdList != null and content.categoryIdList.size() > 0">
|
|
and b.material_type_id in
|
|
<foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")" >
|
|
#{categoryId}
|
|
</foreach>
|
|
</if>
|
|
<if test="content.materialType != null ">
|
|
and b.material_type_id = #{content.materialType}
|
|
</if>
|
|
<if test="content.initial != null and content.initial != ''">
|
|
and b.pinyin_initials like CONCAT(#{content.initial},'%')
|
|
</if>
|
|
<if test="content.materialInfo != null and content.materialInfo != ''">
|
|
and (
|
|
b.material_name like concat('%', #{content.materialInfo}, '%')
|
|
or b.pinyin_initials like concat(#{content.materialInfo}, '%')
|
|
or b.bar_code like concat('%', #{content.materialInfo}, '%')
|
|
or b.material_code like concat('%', #{content.materialInfo}, '%')
|
|
)
|
|
</if>
|
|
<if test="content.materialId != null">
|
|
and b.material_id = #{content.materialId}
|
|
</if>
|
|
<if test="content.materialIdList != null and content.materialIdList.size() > 0">
|
|
and a.material_id in
|
|
<foreach collection="content.materialIdList" item="item" separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
</mapper>
|