<?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.zehong.system.mapper.TPipeOldPlanProgressMapper">

    <resultMap type="com.zehong.system.domain.TPipeOldPlanProgress" id="TPipeOldPlanProgressResult">
        <result property="id"    column="id"    />
        <result property="serialNumber"    column="serial_number"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="constructionContent"    column="construction_content"    />
        <result property="coordinates"    column="coordinates"    />
        <result property="createTime"    column="create_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTPipeOldPlanProgressVo">
        select id, serial_number, start_time, end_time, construction_content, coordinates, create_time, remark from t_pipe_old_plan_progress
    </sql>

    <select id="selectTPipeOldPlanProgressList" parameterType="com.zehong.system.domain.TPipeOldPlanProgress" resultMap="TPipeOldPlanProgressResult">
        <include refid="selectTPipeOldPlanProgressVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="serialNumber != null  and serialNumber != ''"> and serial_number = #{serialNumber}</if>
            <if test="startTime != null  and startTime != ''"> and start_time = #{startTime}</if>
            <if test="endTime != null  and endTime != ''"> and end_time = #{endTime}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
        </where>
    </select>

    <select id="selectTPipeOldPlanProgressById" parameterType="Long" resultMap="TPipeOldPlanProgressResult">
        <include refid="selectTPipeOldPlanProgressVo"/>
        where id = #{id}
    </select>

    <insert id="insertTPipeOldPlanProgress" parameterType="com.zehong.system.domain.TPipeOldPlanProgress">
        insert into t_pipe_old_plan_progress
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="serialNumber != null">serial_number,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="constructionContent != null">construction_content,</if>
            <if test="coordinates != null">coordinates,</if>
            <if test="createTime != null">create_time,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="serialNumber != null">#{serialNumber},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="constructionContent != null">#{constructionContent},</if>
            <if test="coordinates != null">#{coordinates},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>

    <update id="updateTPipeOldPlanProgress" parameterType="com.zehong.system.domain.TPipeOldPlanProgress">
        update t_pipe_old_plan_progress
        <trim prefix="SET" suffixOverrides=",">
            <if test="serialNumber != null">serial_number = #{serialNumber},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="constructionContent != null">construction_content = #{constructionContent},</if>
            <if test="coordinates != null">coordinates = #{coordinates},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTPipeOldPlanProgressById" parameterType="Long">
        delete from t_pipe_old_plan_progress where id = #{id}
    </delete>

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