万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

117 lines
7.1 KiB

<?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.system.mapper.SysBomRawMaterialMapper">
<resultMap type="SysBomRawMaterial" id="SysBomRawMaterialResult">
<result property="rawMaterialId" column="raw_material_id" />
<result property="finishProductCode" column="finish_product_code" />
<result property="rawMaterialCode" column="raw_material_code" />
<result property="rawMaterialName" column="raw_material_name" />
<result property="specificationModel" column="specification_model" />
<result property="inventoryUnit" column="inventory_unit" />
<result property="rawMaterialConsumption" column="raw_material_consumption" />
<result property="rawMaterialLoss" column="raw_material_loss" />
<result property="supplierNumber" column="supplier_number" />
<result property="finishedProductQuantity" column="finished_product_quantity" />
<result property="remarks" column="remarks" />
<result property="processingCategory" column="processing_category" />
<result property="standbyOne" column="standby_one" />
<result property="standbyTwo" column="standby_two" />
</resultMap>
<sql id="selectSysBomRawMaterialVo">
select raw_material_id, finish_product_code, raw_material_code, raw_material_name, specification_model, inventory_unit, raw_material_consumption, raw_material_loss, supplier_number, finished_product_quantity, remarks, processing_category, standby_one, standby_two from sys_bom_raw_material
</sql>
<select id="selectSysBomRawMaterialList" parameterType="SysBomRawMaterial" resultMap="SysBomRawMaterialResult">
<include refid="selectSysBomRawMaterialVo"/>
<where>
<if test="finishProductCode != null and finishProductCode != ''"> and finish_product_code like concat('%', #{finishProductCode}, '%')</if>
<if test="rawMaterialCode != null and rawMaterialCode != ''"> and raw_material_code like concat('%', #{rawMaterialCode}, '%')</if>
<if test="rawMaterialName != null and rawMaterialName != ''"> and raw_material_name like concat('%', #{rawMaterialName}, '%')</if>
</where>
</select>
<select id="selectSysBomRawMaterialById" parameterType="Long" resultMap="SysBomRawMaterialResult">
<include refid="selectSysBomRawMaterialVo"/>
where raw_material_id = #{rawMaterialId}
</select>
<select id="selectfinishProductCodeByCode" parameterType="String" resultMap="SysBomRawMaterialResult">
<include refid="selectSysBomRawMaterialVo"/>
where finish_product_code = #{finishProductCode}
</select>
<insert id="insertSysBomRawMaterial" parameterType="SysBomRawMaterial">
insert into sys_bom_raw_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="rawMaterialId != null">raw_material_id,</if>
<if test="finishProductCode != null and finishProductCode != ''">finish_product_code,</if>
<if test="rawMaterialCode != null">raw_material_code,</if>
<if test="rawMaterialName != null">raw_material_name,</if>
<if test="specificationModel != null">specification_model,</if>
<if test="inventoryUnit != null">inventory_unit,</if>
<if test="rawMaterialConsumption != null">raw_material_consumption,</if>
<if test="rawMaterialLoss != null">raw_material_loss,</if>
<if test="supplierNumber != null">supplier_number,</if>
<if test="finishedProductQuantity != null">finished_product_quantity,</if>
<if test="remarks != null">remarks,</if>
<if test="processingCategory != null">processing_category,</if>
<if test="standbyOne != null">standby_one,</if>
<if test="standbyTwo != null">standby_two,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="rawMaterialId != null">#{rawMaterialId},</if>
<if test="finishProductCode != null and finishProductCode != ''">#{finishProductCode},</if>
<if test="rawMaterialCode != null">#{rawMaterialCode},</if>
<if test="rawMaterialName != null">#{rawMaterialName},</if>
<if test="specificationModel != null">#{specificationModel},</if>
<if test="inventoryUnit != null">#{inventoryUnit},</if>
<if test="rawMaterialConsumption != null">#{rawMaterialConsumption},</if>
<if test="rawMaterialLoss != null">#{rawMaterialLoss},</if>
<if test="supplierNumber != null">#{supplierNumber},</if>
<if test="finishedProductQuantity != null">#{finishedProductQuantity},</if>
<if test="remarks != null">#{remarks},</if>
<if test="processingCategory != null">#{processingCategory},</if>
<if test="standbyOne != null">#{standbyOne},</if>
<if test="standbyTwo != null">#{standbyTwo},</if>
</trim>
</insert>
<update id="updateSysBomRawMaterial" parameterType="SysBomRawMaterial">
update sys_bom_raw_material
<trim prefix="SET" suffixOverrides=",">
<if test="finishProductCode != null and finishProductCode != ''">finish_product_code = #{finishProductCode},</if>
<if test="rawMaterialCode != null">raw_material_code = #{rawMaterialCode},</if>
<if test="rawMaterialName != null">raw_material_name = #{rawMaterialName},</if>
<if test="specificationModel != null">specification_model = #{specificationModel},</if>
<if test="inventoryUnit != null">inventory_unit = #{inventoryUnit},</if>
<if test="rawMaterialConsumption != null">raw_material_consumption = #{rawMaterialConsumption},</if>
<if test="rawMaterialLoss != null">raw_material_loss = #{rawMaterialLoss},</if>
<if test="supplierNumber != null">supplier_number = #{supplierNumber},</if>
<if test="finishedProductQuantity != null">finished_product_quantity = #{finishedProductQuantity},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="processingCategory != null">processing_category = #{processingCategory},</if>
<if test="standbyOne != null">standby_one = #{standbyOne},</if>
<if test="standbyTwo != null">standby_two = #{standbyTwo},</if>
</trim>
where raw_material_id = #{rawMaterialId}
</update>
<delete id="deleteSysBomRawMaterialById" parameterType="Long">
delete from sys_bom_raw_material where raw_material_id = #{rawMaterialId}
</delete>
<delete id="deleteSysBomRawMaterialByIds" parameterType="String">
delete from sys_bom_raw_material where raw_material_id in
<foreach item="rawMaterialId" collection="array" open="(" separator="," close=")">
#{rawMaterialId}
</foreach>
</delete>
<delete id="deleteFinishProductCode" parameterType="String">
delete from sys_bom_raw_material where finish_product_code = #{finishProductCode}
</delete>
</mapper>