<?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.ytpm.dao.WorkorderMapper">

    <insert id="insert">
        insert into yt_work_order
        (
         workorder_id,
         title,
         content,
         processor,
         remark,
         finish_time,
         create_user_id,
         create_time,
         update_user_id,
         update_time,
         available
        )
        values
        (
          #{workorderId},
          #{title},
          #{content},
          #{processor},
          #{remark},
          #{finishTime},
          #{createUserId},
          #{createTime},
          #{updateUserId},
          #{updateTime},
          #{available}
        )
    </insert>
    <update id="updateById">
        update yt_work_order
        <set>
            <if test="title !=null">
                title = #{title},
            </if>
            <if test="content !=null">
                content = #{content},
            </if>
            <if test="processor !=null">
                processor = #{processor},
            </if>
            <if test="remark !=null">
                remark = #{remark},
            </if>
            <if test="finishTime !=null">
                finish_time = #{finishTime},
            </if>
            <if test="updateUserId !=null">
                update_user_id = #{updateUserId},
            </if>
            <if test="updateTime !=null">
                update_time = #{updateTime},
            </if>
            <if test="available !=null">
                available = #{available}
            </if>
        </set>
        where workorder_id = #{workorderId}
    </update>
    <select id="selectPrimary" resultType="com.ytpm.agent.model.YtWorkorder">
        select
            workorder_id, title, content, workorder_status, remark, processor, finish_time, create_user_id, create_time, update_user_id, update_time, available
        from yt_work_order
        where workorder_id = #{workorderId}
    </select>
</mapper>