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

109 lines
6.8 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.purchase.mapper.PurchaseMaterialMapper">
<resultMap type="PurchaseMaterial" id="PurchaseMaterialResult">
<result property="purchaseMaterialId" column="purchase_material_id" />
<result property="purchaseOrderNumber" column="purchase_order_number" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="rawSubsidiaryCode" column="raw_subsidiary_code" />
<result property="rawSubsidiaryName" column="raw_subsidiary_name" />
<result property="specificationModel" column="specification_model" />
<result property="commonCurrency" column="common_currency" />
<result property="purchasingUnit" column="purchasing_unit" />
<result property="purchasePrice" column="purchase_price" />
<result property="materialQuantity" column="material_quantity" />
<result property="amountMoney" column="amount_money" />
<result property="deliveryTime" column="delivery_time" />
<result property="purchaseExplain" column="purchase_explain" />
</resultMap>
<sql id="selectPurchaseMaterialVo">
select purchase_material_id, purchase_order_number, supplier_code, supplier_name, raw_subsidiary_code, raw_subsidiary_name, specification_model, common_currency, purchasing_unit, purchase_price, material_quantity, amount_money, delivery_time, purchase_explain from purchase_material
</sql>
<select id="selectPurchaseMaterialList" parameterType="PurchaseMaterial" resultMap="PurchaseMaterialResult">
<include refid="selectPurchaseMaterialVo"/>
<where>
<if test="purchaseOrderNumber != null and purchaseOrderNumber != ''"> and purchase_order_number like concat('%', #{purchaseOrderNumber}, '%')</if>
<if test="supplierCode != null and supplierCode != ''"> and supplier_code like concat('%', #{supplierCode}, '%')</if>
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
<if test="rawSubsidiaryCode != null and rawSubsidiaryCode != ''"> and raw_subsidiary_code like concat('%', #{rawSubsidiaryCode}, '%')</if>
<if test="rawSubsidiaryName != null and rawSubsidiaryName != ''"> and raw_subsidiary_name like concat('%', #{rawSubsidiaryName}, '%')</if>
</where>
</select>
<select id="selectPurchaseMaterialById" parameterType="Long" resultMap="PurchaseMaterialResult">
<include refid="selectPurchaseMaterialVo"/>
where purchase_material_id = #{purchaseMaterialId}
</select>
<insert id="insertPurchaseMaterial" parameterType="PurchaseMaterial" useGeneratedKeys="true" keyProperty="purchaseMaterialId">
insert into purchase_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="purchaseOrderNumber != null">purchase_order_number,</if>
<if test="supplierCode != null">supplier_code,</if>
<if test="supplierName != null">supplier_name,</if>
<if test="rawSubsidiaryCode != null">raw_subsidiary_code,</if>
<if test="rawSubsidiaryName != null">raw_subsidiary_name,</if>
<if test="specificationModel != null">specification_model,</if>
<if test="commonCurrency != null">common_currency,</if>
<if test="purchasingUnit != null">purchasing_unit,</if>
<if test="purchasePrice != null">purchase_price,</if>
<if test="materialQuantity != null">material_quantity,</if>
<if test="amountMoney != null">amount_money,</if>
<if test="deliveryTime != null">delivery_time,</if>
<if test="purchaseExplain != null">purchase_explain,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseOrderNumber != null">#{purchaseOrderNumber},</if>
<if test="supplierCode != null">#{supplierCode},</if>
<if test="supplierName != null">#{supplierName},</if>
<if test="rawSubsidiaryCode != null">#{rawSubsidiaryCode},</if>
<if test="rawSubsidiaryName != null">#{rawSubsidiaryName},</if>
<if test="specificationModel != null">#{specificationModel},</if>
<if test="commonCurrency != null">#{commonCurrency},</if>
<if test="purchasingUnit != null">#{purchasingUnit},</if>
<if test="purchasePrice != null">#{purchasePrice},</if>
<if test="materialQuantity != null">#{materialQuantity},</if>
<if test="amountMoney != null">#{amountMoney},</if>
<if test="deliveryTime != null">#{deliveryTime},</if>
<if test="purchaseExplain != null">#{purchaseExplain},</if>
</trim>
</insert>
<update id="updatePurchaseMaterial" parameterType="PurchaseMaterial">
update purchase_material
<trim prefix="SET" suffixOverrides=",">
<if test="purchaseOrderNumber != null">purchase_order_number = #{purchaseOrderNumber},</if>
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
<if test="supplierName != null">supplier_name = #{supplierName},</if>
<if test="rawSubsidiaryCode != null">raw_subsidiary_code = #{rawSubsidiaryCode},</if>
<if test="rawSubsidiaryName != null">raw_subsidiary_name = #{rawSubsidiaryName},</if>
<if test="specificationModel != null">specification_model = #{specificationModel},</if>
<if test="commonCurrency != null">common_currency = #{commonCurrency},</if>
<if test="purchasingUnit != null">purchasing_unit = #{purchasingUnit},</if>
<if test="purchasePrice != null">purchase_price = #{purchasePrice},</if>
<if test="materialQuantity != null">material_quantity = #{materialQuantity},</if>
<if test="amountMoney != null">amount_money = #{amountMoney},</if>
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
<if test="purchaseExplain != null">purchase_explain = #{purchaseExplain},</if>
</trim>
where purchase_material_id = #{purchaseMaterialId}
</update>
<delete id="deletePurchaseMaterialById" parameterType="Long">
delete from purchase_material where purchase_material_id = #{purchaseMaterialId}
</delete>
<delete id="deletePurchaseMaterialByIds" parameterType="String">
delete from purchase_material where purchase_material_id in
<foreach item="purchaseMaterialId" collection="array" open="(" separator="," close=")">
#{purchaseMaterialId}
</foreach>
</delete>
</mapper>