NewBuildingItemMapper.xml 7.92 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.NewBuildingItemMapper">
    
    <resultMap type="com.chinagas.modules.insight.domian.NewBuildingItem" id="NewBuildingItemResult">
        <result property="id"    column="id"    />
        <result property="reportNo"    column="report_no"    />
        <result property="fiscalYear"    column="fiscal_year"    />
        <result property="buildingName"    column="building_name"    />
        <result property="buildingType"    column="building_type"    />
        <result property="developerName"    column="developer_name"    />
        <result property="predictPipelineNumber"    column="predict_pipeline_number"    />
        <result property="signTime"    column="sign_time"    />
        <result property="predictInstallTime"    column="predict_install_time"    />
        <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="deleteFlag"    column="delete_flag"    />
        <result property="yearClassify"    column="year_classify"    />
    </resultMap>

    <sql id="selectNewBuildingItemVo">
        select id, report_no, fiscal_year, building_name, building_type, developer_name, predict_pipeline_number,
               sign_time, predict_install_time, sys_ctime, sys_utime, create_by, update_by,
               delete_flag, year_classify from new_building_item
    </sql>

    <select id="selectNewBuildingItemList" parameterType="com.chinagas.modules.insight.domian.NewBuildingItem" resultMap="NewBuildingItemResult">
        <include refid="selectNewBuildingItemVo"/>
        <where>  
            <if test="reportNo != null  and reportNo != ''"> and report_no = #{reportNo}</if>
            <if test="fiscalYear != null "> and fiscal_year = #{fiscalYear}</if>
            <if test="buildingName != null  and buildingName != ''"> and building_name like concat('%', #{buildingName}, '%')</if>
            <if test="buildingType != null  and buildingType != ''"> and building_type = #{buildingType}</if>
            <if test="developerName != null  and developerName != ''"> and developer_name like concat('%', #{developerName}, '%')</if>
            <if test="predictPipelineNumber != null "> and predict_pipeline_number = #{predictPipelineNumber}</if>
            <if test="signTime != null and signTime != '' "> and sign_time = #{signTime}</if>
            <if test="predictInstallTime != null and predictInstallTime != ''"> and predict_install_time = #{predictInstallTime}</if>
            <if test="sysCtime != null "> and sys_ctime = #{sysCtime}</if>
            <if test="sysUtime != null "> and sys_utime = #{sysUtime}</if>
            <if test="yearClassify != null "> and year_classify = #{yearClassify}</if>
            and delete_flag = 0
        </where>
    </select>
    
    <select id="selectNewBuildingItemById" resultMap="NewBuildingItemResult">
        <include refid="selectNewBuildingItemVo"/>
        where report_no = #{reportNo}
        and delete_flag = 0
    </select>
        
    <insert id="insertNewBuildingItem" parameterType="com.chinagas.modules.insight.domian.NewBuildingItem">
        insert into new_building_item
        <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="buildingName != null and buildingName != ''">building_name,</if>
            <if test="buildingType != null and buildingType != ''">building_type,</if>
            <if test="developerName != null and developerName != ''">developer_name,</if>
            <if test="predictPipelineNumber != null">predict_pipeline_number,</if>
            <if test="signTime != null and signTime != ''">sign_time,</if>
            <if test="predictInstallTime != null and predictInstallTime != ''">predict_install_time,</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="deleteFlag != null">delete_flag,</if>
            <if test="yearClassify != null">year_classify,</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="buildingName != null and buildingName != ''">#{buildingName},</if>
            <if test="buildingType != null and buildingType != ''">#{buildingType},</if>
            <if test="developerName != null and developerName != ''">#{developerName},</if>
            <if test="predictPipelineNumber != null">#{predictPipelineNumber},</if>
            <if test="signTime != null and signTime != ''">#{signTime},</if>
            <if test="predictInstallTime != null and predictInstallTime != ''">#{predictInstallTime},</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="deleteFlag != null">#{deleteFlag},</if>
            <if test="yearClassify != null">#{yearClassify},</if>
         </trim>
    </insert>

    <update id="updateNewBuildingItem" parameterType="com.chinagas.modules.insight.domian.NewBuildingItem">
        update new_building_item
        <trim prefix="SET" suffixOverrides=",">
            <if test="reportNo != null and reportNo != ''">report_no = #{reportNo},</if>
            <if test="fiscalYear != null">fiscal_year = #{fiscalYear},</if>
            <if test="buildingName != null and buildingName != ''">building_name = #{buildingName},</if>
            <if test="buildingType != null and buildingType != ''">building_type = #{buildingType},</if>
            <if test="developerName != null and developerName != ''">developer_name = #{developerName},</if>
            <if test="predictPipelineNumber != null">predict_pipeline_number = #{predictPipelineNumber},</if>
            <if test="signTime != null and signTime != ''">sign_time = #{signTime},</if>
            <if test="predictInstallTime != null and predictInstallTime != ''">predict_install_time = #{predictInstallTime},</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="deleteFlag != null">delete_flag = #{deleteFlag},</if>
            <if test="yearClassify != null">year_classify = #{yearClassify},</if>
        </trim>
        where id = #{id}
    </update>

    <update id="deleteNewBuildingItemById" parameterType="com.chinagas.modules.insight.domian.NewBuildingItem">
        update new_building_item
        <trim prefix="SET" suffixOverrides=",">
            delete_flag = 1
        </trim>
        where report_no = #{reportNo}
    </update>

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

    <delete id="deleteNewBuildingItemByReportNo" parameterType="String">
        delete from new_building_item where report_no = #{reportNo}
    </delete>

</mapper>