<?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.ruoyi.manufacture.mapper.MaterialRequisitionDetailMapper" >
<resultMap type= "MaterialRequisitionDetail" id= "MaterialRequisitionDetailResult" >
<result property= "materialRequisitionDetailId" column= "material_requisition_detail_id" />
<result property= "materialRequisitionNumber" column= "material_requisition_number" />
<result property= "materialCode" column= "material_code" />
<result property= "materialName" column= "material_name" />
<result property= "specificationModel" column= "specification_model" />
<result property= "itemNumber" column= "item_number" />
<result property= "typeMachine" column= "type_machine" />
<result property= "inventoryUnit" column= "inventory_unit" />
<result property= "planQuantity" column= "plan_quantity" />
<result property= "description" column= "description" />
<result property= "unitUsage" column= "unit_usage" />
<result property= "storageLocation" column= "storage_location" />
<result property= "materialType" column= "material_type" />
<result property= "standbyOne" column= "standby_one" />
<result property= "standbyTwo" column= "standby_two" />
<result property= "bomRank" column= "bom_rank" />
<result property= "upFinishProductCode" column= "up_finish_product_code" />
</resultMap>
<sql id= "selectMaterialRequisitionDetailVo" >
select material_requisition_detail_id, material_requisition_number, material_code, material_name, specification_model, item_number, type_machine, inventory_unit, plan_quantity, description, unit_usage, storage_location, material_type, standby_one, standby_two, bom_rank, up_finish_product_code from material_requisition_detail
</sql>
<select id= "selectMaterialRequisitionDetailList" parameterType= "MaterialRequisitionDetail" resultMap= "MaterialRequisitionDetailResult" >
<include refid= "selectMaterialRequisitionDetailVo" />
<where >
<if test= "materialRequisitionNumber != null and materialRequisitionNumber != ''" > and material_requisition_number like concat('%', #{materialRequisitionNumber}, '%')</if>
<if test= "materialCode != null and materialCode != ''" > and material_code like concat('%', #{materialCode}, '%')</if>
<if test= "materialName != null and materialName != ''" > and material_name like concat('%', #{materialName}, '%')</if>
<if test= "materialType != null and materialType != ''" > and material_type = #{materialType}</if>
</where>
</select>
<select id= "selectMaterialRequisitionDetailById" parameterType= "Long" resultMap= "MaterialRequisitionDetailResult" >
<include refid= "selectMaterialRequisitionDetailVo" />
where material_requisition_detail_id = #{materialRequisitionDetailId}
</select>
<insert id= "insertMaterialRequisitionDetail" parameterType= "MaterialRequisitionDetail" useGeneratedKeys= "true" keyProperty= "materialRequisitionDetailId" >
insert into material_requisition_detail
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "materialRequisitionNumber != null" > material_requisition_number,</if>
<if test= "materialCode != null" > material_code,</if>
<if test= "materialName != null" > material_name,</if>
<if test= "specificationModel != null" > specification_model,</if>
<if test= "itemNumber != null" > item_number,</if>
<if test= "typeMachine != null" > type_machine,</if>
<if test= "inventoryUnit != null" > inventory_unit,</if>
<if test= "planQuantity != null" > plan_quantity,</if>
<if test= "description != null" > description,</if>
<if test= "unitUsage != null" > unit_usage,</if>
<if test= "storageLocation != null" > storage_location,</if>
<if test= "materialType != null" > material_type,</if>
<if test= "standbyOne != null" > standby_one,</if>
<if test= "standbyTwo != null" > standby_two,</if>
<if test= "bomRank != null" > bom_rank,</if>
<if test= "upFinishProductCode != null" > up_finish_product_code,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "materialRequisitionNumber != null" > #{materialRequisitionNumber},</if>
<if test= "materialCode != null" > #{materialCode},</if>
<if test= "materialName != null" > #{materialName},</if>
<if test= "specificationModel != null" > #{specificationModel},</if>
<if test= "itemNumber != null" > #{itemNumber},</if>
<if test= "typeMachine != null" > #{typeMachine},</if>
<if test= "inventoryUnit != null" > #{inventoryUnit},</if>
<if test= "planQuantity != null" > #{planQuantity},</if>
<if test= "description != null" > #{description},</if>
<if test= "unitUsage != null" > #{unitUsage},</if>
<if test= "storageLocation != null" > #{storageLocation},</if>
<if test= "materialType != null" > #{materialType},</if>
<if test= "standbyOne != null" > #{standbyOne},</if>
<if test= "standbyTwo != null" > #{standbyTwo},</if>
<if test= "bomRank != null" > #{bomRank},</if>
<if test= "upFinishProductCode != null" > #{upFinishProductCode},</if>
</trim>
</insert>
<update id= "updateMaterialRequisitionDetail" parameterType= "MaterialRequisitionDetail" >
update material_requisition_detail
<trim prefix= "SET" suffixOverrides= "," >
<if test= "materialRequisitionNumber != null" > material_requisition_number = #{materialRequisitionNumber},</if>
<if test= "materialCode != null" > material_code = #{materialCode},</if>
<if test= "materialName != null" > material_name = #{materialName},</if>
<if test= "specificationModel != null" > specification_model = #{specificationModel},</if>
<if test= "itemNumber != null" > item_number = #{itemNumber},</if>
<if test= "typeMachine != null" > type_machine = #{typeMachine},</if>
<if test= "inventoryUnit != null" > inventory_unit = #{inventoryUnit},</if>
<if test= "planQuantity != null" > plan_quantity = #{planQuantity},</if>
<if test= "description != null" > description = #{description},</if>
<if test= "unitUsage != null" > unit_usage = #{unitUsage},</if>
<if test= "storageLocation != null" > storage_location = #{storageLocation},</if>
<if test= "materialType != null" > material_type = #{materialType},</if>
<if test= "standbyOne != null" > standby_one = #{standbyOne},</if>
<if test= "standbyTwo != null" > standby_two = #{standbyTwo},</if>
<if test= "bomRank != null" > bom_rank = #{bomRank},</if>
<if test= "upFinishProductCode != null" > up_finish_product_code = #{upFinishProductCode},</if>
</trim>
where material_requisition_detail_id = #{materialRequisitionDetailId}
</update>
<delete id= "deleteMaterialRequisitionDetailById" parameterType= "Long" >
delete from material_requisition_detail where material_requisition_detail_id = #{materialRequisitionDetailId}
</delete>
<delete id= "deleteMaterialRequisitionDetailByIds" parameterType= "String" >
delete from material_requisition_detail where material_requisition_detail_id in
<foreach item= "materialRequisitionDetailId" collection= "array" open= "(" separator= "," close= ")" >
#{materialRequisitionDetailId}
</foreach>
</delete>
</mapper>