<?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.nantian.cloud.dbcapp.mapper.record.ConfigureDataCollectGenerateMapper">

    <resultMap id="BaseResultMap" type="com.nantian.cloud.dbcapp.entity.ConfigureDataCollectGenerate">
        <id column="id" property="id"/>
        <result column="enterprise_code" property="enterpriseCode"/>
        <result column="data_code" property="dataCode"/>
        <result column="collect_item_name" property="collectItemName"/>
        <result column="process_code" property="processCode"/>
        <result column="process_name" property="processName"/>
        <result column="process_unit_code" property="processUnitCode"/>
        <result column="process_unit_name" property="processUnitName"/>
        <result column="equipment_unit_code" property="equipmentUnitCode"/>
        <result column="equipment_name" property="equipmentName"/>
        <result column="energy_class_code" property="energyClassCode"/>
        <result column="energy_type_code" property="energyTypeCode"/>
        <result column="data_usage_code" property="dataUsageCode"/>
        <result column="input_type" property="inputType"/>
        <result column="data_value_max" property="dataValueMax"/>
        <result column="data_value_min" property="dataValueMin"/>
        <result column="data_value_avg" property="dataValueAvg"/>
        <result column="convert_ration_max" property="convertRationMax"/>
        <result column="convert_ration_min" property="convertRationMin"/>
        <result column="convert_ration_avg" property="convertRationAvg"/>
        <result column="stat_type" property="statType"/>
        <result column="scope" property="scope"/>
        <result column="uploaded_country" property="uploadedCountry"/>
        <result column="digest" property="digest"/>
        <result column="is_calculate" property="isCalculate"/>
        <result column="gmt_create" property="gmtCreate"/>
        <result column="gmt_modified" property="gmtModified"/>
        <result column="unit" property="unit"/>
        <result column="memorandum_id" property="memorandumId"/>
        <result column="memorandum_date" property="memorandumDate"/>
        <result column="memorandum_status" property="memorandumStatus"/>
        <result column="experience_value" property="experienceValue"/>
    </resultMap>

    <sql id="Base_Column_List">
        id
        ,enterprise_code AS enterpriseCode,data_code AS dataCode,collect_item_name AS collectItemName,process_code AS processCode,process_name AS processName,process_unit_code AS processUnitCode,process_unit_name AS processUnitName,
equipment_unit_code AS equipmentUnitCode,equipment_name AS equipmentName,energy_class_code AS energyClassCode,energy_type_code AS energyTypeCode,data_usage_code AS dataUsageCode,input_type AS inputType,data_value_max AS dataValueMax,data_value_min AS dataValueMin,
data_value_avg AS dataValueAvg,convert_ration_max AS convertRationMax,convert_ration_min AS convertRationMin,convert_ration_avg AS convertRationAvg,stat_type AS statType,scope,remark,uploaded_country AS uploadedCountry,digest,is_calculate AS isCalculate,gmt_create AS gmtCreate,gmt_modified AS gmtModified,unit,memorandum_id AS memorandumId,memorandum_date AS memorandumDate,memorandum_status AS memorandumStatus,experience_value AS experienceValue, data_code_old AS dataCodeOld
    </sql>

    <select id="getGenerateList" resultType="java.util.Map">
        SELECT <include refid="Base_Column_List"></include>
        FROM configure_data_collect_generate WHERE enterprise_code = #{epc} AND memorandum_id is null ORDER BY data_code ASC
    </select>

    <select id="getDigestList" resultType="java.lang.String">
        SELECT digest
        FROM configure_data_collect_generate
        WHERE memorandum_id is null
        <if test="epc != null">
            and enterprise_code = #{epc}
        </if>
    </select>

    <select id="getIdList" resultType="java.lang.Long">
        SELECT id
        FROM configure_data_collect_generate
        WHERE memorandum_id is null
        <if test="epc != null">
            and enterprise_code = #{epc}
        </if>
    </select>

</mapper>
