<?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.business.mapper.MesAlterRecordMapper">
    
    <resultMap type="MesAlterRecord" id="MesAlterRecordResult">
        <result property="id"    column="id"    />
        <result property="methodName"    column="method_name"    />
        <result property="orderId"    column="order_id"    />
        <result property="goodsId"    column="goods_id"    />
        <result property="number"    column="number"    />
        <result property="taskNo"    column="task_no"    />
        <result property="status"    column="status"    />
        <result property="apiInfo"    column="api_info"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectMesAlterRecordVo">
        select id, method_name, order_id, goods_id, number, task_no, status, api_info, update_time from mes_alter_record
    </sql>

    <select id="selectMesAlterRecordList" parameterType="MesAlterRecord" resultMap="MesAlterRecordResult">
        <include refid="selectMesAlterRecordVo"/>
        <where>  
            <if test="methodName != null  and methodName != ''"> and method_name like concat('%', #{methodName}, '%')</if>
            <if test="orderId != null  and orderId != ''"> and order_id = #{orderId}</if>
            <if test="goodsId != null  and goodsId != ''"> and goods_id = #{goodsId}</if>
            <if test="number != null "> and number = #{number}</if>
            <if test="taskNo != null  and taskNo != ''"> and task_no = #{taskNo}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="apiInfo != null  and apiInfo != ''"> and api_info = #{apiInfo}</if>
        </where>
    </select>
    
    <select id="selectMesAlterRecordById" parameterType="String" resultMap="MesAlterRecordResult">
        <include refid="selectMesAlterRecordVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMesAlterRecord" parameterType="MesAlterRecord">
        insert into mes_alter_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="methodName != null">method_name,</if>
            <if test="orderId != null">order_id,</if>
            <if test="goodsId != null">goods_id,</if>
            <if test="number != null">number,</if>
            <if test="taskNo != null">task_no,</if>
            <if test="status != null">status,</if>
            <if test="apiInfo != null">api_info,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="methodName != null">#{methodName},</if>
            <if test="orderId != null">#{orderId},</if>
            <if test="goodsId != null">#{goodsId},</if>
            <if test="number != null">#{number},</if>
            <if test="taskNo != null">#{taskNo},</if>
            <if test="status != null">#{status},</if>
            <if test="apiInfo != null">#{apiInfo},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateMesAlterRecord" parameterType="MesAlterRecord">
        update mes_alter_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="methodName != null">method_name = #{methodName},</if>
            <if test="orderId != null">order_id = #{orderId},</if>
            <if test="goodsId != null">goods_id = #{goodsId},</if>
            <if test="number != null">number = #{number},</if>
            <if test="taskNo != null">task_no = #{taskNo},</if>
            <if test="status != null">status = #{status},</if>
            <if test="apiInfo != null">api_info = #{apiInfo},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMesAlterRecordById" parameterType="String">
        delete from mes_alter_record where id = #{id}
    </delete>

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

</mapper>