TargetSuggestionMapper.xml 10.9 KB
<?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.chinagas.modules.insight.mapper.TargetSuggestionMapper">
    
    <resultMap type="com.chinagas.modules.insight.domian.TargetSuggestion" id="TargetSuggestionResult">
        <result property="id"    column="id"    />
        <result property="reportNo"    column="report_no"    />
        <result property="fiscalYear"    column="fiscal_year"    />
        <result property="planSignHousehold"    column="plan_sign_household"    />
        <result property="planInstallHousehold"    column="plan_install_household"    />
        <result property="newUserPlan"    column="new_user_plan"    />
        <result property="oldUserPlan"    column="old_user_plan"    />
        <result property="townsUserPlan"    column="towns_user_plan"    />
        <result property="commerceUserPlan"    column="commerce_user_plan"    />
        <result property="industryUserPlan"    column="industry_user_plan"    />
        <result property="totalPlan"    column="total_plan"    />
        <result property="newBuildingIdea"    column="new_building_idea"    />
        <result property="oldBuildingIdea"    column="old_building_idea"    />
        <result property="villageBuildingIdea"    column="village_building_idea"    />
        <result property="commerceIdea"    column="commerce_idea"    />
        <result property="achievedMeasure"    column="achieved_measure"    />
        <result property="sysCtime"    column="sys_ctime"    />
        <result property="sysUtime"    column="sys_utime"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="isDelete"    column="is_delete"    />
    </resultMap>

    <sql id="selectTargetSuggestionVo">
        select id, report_no, fiscal_year, plan_sign_household, plan_install_household, new_user_plan, old_user_plan,
               towns_user_plan, commerce_user_plan, industry_user_plan, total_plan, new_building_idea, old_building_idea,
               village_building_idea, commerce_idea, achieved_measure, sys_ctime, sys_utime, create_by, update_by, is_delete from target_suggestion
    </sql>

    <select id="selectTargetSuggestionList" parameterType="com.chinagas.modules.insight.domian.TargetSuggestion" resultMap="TargetSuggestionResult">
        <include refid="selectTargetSuggestionVo"/>
        <where>  
            <if test="reportNo != null  and reportNo != ''"> and report_no = #{reportNo}</if>
            <if test="fiscalYear != null"> and fiscal_year = #{fiscalYear}</if>
            <if test="planSignHousehold != null "> and plan_sign_household = #{planSignHousehold}</if>
            <if test="planInstallHousehold != null "> and plan_install_household = #{planInstallHousehold}</if>
            <if test="newUserPlan != null  and newUserPlan != ''"> and new_user_plan = #{newUserPlan}</if>
            <if test="oldUserPlan != null  and oldUserPlan != ''"> and old_user_plan = #{oldUserPlan}</if>
            <if test="townsUserPlan != null  and townsUserPlan != ''"> and towns_user_plan = #{townsUserPlan}</if>
            <if test="commerceUserPlan != null  and commerceUserPlan != ''"> and commerce_user_plan = #{commerceUserPlan}</if>
            <if test="industryUserPlan != null  and industryUserPlan != ''"> and industry_user_plan = #{industryUserPlan}</if>
            <if test="totalPlan != null  and totalPlan != ''"> and total_plan = #{totalPlan}</if>
            <if test="newBuildingIdea != null  and newBuildingIdea != ''"> and new_building_idea = #{newBuildingIdea}</if>
            <if test="oldBuildingIdea != null  and oldBuildingIdea != ''"> and old_building_idea = #{oldBuildingIdea}</if>
            <if test="villageBuildingIdea != null  and villageBuildingIdea != ''"> and village_building_idea = #{villageBuildingIdea}</if>
            <if test="commerceIdea != null  and commerceIdea != ''"> and commerce_idea = #{commerceIdea}</if>
            <if test="achievedMeasure != null  and achievedMeasure != ''"> and achieved_measure = #{achievedMeasure}</if>
            <if test="sysCtime != null "> and sys_ctime = #{sysCtime}</if>
            <if test="sysUtime != null "> and sys_utime = #{sysUtime}</if>
            and is_delete = 0
        </where>
    </select>
    
    <select id="selectTargetSuggestionById" resultMap="TargetSuggestionResult">
        <include refid="selectTargetSuggestionVo"/>
        where report_no = #{reportNo}
    </select>
        
    <insert id="insertTargetSuggestion" parameterType="com.chinagas.modules.insight.domian.TargetSuggestion">
        insert into target_suggestion
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="reportNo != null and reportNo != ''">report_no,</if>
            <if test="fiscalYear != null">fiscal_year,</if>
            <if test="planSignHousehold != null">plan_sign_household,</if>
            <if test="planInstallHousehold != null">plan_install_household,</if>
            <if test="newUserPlan != null and newUserPlan != ''">new_user_plan,</if>
            <if test="oldUserPlan != null and oldUserPlan != ''">old_user_plan,</if>
            <if test="townsUserPlan != null and townsUserPlan != ''">towns_user_plan,</if>
            <if test="commerceUserPlan != null and commerceUserPlan != ''">commerce_user_plan,</if>
            <if test="industryUserPlan != null and industryUserPlan != ''">industry_user_plan,</if>
            <if test="totalPlan != null and totalPlan != ''">total_plan,</if>
            <if test="newBuildingIdea != null and newBuildingIdea != ''">new_building_idea,</if>
            <if test="oldBuildingIdea != null and oldBuildingIdea != ''">old_building_idea,</if>
            <if test="villageBuildingIdea != null and villageBuildingIdea != ''">village_building_idea,</if>
            <if test="commerceIdea != null and commerceIdea != ''">commerce_idea,</if>
            <if test="achievedMeasure != null and achievedMeasure != ''">achieved_measure,</if>
            <if test="sysCtime != null">sys_ctime,</if>
            <if test="sysUtime != null">sys_utime,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="updateBy != null and updateBy != ''">update_by,</if>
            <if test="isDelete != null">is_delete,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="reportNo != null and reportNo != ''">#{reportNo},</if>
            <if test="fiscalYear != null">#{fiscalYear},</if>
            <if test="planSignHousehold != null">#{planSignHousehold},</if>
            <if test="planInstallHousehold != null">#{planInstallHousehold},</if>
            <if test="newUserPlan != null and newUserPlan != ''">#{newUserPlan},</if>
            <if test="oldUserPlan != null and oldUserPlan != ''">#{oldUserPlan},</if>
            <if test="townsUserPlan != null and townsUserPlan != ''">#{townsUserPlan},</if>
            <if test="commerceUserPlan != null and commerceUserPlan != ''">#{commerceUserPlan},</if>
            <if test="industryUserPlan != null and industryUserPlan != ''">#{industryUserPlan},</if>
            <if test="totalPlan != null and totalPlan != ''">#{totalPlan},</if>
            <if test="newBuildingIdea != null and newBuildingIdea != ''">#{newBuildingIdea},</if>
            <if test="oldBuildingIdea != null and oldBuildingIdea != ''">#{oldBuildingIdea},</if>
            <if test="villageBuildingIdea != null and villageBuildingIdea != ''">#{villageBuildingIdea},</if>
            <if test="commerceIdea != null and commerceIdea != ''">#{commerceIdea},</if>
            <if test="achievedMeasure != null and achievedMeasure != ''">#{achievedMeasure},</if>
            <if test="sysCtime != null">#{sysCtime},</if>
            <if test="sysUtime != null">#{sysUtime},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
            <if test="isDelete != null">#{isDelete},</if>
         </trim>
    </insert>

    <update id="updateTargetSuggestion" parameterType="com.chinagas.modules.insight.domian.TargetSuggestion">
        update target_suggestion
        <trim prefix="SET" suffixOverrides=",">
            <if test="reportNo != null and reportNo != ''">report_no = #{reportNo},</if>
            <if test="fiscalYear != null">fiscal_year = #{fiscalYear},</if>
            <if test="planSignHousehold != null">plan_sign_household = #{planSignHousehold},</if>
            <if test="planInstallHousehold != null">plan_install_household = #{planInstallHousehold},</if>
            <if test="newUserPlan != null and newUserPlan != ''">new_user_plan = #{newUserPlan},</if>
            <if test="oldUserPlan != null and oldUserPlan != ''">old_user_plan = #{oldUserPlan},</if>
            <if test="townsUserPlan != null and townsUserPlan != ''">towns_user_plan = #{townsUserPlan},</if>
            <if test="commerceUserPlan != null and commerceUserPlan != ''">commerce_user_plan = #{commerceUserPlan},</if>
            <if test="industryUserPlan != null and industryUserPlan != ''">industry_user_plan = #{industryUserPlan},</if>
            <if test="totalPlan != null and totalPlan != ''">total_plan = #{totalPlan},</if>
            <if test="newBuildingIdea != null and newBuildingIdea != ''">new_building_idea = #{newBuildingIdea},</if>
            <if test="oldBuildingIdea != null and oldBuildingIdea != ''">old_building_idea = #{oldBuildingIdea},</if>
            <if test="villageBuildingIdea != null and villageBuildingIdea != ''">village_building_idea = #{villageBuildingIdea},</if>
            <if test="commerceIdea != null and commerceIdea != ''">commerce_idea = #{commerceIdea},</if>
            <if test="achievedMeasure != null and achievedMeasure != ''">achieved_measure = #{achievedMeasure},</if>
            <if test="sysCtime != null">sys_ctime = #{sysCtime},</if>
            <if test="sysUtime != null">sys_utime = #{sysUtime},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="isDelete != null">is_delete = #{isDelete},</if>
        </trim>
        where report_no = #{reportNo}
    </update>

    <update id="deleteTargetSuggestionById" parameterType="com.chinagas.modules.insight.domian.TargetSuggestion">
        update target_suggestion
        <trim prefix="SET" suffixOverrides=",">
            is_delete = 1
        </trim>
        where report_no = #{reportNo}
    </update>

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