万材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.7 KiB

2 years ago
<?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.SysBomSubsidiaryMaterialMapper">
<resultMap type="SysBomSubsidiaryMaterial" id="SysBomSubsidiaryMaterialResult">
<result property="subsidiaryMaterialId" column="subsidiary_material_id" />
<result property="finishProductCode" column="finish_product_code" />
<result property="subsidiaryMaterialCode" column="subsidiary_material_code" />
<result property="subsidiaryMaterialName" column="subsidiary_material_name" />
<result property="specificationModel" column="specification_model" />
<result property="inventoryUnit" column="inventory_unit" />
<result property="subsidiaryMaterialConsumption" column="subsidiary_material_consumption" />
<result property="subsidiaryMaterialLoss" column="subsidiary_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="selectSysBomSubsidiaryMaterialVo">
select subsidiary_material_id, finish_product_code, subsidiary_material_code, subsidiary_material_name, specification_model, inventory_unit, subsidiary_material_consumption, subsidiary_material_loss, supplier_number, finished_product_quantity, remarks, processing_category, standby_one, standby_two from sys_bom_subsidiary_material
</sql>
<select id="selectSysBomSubsidiaryMaterialList" parameterType="SysBomSubsidiaryMaterial" resultMap="SysBomSubsidiaryMaterialResult">
<include refid="selectSysBomSubsidiaryMaterialVo"/>
<where>
<if test="finishProductCode != null and finishProductCode != ''"> and finish_product_code = #{finishProductCode}</if>
<if test="subsidiaryMaterialCode != null and subsidiaryMaterialCode != ''"> and subsidiary_material_code = #{subsidiaryMaterialCode}</if>
<if test="subsidiaryMaterialName != null and subsidiaryMaterialName != ''"> and subsidiary_material_name like concat('%', #{subsidiaryMaterialName}, '%')</if>
</where>
</select>
<select id="selectSysBomSubsidiaryMaterialById" parameterType="Long" resultMap="SysBomSubsidiaryMaterialResult">
<include refid="selectSysBomSubsidiaryMaterialVo"/>
where subsidiary_material_id = #{subsidiaryMaterialId}
</select>
<select id="selectfinishProductCodeByCode" parameterType="String" resultMap="SysBomSubsidiaryMaterialResult">
<include refid="selectSysBomSubsidiaryMaterialVo"/>
where finish_product_code = #{finishProductCode}
</select>
<insert id="insertSysBomSubsidiaryMaterial" parameterType="SysBomSubsidiaryMaterial">
insert into sys_bom_subsidiary_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="subsidiaryMaterialId != null">subsidiary_material_id,</if>
<if test="finishProductCode != null and finishProductCode != ''">finish_product_code,</if>
<if test="subsidiaryMaterialCode != null">subsidiary_material_code,</if>
<if test="subsidiaryMaterialName != null">subsidiary_material_name,</if>
<if test="specificationModel != null">specification_model,</if>
<if test="inventoryUnit != null">inventory_unit,</if>
<if test="subsidiaryMaterialConsumption != null">subsidiary_material_consumption,</if>
<if test="subsidiaryMaterialLoss != null">subsidiary_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="subsidiaryMaterialId != null">#{subsidiaryMaterialId},</if>
<if test="finishProductCode != null and finishProductCode != ''">#{finishProductCode},</if>
<if test="subsidiaryMaterialCode != null">#{subsidiaryMaterialCode},</if>
<if test="subsidiaryMaterialName != null">#{subsidiaryMaterialName},</if>
<if test="specificationModel != null">#{specificationModel},</if>
<if test="inventoryUnit != null">#{inventoryUnit},</if>
<if test="subsidiaryMaterialConsumption != null">#{subsidiaryMaterialConsumption},</if>
<if test="subsidiaryMaterialLoss != null">#{subsidiaryMaterialLoss},</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="updateSysBomSubsidiaryMaterial" parameterType="SysBomSubsidiaryMaterial">
update sys_bom_subsidiary_material
<trim prefix="SET" suffixOverrides=",">
<if test="finishProductCode != null and finishProductCode != ''">finish_product_code = #{finishProductCode},</if>
<if test="subsidiaryMaterialCode != null">subsidiary_material_code = #{subsidiaryMaterialCode},</if>
<if test="subsidiaryMaterialName != null">subsidiary_material_name = #{subsidiaryMaterialName},</if>
<if test="specificationModel != null">specification_model = #{specificationModel},</if>
<if test="inventoryUnit != null">inventory_unit = #{inventoryUnit},</if>
<if test="subsidiaryMaterialConsumption != null">subsidiary_material_consumption = #{subsidiaryMaterialConsumption},</if>
<if test="subsidiaryMaterialLoss != null">subsidiary_material_loss = #{subsidiaryMaterialLoss},</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 subsidiary_material_id = #{subsidiaryMaterialId}
</update>
<delete id="deleteSysBomSubsidiaryMaterialById" parameterType="Long">
delete from sys_bom_subsidiary_material where subsidiary_material_id = #{subsidiaryMaterialId}
</delete>
<delete id="deleteSysBomSubsidiaryMaterialByIds" parameterType="String">
delete from sys_bom_subsidiary_material where subsidiary_material_id in
<foreach item="subsidiaryMaterialId" collection="array" open="(" separator="," close=")">
#{subsidiaryMaterialId}
</foreach>
</delete>
<delete id="deleteFinishProductCode" parameterType="String">
delete from sys_bom_subsidiary_material where finish_product_code = #{finishProductCode}
</delete>
</mapper>