<?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.WmsImportResultMapper">
    
    <resultMap type="WmsImportResult" id="WmsImportResultResult">
        <result property="model"    column="model"    />
        <result property="specification"    column="specification"    />
        <result property="wireDisc"    column="wire_disc"    />
        <result property="totalNumber"    column="total_number"    />
        <result property="totalNetWeight"    column="total_net_weight"    />
        <result property="totalGrossWeight"    column="total_gross_weight"    />
        <result property="type"    column="type"    />
        <result property="warningValue"    column="warning_value"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectWmsImportResultVo">
        select model, specification, wire_disc, total_number, total_net_weight, total_gross_weight, type, warning_value, update_time from wms_import_result
    </sql>

    <select id="selectWmsImportResultList" parameterType="WmsImportResult" resultMap="WmsImportResultResult">
        <include refid="selectWmsImportResultVo"/>
        <where>  
            <if test="model != null  and model != ''"> and model = #{model}</if>
            <if test="specification != null  and specification != ''"> and specification = #{specification}</if>
            <if test="wireDisc != null  and wireDisc != ''"> and wire_disc = #{wireDisc}</if>
            <if test="totalNumber != null "> and total_number = #{totalNumber}</if>
            <if test="totalNetWeight != null "> and total_net_weight = #{totalNetWeight}</if>
            <if test="totalGrossWeight != null "> and total_gross_weight = #{totalGrossWeight}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="warningValue != null "> and warning_value = #{warningValue}</if>
        </where>
    </select>
    
    <select id="selectWmsImportResultByModel" parameterType="String" resultMap="WmsImportResultResult">
        <include refid="selectWmsImportResultVo"/>
        where model = #{model}
    </select>

    <insert id="insertWmsImportResult" parameterType="WmsImportResult">
        insert into wms_import_result
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="model != null">model,</if>
            <if test="specification != null">specification,</if>
            <if test="wireDisc != null">wire_disc,</if>
            <if test="totalNumber != null">total_number,</if>
            <if test="totalNetWeight != null">total_net_weight,</if>
            <if test="totalGrossWeight != null">total_gross_weight,</if>
            <if test="type != null">type,</if>
            <if test="warningValue != null">warning_value,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="model != null">#{model},</if>
            <if test="specification != null">#{specification},</if>
            <if test="wireDisc != null">#{wireDisc},</if>
            <if test="totalNumber != null">#{totalNumber},</if>
            <if test="totalNetWeight != null">#{totalNetWeight},</if>
            <if test="totalGrossWeight != null">#{totalGrossWeight},</if>
            <if test="type != null">#{type},</if>
            <if test="warningValue != null">#{warningValue},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateWmsImportResult" parameterType="WmsImportResult">
        update wms_import_result
        <trim prefix="SET" suffixOverrides=",">
            <if test="specification != null">specification = #{specification},</if>
            <if test="wireDisc != null">wire_disc = #{wireDisc},</if>
            <if test="totalNumber != null">total_number = #{totalNumber},</if>
            <if test="totalNetWeight != null">total_net_weight = #{totalNetWeight},</if>
            <if test="totalGrossWeight != null">total_gross_weight = #{totalGrossWeight},</if>
            <if test="type != null">type = #{type},</if>
            <if test="warningValue != null">warning_value = #{warningValue},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where model = #{model}
    </update>

    <delete id="deleteWmsImportResultByModel" parameterType="String">
        delete from wms_import_result where model = #{model}
    </delete>

    <delete id="deleteWmsImportResultByModels" parameterType="String">
        delete from wms_import_result where model in 
        <foreach item="model" collection="array" open="(" separator="," close=")">
            #{model}
        </foreach>
    </delete>
</mapper>