NewBuildingInfoMapper.xml 6.16 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.NewBuildingInfoMapper">
    
    <resultMap type="com.chinagas.modules.insight.domian.NewBuildingInfo" id="NewBuildingInfoResult">
        <result property="id"    column="id"    />
        <result property="reportNo"    column="report_no"    />
        <result property="fiscalYear"    column="fiscal_year"    />
        <result property="communityName"    column="community_name"    />
        <result property="householdNumber"    column="household_number"    />
        <result property="predictInstallNumber"    column="predict_install_number"    />
        <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="classify"    column="classify"    />
    </resultMap>

    <sql id="selectNewBuildingInfoVo">
        select id, report_no, fiscal_year, community_name, household_number, predict_install_number,
                sys_ctime, sys_utime, create_by, update_by, delete_flag, classify from new_building_info
    </sql>

    <select id="selectNewBuildingInfoList" parameterType="com.chinagas.modules.insight.domian.NewBuildingInfo" resultMap="NewBuildingInfoResult">
        <include refid="selectNewBuildingInfoVo"/>
        <where>  
            <if test="reportNo != null  and reportNo != ''"> and report_no = #{reportNo}</if>
            <if test="fiscalYear != null "> and fiscal_year = #{fiscalYear}</if>
            <if test="communityName != null  and communityName != ''"> and community_name like concat('%', #{communityName}, '%')</if>
            <if test="householdNumber != null "> and household_number = #{householdNumber}</if>
            <if test="predictInstallNumber != null "> and predict_install_number = #{predictInstallNumber}</if>
            <if test="sysCtime != null "> and sys_ctime = #{sysCtime}</if>
            <if test="sysUtime != null "> and sys_utime = #{sysUtime}</if>
            and delete_flag = 0
        </where>
    </select>
    
    <select id="selectNewBuildingInfoById" resultMap="NewBuildingInfoResult">
        <include refid="selectNewBuildingInfoVo"/>
        where report_no = #{reportNo}
    </select>
        
    <insert id="insertNewBuildingInfo" parameterType="com.chinagas.modules.insight.domian.NewBuildingInfo">
        insert into new_building_info
        <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="communityName != null and communityName != ''">community_name,</if>
            <if test="householdNumber != null">household_number,</if>
            <if test="predictInstallNumber != null">predict_install_number,</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="classify != null">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="communityName != null and communityName != ''">#{communityName},</if>
            <if test="householdNumber != null">#{householdNumber},</if>
            <if test="predictInstallNumber != null">#{predictInstallNumber},</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="classify != null">#{classify},</if>
         </trim>
    </insert>

    <update id="updateNewBuildingInfo" parameterType="com.chinagas.modules.insight.domian.NewBuildingInfo">
        update new_building_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="reportNo != null and reportNo != ''">report_no = #{reportNo},</if>
            <if test="fiscalYear != null">fiscal_year = #{fiscalYear},</if>
            <if test="communityName != null and communityName != ''">community_name = #{communityName},</if>
            <if test="householdNumber != null">household_number = #{householdNumber},</if>
            <if test="predictInstallNumber != null">predict_install_number = #{predictInstallNumber},</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>
        </trim>
        where id = #{id}
    </update>

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

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

    <delete id="deleteNewBuildingInfoByReportNo" parameterType="String">
        delete from new_building_info where report_no = #{reportNo}
    </delete>
</mapper>