<?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.TPipeOldPlanProcessMapper">
    
    <resultMap type="TPipeOldPlanProcess" id="TPipeOldPlanProcessResult">
        <result property="fOldPlanProcessId"    column="f_old_plan_process_id"    />
        <result property="fUuid"    column="f_uuid"    />
        <result property="fEntUuid"    column="f_ent_uuid"    />
        <result property="fRegion"    column="f_region"    />
        <result property="fProjectName"    column="f_project_name"    />
        <result property="fRelationObjectType"    column="f_relation_object_type"    />
        <result property="fYear"    column="f_year"    />
        <result property="fStartTime"    column="f_start_time"    />
        <result property="fEndTime"    column="f_end_time"    />
        <result property="fTotalInvestment"    column="f_total_investment"    />
        <result property="fCreateTime"    column="f_create_time"    />
        <result property="fUpdateTime"    column="f_update_time"    />
        <result property="fSubjectImplementation"    column="f_subject_implementation"    />
        <result property="fConcatPerson"    column="f_concat_person"    />
        <result property="fConcatTel"    column="f_concat_tel"    />
        <result property="fConstructionContent"    column="f_construction_content"    />
        <result property="fActualFinishTime"    column="f_actual_finish_time"    />
        <result property="fReconstructionProgress"    column="f_reconstruction_progress"    />
        <result property="fFundsDisbursementProgress"    column="f_funds_disbursement_progress"    />
        <result property="fUploadType"    column="f_upload_type"    />
        <result property="fUploadTime"    column="f_upload_time"    />
    </resultMap>

    <sql id="selectTPipeOldPlanProcessVo">
        select f_old_plan_process_id, f_uuid, f_ent_uuid, f_region, f_project_name, f_relation_object_type, f_year, f_start_time, f_end_time, f_total_investment, f_create_time, f_update_time, f_subject_implementation, f_concat_person, f_concat_tel, f_construction_content, f_actual_finish_time, f_reconstruction_progress, f_funds_disbursement_progress, f_upload_type, f_upload_time from t_pipe_old_plan_process
    </sql>

    <select id="selectTPipeOldPlanProcessList" parameterType="TPipeOldPlanProcess" resultMap="TPipeOldPlanProcessResult">
        <include refid="selectTPipeOldPlanProcessVo"/>
        <where>  
            <if test="fProjectName != null  and fProjectName != ''"> and f_project_name like concat('%', #{fProjectName}, '%')</if>
            <if test="fRelationObjectType != null  and fRelationObjectType != ''"> and f_relation_object_type = #{fRelationObjectType}</if>
            <if test="fConcatPerson != null  and fConcatPerson != ''"> and f_concat_person like concat('%', #{fConcatPerson}, '%')</if>
            <if test="fConcatTel != null  and fConcatTel != ''"> and f_concat_tel like concat('%', #{fConcatTel}, '%')</if>
            <if test="fFundsDisbursementProgress != null "> and f_funds_disbursement_progress = #{fFundsDisbursementProgress}</if>
            <if test="fUploadType != null  and fUploadType != ''"> and f_upload_type = #{fUploadType}</if>
        </where>
    </select>
    
    <select id="selectTPipeOldPlanProcessById" parameterType="Long" resultMap="TPipeOldPlanProcessResult">
        <include refid="selectTPipeOldPlanProcessVo"/>
        where f_old_plan_process_id = #{fOldPlanProcessId}
    </select>
        
    <insert id="insertTPipeOldPlanProcess" parameterType="TPipeOldPlanProcess" useGeneratedKeys="true" keyProperty="fOldPlanProcessId">
        insert into t_pipe_old_plan_process
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fUuid != null and fUuid != ''">f_uuid,</if>
            <if test="fEntUuid != null">f_ent_uuid,</if>
            <if test="fRegion != null">f_region,</if>
            <if test="fProjectName != null">f_project_name,</if>
            <if test="fRelationObjectType != null">f_relation_object_type,</if>
            <if test="fYear != null">f_year,</if>
            <if test="fStartTime != null">f_start_time,</if>
            <if test="fEndTime != null">f_end_time,</if>
            <if test="fTotalInvestment != null">f_total_investment,</if>
            <if test="fCreateTime != null">f_create_time,</if>
            <if test="fUpdateTime != null">f_update_time,</if>
            <if test="fSubjectImplementation != null">f_subject_implementation,</if>
            <if test="fConcatPerson != null">f_concat_person,</if>
            <if test="fConcatTel != null">f_concat_tel,</if>
            <if test="fConstructionContent != null">f_construction_content,</if>
            <if test="fActualFinishTime != null">f_actual_finish_time,</if>
            <if test="fReconstructionProgress != null">f_reconstruction_progress,</if>
            <if test="fFundsDisbursementProgress != null">f_funds_disbursement_progress,</if>
            <if test="fUploadType != null">f_upload_type,</if>
            <if test="fUploadTime != null">f_upload_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fUuid != null and fUuid != ''">#{fUuid},</if>
            <if test="fEntUuid != null">#{fEntUuid},</if>
            <if test="fRegion != null">#{fRegion},</if>
            <if test="fProjectName != null">#{fProjectName},</if>
            <if test="fRelationObjectType != null">#{fRelationObjectType},</if>
            <if test="fYear != null">#{fYear},</if>
            <if test="fStartTime != null">#{fStartTime},</if>
            <if test="fEndTime != null">#{fEndTime},</if>
            <if test="fTotalInvestment != null">#{fTotalInvestment},</if>
            <if test="fCreateTime != null">#{fCreateTime},</if>
            <if test="fUpdateTime != null">#{fUpdateTime},</if>
            <if test="fSubjectImplementation != null">#{fSubjectImplementation},</if>
            <if test="fConcatPerson != null">#{fConcatPerson},</if>
            <if test="fConcatTel != null">#{fConcatTel},</if>
            <if test="fConstructionContent != null">#{fConstructionContent},</if>
            <if test="fActualFinishTime != null">#{fActualFinishTime},</if>
            <if test="fReconstructionProgress != null">#{fReconstructionProgress},</if>
            <if test="fFundsDisbursementProgress != null">#{fFundsDisbursementProgress},</if>
            <if test="fUploadType != null">#{fUploadType},</if>
            <if test="fUploadTime != null">#{fUploadTime},</if>
         </trim>
    </insert>

    <update id="updateTPipeOldPlanProcess" parameterType="TPipeOldPlanProcess">
        update t_pipe_old_plan_process
        <trim prefix="SET" suffixOverrides=",">
            <if test="fUuid != null and fUuid != ''">f_uuid = #{fUuid},</if>
            <if test="fEntUuid != null">f_ent_uuid = #{fEntUuid},</if>
            <if test="fRegion != null">f_region = #{fRegion},</if>
            <if test="fProjectName != null">f_project_name = #{fProjectName},</if>
            <if test="fRelationObjectType != null">f_relation_object_type = #{fRelationObjectType},</if>
            <if test="fYear != null">f_year = #{fYear},</if>
            <if test="fStartTime != null">f_start_time = #{fStartTime},</if>
            <if test="fEndTime != null">f_end_time = #{fEndTime},</if>
            <if test="fTotalInvestment != null">f_total_investment = #{fTotalInvestment},</if>
            <if test="fCreateTime != null">f_create_time = #{fCreateTime},</if>
            <if test="fUpdateTime != null">f_update_time = #{fUpdateTime},</if>
            <if test="fSubjectImplementation != null">f_subject_implementation = #{fSubjectImplementation},</if>
            <if test="fConcatPerson != null">f_concat_person = #{fConcatPerson},</if>
            <if test="fConcatTel != null">f_concat_tel = #{fConcatTel},</if>
            <if test="fConstructionContent != null">f_construction_content = #{fConstructionContent},</if>
            <if test="fActualFinishTime != null">f_actual_finish_time = #{fActualFinishTime},</if>
            <if test="fReconstructionProgress != null">f_reconstruction_progress = #{fReconstructionProgress},</if>
            <if test="fFundsDisbursementProgress != null">f_funds_disbursement_progress = #{fFundsDisbursementProgress},</if>
            <if test="fUploadType != null">f_upload_type = #{fUploadType},</if>
            <if test="fUploadTime != null">f_upload_time = #{fUploadTime},</if>
        </trim>
        where f_old_plan_process_id = #{fOldPlanProcessId}
    </update>

    <delete id="deleteTPipeOldPlanProcessById" parameterType="Long">
        delete from t_pipe_old_plan_process where f_old_plan_process_id = #{fOldPlanProcessId}
    </delete>

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