PoolIndustryMapper.xml 12.5 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.PoolIndustryMapper">
    
    <resultMap type="com.chinagas.modules.insight.domian.PoolIndustry" id="PoolIndustryResult">
        <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="address"    column="address"    />
        <result property="isProvide"    column="is_provide"    />
        <result property="commercialStatus"    column="commercial_status"    />
        <result property="projectType"    column="project_type"    />
        <result property="industryType"    column="industry_type"    />
        <result property="distance"    column="distance"    />
        <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="machineName"    column="machine_name"    />
        <result property="machineModel"    column="machine_model"    />
        <result property="userType"    column="user_type"    />
        <result property="contactPerson"    column="contact_person"    />
        <result property="duties"    column="duties"    />
        <result property="phoneNumber"    column="phone_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"    />
    </resultMap>

    <sql id="selectPoolIndustryVo">
        select id, area,entity, budget_subject, taxpayer_number, address, is_provide, commercial_status, project_type, industry_type, distance, predict_max, predict_sign, predict_install, predict_use, machine_name, machine_model, user_type, contact_person, duties, phone_number, sys_ctime, sys_utime, create_by, update_by, delete_flag from pool_industry
    </sql>

    <select id="selectPoolIndustryList" parameterType="com.chinagas.modules.insight.domian.PoolIndustry" resultMap="PoolIndustryResult">
        <include refid="selectPoolIndustryVo"/>
        <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="address != null  and address != ''"> and address = #{address}</if>
            <if test="isProvide != null "> and is_provide = #{isProvide}</if>
            <if test="commercialStatus != null "> and commercial_status = #{commercialStatus}</if>
            <if test="projectType != null "> and project_type = #{projectType}</if>
            <if test="industryType != null  and industryType != ''"> and industry_type = #{industryType}</if>
            <if test="distance != null "> and distance = #{distance}</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="machineName != null "> and machine_name like concat('%', #{machineName}, '%')</if>
            <if test="machineModel != null  and machineModel != ''"> and machine_model = #{machineModel}</if>
            <if test="userType != null "> and user_type = #{userType}</if>
            <if test="contactPerson != null  and contactPerson != ''"> and contact_person like concat('%', #{contactPerson}, '%')</if>
            <if test="duties != null "> and duties = #{duties}</if>
            <if test="phoneNumber != null  and phoneNumber != ''"> and phone_number = #{phoneNumber}</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="selectPoolIndustryById" parameterType="Long" resultMap="PoolIndustryResult">
        <include refid="selectPoolIndustryVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertPoolIndustry" parameterType="com.chinagas.modules.insight.domian.PoolIndustry">
        insert into pool_industry
        <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="address != null and address != ''">address,</if>
            <if test="isProvide != null">is_provide,</if>
            <if test="commercialStatus != null">commercial_status,</if>
            <if test="projectType != null">project_type,</if>
            <if test="industryType != null and industryType != ''">industry_type,</if>
            <if test="distance != null">distance,</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="machineName != null">machine_name,</if>
            <if test="machineModel != null and machineModel != ''">machine_model,</if>
            <if test="userType != null">user_type,</if>
            <if test="contactPerson != null and contactPerson != ''">contact_person,</if>
            <if test="duties != null">duties,</if>
            <if test="phoneNumber != null and phoneNumber != ''">phone_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>
         </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="address != null and address != ''">#{address},</if>
            <if test="isProvide != null">#{isProvide},</if>
            <if test="commercialStatus != null">#{commercialStatus},</if>
            <if test="projectType != null">#{projectType},</if>
            <if test="industryType != null and industryType != ''">#{industryType},</if>
            <if test="distance != null">#{distance},</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="machineName != null">#{machineName},</if>
            <if test="machineModel != null and machineModel != ''">#{machineModel},</if>
            <if test="userType != null">#{userType},</if>
            <if test="contactPerson != null and contactPerson != ''">#{contactPerson},</if>
            <if test="duties != null">#{duties},</if>
            <if test="phoneNumber != null and phoneNumber != ''">#{phoneNumber},</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="updatePoolIndustry" parameterType="com.chinagas.modules.insight.domian.PoolIndustry">
        update pool_industry
        <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="address != null and address != ''">address = #{address},</if>
            <if test="isProvide != null">is_provide = #{isProvide},</if>
            <if test="commercialStatus != null">commercial_status = #{commercialStatus},</if>
            <if test="projectType != null">project_type = #{projectType},</if>
            <if test="industryType != null and industryType != ''">industry_type = #{industryType},</if>
            <if test="distance != null">distance = #{distance},</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="machineName != null">machine_name = #{machineName},</if>
            <if test="machineModel != null and machineModel != ''">machine_model = #{machineModel},</if>
            <if test="userType != null">user_type = #{userType},</if>
            <if test="contactPerson != null and contactPerson != ''">contact_person = #{contactPerson},</if>
            <if test="duties != null">duties = #{duties},</if>
            <if test="phoneNumber != null and phoneNumber != ''">phone_number = #{phoneNumber},</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="deletePoolIndustryById" parameterType="Long">
        delete from pool_industry where id = #{id}
    </delete>

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

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

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

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

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

    </select>
</mapper>