PoolCommerceMapper.xml 15 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.PoolCommerceMapper">
    
    <resultMap type="com.chinagas.modules.insight.domian.PoolCommerce" id="PoolCommerceResult">
        <result property="id"    column="id"    />
        <result property="area"    column="area"    />
        <result property="entity"    column="entity"    />
        <result property="budgetSubject"    column="budget_subject"    />
        <result property="taxpayerNumber"    column="taxpayer_number"    />
        <result property="city"    column="city"    />
        <result property="street"    column="street"    />
        <result property="houseNumber"    column="house_number"    />
        <result property="householdName"    column="household_name"    />
        <result property="householdAge"    column="household_age"    />
        <result property="phoneNumber"    column="phone_number"    />
        <result property="houseArea"    column="house_area"    />
        <result property="businessScope"    column="business_scope"    />
        <result property="houseNature"    column="house_nature"    />
        <result property="houseAttribute"    column="house_attribute"    />
        <result property="houseStructure"    column="house_structure"    />
        <result property="houseYear"    column="house_year"    />
        <result property="distance"    column="distance"    />
        <result property="isExist"    column="is_exist"    />
        <result property="isPlan"    column="is_plan"    />
        <result property="isSingleMeter"    column="is_single_meter"    />
        <result property="isHeating"    column="is_heating"    />
        <result property="currentEnergy"    column="current_energy"    />
        <result property="currentPrice"    column="current_price"    />
        <result property="predictMax"    column="predict_max"    />
        <result property="predictSign"    column="predict_sign"    />
        <result property="predictInstall"    column="predict_install"    />
        <result property="predictUse"    column="predict_use"    />
        <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"    />
    </resultMap>

    <sql id="selectPoolCommerceVo">
        select id, area,entity, budget_subject, taxpayer_number, city, street, house_number, household_name, household_age, phone_number, house_area, business_scope, house_nature, house_attribute, house_structure, house_year, distance, is_exist, is_plan, is_single_meter, is_heating, current_energy, current_price, predict_max, predict_sign, predict_install, predict_use, sys_ctime, sys_utime, create_by, update_by, delete_flag from pool_commerce
    </sql>

    <select id="selectPoolCommerceList" parameterType="com.chinagas.modules.insight.domian.PoolCommerce" resultMap="PoolCommerceResult">
        <include refid="selectPoolCommerceVo"/>
        <where>  
            <if test="area != null  and area != ''"> and area REGEXP #{area}</if>
            <if test="entity != null  and entity != ''"> and entity REGEXP #{entity}</if>
            <if test="budgetSubject != null  and budgetSubject != ''"> and budget_subject REGEXP #{budgetSubject}</if>
            <if test="taxpayerNumber != null  and taxpayerNumber != ''"> and taxpayer_number like concat('%', #{taxpayerNumber}, '%')</if>
            <if test="city != null  and city != ''"> and city = #{city}</if>
            <if test="street != null  and street != ''"> and street = #{street}</if>
            <if test="houseNumber != null  and houseNumber != ''"> and house_number = #{houseNumber}</if>
            <if test="householdName != null  and householdName != ''"> and household_name like concat('%', #{householdName}, '%')</if>
            <if test="householdAge != null "> and household_age = #{householdAge}</if>
            <if test="phoneNumber != null  and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
            <if test="houseArea != null  and houseArea != ''"> and house_area = #{houseArea}</if>
            <if test="businessScope != null "> and business_scope = #{businessScope}</if>
            <if test="houseNature != null "> and house_nature = #{houseNature}</if>
            <if test="houseAttribute != null "> and house_attribute = #{houseAttribute}</if>
            <if test="houseStructure != null "> and house_structure = #{houseStructure}</if>
            <if test="houseYear != null "> and house_year = #{houseYear}</if>
            <if test="distance != null "> and distance = #{distance}</if>
            <if test="isExist != null "> and is_exist = #{isExist}</if>
            <if test="isPlan != null "> and is_plan = #{isPlan}</if>
            <if test="isSingleMeter != null "> and is_single_meter = #{isSingleMeter}</if>
            <if test="isHeating != null "> and is_heating = #{isHeating}</if>
            <if test="currentEnergy != null "> and current_energy = #{currentEnergy}</if>
            <if test="currentPrice != null  and currentPrice != ''"> and current_price = #{currentPrice}</if>
            <if test="predictMax != null  and predictMax != ''"> and predict_max = #{predictMax}</if>
            <if test="predictSign != null "> and predict_sign = #{predictSign}</if>
            <if test="predictInstall != null "> and predict_install = #{predictInstall}</if>
            <if test="predictUse != null  and predictUse != ''"> and predict_use = #{predictUse}</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="selectPoolCommerceById" parameterType="Long" resultMap="PoolCommerceResult">
        <include refid="selectPoolCommerceVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertPoolCommerce" parameterType="com.chinagas.modules.insight.domian.PoolCommerce">
        insert into pool_commerce
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="area != null and area != ''">area,</if>
            <if test="entity != null and entity != ''">entity,</if>
            <if test="budgetSubject != null and budgetSubject != ''">budget_subject,</if>
            <if test="taxpayerNumber != null and taxpayerNumber != ''">taxpayer_number,</if>
            <if test="city != null and city != ''">city,</if>
            <if test="street != null and street != ''">street,</if>
            <if test="houseNumber != null and houseNumber != ''">house_number,</if>
            <if test="householdName != null and householdName != ''">household_name,</if>
            <if test="householdAge != null">household_age,</if>
            <if test="phoneNumber != null and phoneNumber != ''">phone_number,</if>
            <if test="houseArea != null and houseArea != ''">house_area,</if>
            <if test="businessScope != null">business_scope,</if>
            <if test="houseNature != null">house_nature,</if>
            <if test="houseAttribute != null">house_attribute,</if>
            <if test="houseStructure != null">house_structure,</if>
            <if test="houseYear != null">house_year,</if>
            <if test="distance != null">distance,</if>
            <if test="isExist != null">is_exist,</if>
            <if test="isPlan != null">is_plan,</if>
            <if test="isSingleMeter != null">is_single_meter,</if>
            <if test="isHeating != null">is_heating,</if>
            <if test="currentEnergy != null">current_energy,</if>
            <if test="currentPrice != null and currentPrice != ''">current_price,</if>
            <if test="predictMax != null and predictMax != ''">predict_max,</if>
            <if test="predictSign != null">predict_sign,</if>
            <if test="predictInstall != null">predict_install,</if>
            <if test="predictUse != null and predictUse != ''">predict_use,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="area != null and area != ''">#{area},</if>
            <if test="entity != null and entity != ''">#{entity},</if>
            <if test="budgetSubject != null and budgetSubject != ''">#{budgetSubject},</if>
            <if test="taxpayerNumber != null and taxpayerNumber != ''">#{taxpayerNumber},</if>
            <if test="city != null and city != ''">#{city},</if>
            <if test="street != null and street != ''">#{street},</if>
            <if test="houseNumber != null and houseNumber != ''">#{houseNumber},</if>
            <if test="householdName != null and householdName != ''">#{householdName},</if>
            <if test="householdAge != null">#{householdAge},</if>
            <if test="phoneNumber != null and phoneNumber != ''">#{phoneNumber},</if>
            <if test="houseArea != null and houseArea != ''">#{houseArea},</if>
            <if test="businessScope != null">#{businessScope},</if>
            <if test="houseNature != null">#{houseNature},</if>
            <if test="houseAttribute != null">#{houseAttribute},</if>
            <if test="houseStructure != null">#{houseStructure},</if>
            <if test="houseYear != null">#{houseYear},</if>
            <if test="distance != null">#{distance},</if>
            <if test="isExist != null">#{isExist},</if>
            <if test="isPlan != null">#{isPlan},</if>
            <if test="isSingleMeter != null">#{isSingleMeter},</if>
            <if test="isHeating != null">#{isHeating},</if>
            <if test="currentEnergy != null">#{currentEnergy},</if>
            <if test="currentPrice != null and currentPrice != ''">#{currentPrice},</if>
            <if test="predictMax != null and predictMax != ''">#{predictMax},</if>
            <if test="predictSign != null">#{predictSign},</if>
            <if test="predictInstall != null">#{predictInstall},</if>
            <if test="predictUse != null and predictUse != ''">#{predictUse},</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>
         </trim>
    </insert>

    <update id="updatePoolCommerce" parameterType="com.chinagas.modules.insight.domian.PoolCommerce">
        update pool_commerce
        <trim prefix="SET" suffixOverrides=",">
            <if test="area != null and area != ''">area = #{area},</if>
            <if test="entity != null and entity != ''">entity = #{entity},</if>
            <if test="budgetSubject != null and budgetSubject != ''">budget_subject = #{budgetSubject},</if>
            <if test="taxpayerNumber != null and taxpayerNumber != ''">taxpayer_number = #{taxpayerNumber},</if>
            <if test="city != null and city != ''">city = #{city},</if>
            <if test="street != null and street != ''">street = #{street},</if>
            <if test="houseNumber != null and houseNumber != ''">house_number = #{houseNumber},</if>
            <if test="householdName != null and householdName != ''">household_name = #{householdName},</if>
            <if test="householdAge != null">household_age = #{householdAge},</if>
            <if test="phoneNumber != null and phoneNumber != ''">phone_number = #{phoneNumber},</if>
            <if test="houseArea != null and houseArea != ''">house_area = #{houseArea},</if>
            <if test="businessScope != null">business_scope = #{businessScope},</if>
            <if test="houseNature != null">house_nature = #{houseNature},</if>
            <if test="houseAttribute != null">house_attribute = #{houseAttribute},</if>
            <if test="houseStructure != null">house_structure = #{houseStructure},</if>
            <if test="houseYear != null">house_year = #{houseYear},</if>
            <if test="distance != null">distance = #{distance},</if>
            <if test="isExist != null">is_exist = #{isExist},</if>
            <if test="isPlan != null">is_plan = #{isPlan},</if>
            <if test="isSingleMeter != null">is_single_meter = #{isSingleMeter},</if>
            <if test="isHeating != null">is_heating = #{isHeating},</if>
            <if test="currentEnergy != null">current_energy = #{currentEnergy},</if>
            <if test="currentPrice != null and currentPrice != ''">current_price = #{currentPrice},</if>
            <if test="predictMax != null and predictMax != ''">predict_max = #{predictMax},</if>
            <if test="predictSign != null">predict_sign = #{predictSign},</if>
            <if test="predictInstall != null">predict_install = #{predictInstall},</if>
            <if test="predictUse != null and predictUse != ''">predict_use = #{predictUse},</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>

    <delete id="deletePoolCommerceById" parameterType="Long">
        delete from pool_commerce where id = #{id}
    </delete>

    <delete id="deletePoolCommerceByIds" parameterType="String">
        update pool_commerce set delete_flag = 1
        where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <select id="selectPoolCommerceByIds" parameterType="Long" resultMap="PoolCommerceResult">
        <include refid="selectPoolCommerceVo"/>
        where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>

    <select id="selectExist" resultMap="PoolCommerceResult">
        <include refid="selectPoolCommerceVo"/>
        where taxpayer_number = #{taxpayerNumber}
        and delete_flag = 0
        limit 1
    </select>

    <select id="selectCount" resultType="java.lang.Integer">
        select count(*)
        from pool_commerce
        where delete_flag = 0
    </select>

    <select id="selectCount1" resultType="java.lang.Integer">
        select count(*)
        from pool_commerce
        <where>
            delete_flag = 0
            <if test="entity != null  and entity != ''"> and entity REGEXP #{entity}</if>
        </where>

    </select>

</mapper>