<?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.zehong.system.mapper.TStaEnterpriseInforMapper">

    <resultMap type="com.zehong.system.domain.TStaEnterpriseInfor" id="TStaEnterpriseInforResult">
        <result property="fEnterpriseId"    column="f_enterprise_id"    />
        <result property="fCityName"    column="f_city_name"    />
        <result property="fDistrictName"    column="f_district_name"    />
        <result property="fBizCode"    column="f_biz_code"    />
        <result property="fCompanyName"    column="f_company_name"    />
        <result property="fPipelineCertCode"    column="f_pipeline_cert_code"    />
        <result property="fPipelineComp"    column="f_pipeline_comp"    />
        <result property="fStationCertCode"    column="f_station_cert_code"    />
        <result property="fStationComp"    column="f_station_comp"    />
        <result property="fOtherCertCode"    column="f_other_cert_code"    />
        <result property="fOtherComp"    column="f_other_comp"    />
        <result property="fResponsibleCount"    column="f_responsible_count"    />
        <result property="fManagementCount"    column="f_management_count"    />
        <result property="fMaintenanceCount"    column="f_maintenance_count"    />
        <result property="fResponsibleCertCount"    column="f_responsible_cert_count"    />
        <result property="fManagementCertCount"    column="f_management_cert_count"    />
        <result property="fMaintenanceCertCount"    column="f_maintenance_cert_count"    />
        <result property="fStationCount"    column="f_station_count"    />
        <result property="fStorageStationCount"    column="f_storage_station_count"    />
        <result property="fGasificationStationCount"    column="f_gasification_station_count"    />
        <result property="fMixingStationCount"    column="f_mixing_station_count"    />
        <result property="fGasStationCount"    column="f_gas_station_count"    />
        <result property="fFillingStationCount"    column="f_filling_station_count"    />
        <result property="fSupplyStationCount"    column="f_supply_station_count"    />
        <result property="fPressureStationCount"    column="f_pressure_station_count"    />
        <result property="fOtherStationCount"    column="f_other_station_count"    />
        <result property="fCreateTime"    column="f_create_time"    />
        <result property="fUpdateTime"    column="f_update_time"    />
        <result property="isReport"    column="is_report"/>
        <result property="fYear"    column="f_year"    />
    </resultMap>

    <sql id="selectTStaEnterpriseInforVo">
        select f_enterprise_id, f_city_name, f_district_name, f_biz_code, f_company_name, f_pipeline_cert_code, f_pipeline_comp, f_station_cert_code, f_station_comp, f_other_cert_code, f_other_comp, f_responsible_count, f_management_count, f_maintenance_count, f_responsible_cert_count, f_management_cert_count, f_maintenance_cert_count, f_station_count, f_storage_station_count, f_gasification_station_count, f_mixing_station_count, f_gas_station_count, f_filling_station_count, f_supply_station_count, f_pressure_station_count, f_other_station_count, f_create_time, f_update_time, is_report, f_year from t_sta_enterprise_infor
    </sql>

    <select id="selectTStaEnterpriseInforList" parameterType="com.zehong.system.domain.TStaEnterpriseInfor" resultMap="TStaEnterpriseInforResult">
        <include refid="selectTStaEnterpriseInforVo"/>
        <where>
            <if test="fCityName != null  and fCityName != ''"> and f_city_name like concat('%', #{fCityName}, '%')</if>
            <if test="fDistrictName != null  and fDistrictName != ''"> and f_district_name like concat('%', #{fDistrictName}, '%')</if>
            <if test="fBizCode != null  and fBizCode != ''"> and f_biz_code = #{fBizCode}</if>
            <if test="fCompanyName != null  and fCompanyName != ''"> and f_company_name like concat('%', #{fCompanyName}, '%')</if>
            <if test="fPipelineCertCode != null  and fPipelineCertCode != ''"> and f_pipeline_cert_code = #{fPipelineCertCode}</if>
            <if test="fPipelineComp != null  and fPipelineComp != ''"> and f_pipeline_comp = #{fPipelineComp}</if>
            <if test="fStationCertCode != null  and fStationCertCode != ''"> and f_station_cert_code = #{fStationCertCode}</if>
            <if test="fStationComp != null  and fStationComp != ''"> and f_station_comp = #{fStationComp}</if>
            <if test="fOtherCertCode != null  and fOtherCertCode != ''"> and f_other_cert_code = #{fOtherCertCode}</if>
            <if test="fOtherComp != null  and fOtherComp != ''"> and f_other_comp = #{fOtherComp}</if>
            <if test="fResponsibleCount != null "> and f_responsible_count = #{fResponsibleCount}</if>
            <if test="fManagementCount != null "> and f_management_count = #{fManagementCount}</if>
            <if test="fMaintenanceCount != null "> and f_maintenance_count = #{fMaintenanceCount}</if>
            <if test="fResponsibleCertCount != null "> and f_responsible_cert_count = #{fResponsibleCertCount}</if>
            <if test="fManagementCertCount != null "> and f_management_cert_count = #{fManagementCertCount}</if>
            <if test="fMaintenanceCertCount != null "> and f_maintenance_cert_count = #{fMaintenanceCertCount}</if>
            <if test="fStationCount != null "> and f_station_count = #{fStationCount}</if>
            <if test="fStorageStationCount != null "> and f_storage_station_count = #{fStorageStationCount}</if>
            <if test="fGasificationStationCount != null "> and f_gasification_station_count = #{fGasificationStationCount}</if>
            <if test="fMixingStationCount != null "> and f_mixing_station_count = #{fMixingStationCount}</if>
            <if test="fGasStationCount != null "> and f_gas_station_count = #{fGasStationCount}</if>
            <if test="fFillingStationCount != null "> and f_filling_station_count = #{fFillingStationCount}</if>
            <if test="fSupplyStationCount != null "> and f_supply_station_count = #{fSupplyStationCount}</if>
            <if test="fPressureStationCount != null "> and f_pressure_station_count = #{fPressureStationCount}</if>
            <if test="fOtherStationCount != null "> and f_other_station_count = #{fOtherStationCount}</if>
            <if test="fCreateTime != null "> and f_create_time = #{fCreateTime}</if>
            <if test="fUpdateTime != null "> and f_update_time = #{fUpdateTime}</if>
            <if test="isReport != null "> and is_report = #{isReport}</if>
            <if test="fYear != null "> and f_year = #{fYear}</if>
        </where>
    </select>

    <select id="selectTStaEnterpriseInforById" parameterType="Long" resultMap="TStaEnterpriseInforResult">
        <include refid="selectTStaEnterpriseInforVo"/>
        where f_enterprise_id = #{fEnterpriseId}
    </select>

    <insert id="insertTStaEnterpriseInfor" parameterType="com.zehong.system.domain.TStaEnterpriseInfor" useGeneratedKeys="true" keyProperty="fEnterpriseId">
        insert into t_sta_enterprise_infor
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fCityName != null and fCityName != ''">f_city_name,</if>
            <if test="fDistrictName != null and fDistrictName != ''">f_district_name,</if>
            <if test="fBizCode != null and fBizCode != ''">f_biz_code,</if>
            <if test="fCompanyName != null and fCompanyName != ''">f_company_name,</if>
            <if test="fPipelineCertCode != null">f_pipeline_cert_code,</if>
            <if test="fPipelineComp != null">f_pipeline_comp,</if>
            <if test="fStationCertCode != null">f_station_cert_code,</if>
            <if test="fStationComp != null">f_station_comp,</if>
            <if test="fOtherCertCode != null">f_other_cert_code,</if>
            <if test="fOtherComp != null">f_other_comp,</if>
            <if test="fResponsibleCount != null">f_responsible_count,</if>
            <if test="fManagementCount != null">f_management_count,</if>
            <if test="fMaintenanceCount != null">f_maintenance_count,</if>
            <if test="fResponsibleCertCount != null">f_responsible_cert_count,</if>
            <if test="fManagementCertCount != null">f_management_cert_count,</if>
            <if test="fMaintenanceCertCount != null">f_maintenance_cert_count,</if>
            <if test="fStationCount != null">f_station_count,</if>
            <if test="fStorageStationCount != null">f_storage_station_count,</if>
            <if test="fGasificationStationCount != null">f_gasification_station_count,</if>
            <if test="fMixingStationCount != null">f_mixing_station_count,</if>
            <if test="fGasStationCount != null">f_gas_station_count,</if>
            <if test="fFillingStationCount != null">f_filling_station_count,</if>
            <if test="fSupplyStationCount != null">f_supply_station_count,</if>
            <if test="fPressureStationCount != null">f_pressure_station_count,</if>
            <if test="fOtherStationCount != null">f_other_station_count,</if>
            <if test="fCreateTime != null">f_create_time,</if>
            <if test="fUpdateTime != null">f_update_time,</if>
            <if test="isReport != null">is_report,</if>
            <if test="fYear != null">f_year,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fCityName != null and fCityName != ''">#{fCityName},</if>
            <if test="fDistrictName != null and fDistrictName != ''">#{fDistrictName},</if>
            <if test="fBizCode != null and fBizCode != ''">#{fBizCode},</if>
            <if test="fCompanyName != null and fCompanyName != ''">#{fCompanyName},</if>
            <if test="fPipelineCertCode != null">#{fPipelineCertCode},</if>
            <if test="fPipelineComp != null">#{fPipelineComp},</if>
            <if test="fStationCertCode != null">#{fStationCertCode},</if>
            <if test="fStationComp != null">#{fStationComp},</if>
            <if test="fOtherCertCode != null">#{fOtherCertCode},</if>
            <if test="fOtherComp != null">#{fOtherComp},</if>
            <if test="fResponsibleCount != null">#{fResponsibleCount},</if>
            <if test="fManagementCount != null">#{fManagementCount},</if>
            <if test="fMaintenanceCount != null">#{fMaintenanceCount},</if>
            <if test="fResponsibleCertCount != null">#{fResponsibleCertCount},</if>
            <if test="fManagementCertCount != null">#{fManagementCertCount},</if>
            <if test="fMaintenanceCertCount != null">#{fMaintenanceCertCount},</if>
            <if test="fStationCount != null">#{fStationCount},</if>
            <if test="fStorageStationCount != null">#{fStorageStationCount},</if>
            <if test="fGasificationStationCount != null">#{fGasificationStationCount},</if>
            <if test="fMixingStationCount != null">#{fMixingStationCount},</if>
            <if test="fGasStationCount != null">#{fGasStationCount},</if>
            <if test="fFillingStationCount != null">#{fFillingStationCount},</if>
            <if test="fSupplyStationCount != null">#{fSupplyStationCount},</if>
            <if test="fPressureStationCount != null">#{fPressureStationCount},</if>
            <if test="fOtherStationCount != null">#{fOtherStationCount},</if>
            <if test="fCreateTime != null">#{fCreateTime},</if>
            <if test="fUpdateTime != null">#{fUpdateTime},</if>
            <if test="isReport != null">#{isReport},</if>
            <if test="fYear != null">#{fYear},</if>
        </trim>
    </insert>

    <update id="updateTStaEnterpriseInfor" parameterType="com.zehong.system.domain.TStaEnterpriseInfor">
        update t_sta_enterprise_infor
        <trim prefix="SET" suffixOverrides=",">
            <if test="fCityName != null and fCityName != ''">f_city_name = #{fCityName},</if>
            <if test="fDistrictName != null and fDistrictName != ''">f_district_name = #{fDistrictName},</if>
            <if test="fBizCode != null and fBizCode != ''">f_biz_code = #{fBizCode},</if>
            <if test="fCompanyName != null and fCompanyName != ''">f_company_name = #{fCompanyName},</if>
            <if test="fPipelineCertCode != null">f_pipeline_cert_code = #{fPipelineCertCode},</if>
            <if test="fPipelineComp != null">f_pipeline_comp = #{fPipelineComp},</if>
            <if test="fStationCertCode != null">f_station_cert_code = #{fStationCertCode},</if>
            <if test="fStationComp != null">f_station_comp = #{fStationComp},</if>
            <if test="fOtherCertCode != null">f_other_cert_code = #{fOtherCertCode},</if>
            <if test="fOtherComp != null">f_other_comp = #{fOtherComp},</if>
            <if test="fResponsibleCount != null">f_responsible_count = #{fResponsibleCount},</if>
            <if test="fManagementCount != null">f_management_count = #{fManagementCount},</if>
            <if test="fMaintenanceCount != null">f_maintenance_count = #{fMaintenanceCount},</if>
            <if test="fResponsibleCertCount != null">f_responsible_cert_count = #{fResponsibleCertCount},</if>
            <if test="fManagementCertCount != null">f_management_cert_count = #{fManagementCertCount},</if>
            <if test="fMaintenanceCertCount != null">f_maintenance_cert_count = #{fMaintenanceCertCount},</if>
            <if test="fStationCount != null">f_station_count = #{fStationCount},</if>
            <if test="fStorageStationCount != null">f_storage_station_count = #{fStorageStationCount},</if>
            <if test="fGasificationStationCount != null">f_gasification_station_count = #{fGasificationStationCount},</if>
            <if test="fMixingStationCount != null">f_mixing_station_count = #{fMixingStationCount},</if>
            <if test="fGasStationCount != null">f_gas_station_count = #{fGasStationCount},</if>
            <if test="fFillingStationCount != null">f_filling_station_count = #{fFillingStationCount},</if>
            <if test="fSupplyStationCount != null">f_supply_station_count = #{fSupplyStationCount},</if>
            <if test="fPressureStationCount != null">f_pressure_station_count = #{fPressureStationCount},</if>
            <if test="fOtherStationCount != null">f_other_station_count = #{fOtherStationCount},</if>
            <if test="fCreateTime != null">f_create_time = #{fCreateTime},</if>
            <if test="fUpdateTime != null">f_update_time = #{fUpdateTime},</if>
            <if test="isReport != null">is_report = #{isReport},</if>
            <if test="fYear != null">f_year = #{fYear},</if>
        </trim>
        where f_enterprise_id = #{fEnterpriseId}
    </update>

    <delete id="deleteTStaEnterpriseInforById" parameterType="Long">
        delete from t_sta_enterprise_infor where f_enterprise_id = #{fEnterpriseId}
    </delete>

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