<?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.energyinfo.EnergyInfoDataMapper">

    <select id="getConfigureAllInfo" resultType="com.nantian.cloud.dbcapp.vo.ConfigureGaugeVo">
        select id, enterpriseCode, left(replace(`nextAlignDate`,' ',''),10) nextAlignDate, alignOrg, unAlignReason, location, installer, left(replace(`installTime`,' ',''),10) installTime, linkSys, currentState, left(replace(`stateChangeTime`,' ',''),10) stateChangeTime, serNo, barCode,
        meterName, meterType, meterLevel meterLevelOld, params, dataCode, reportArithmetic, reportRatio, manufacturer, model, precisionLevel, ranges, manageNo, alignState, alignCycle, LastAlignDate, state, remark, paramsType, uploadedCountry, digest, quoted, updateSay, deleteSay,
        case when meterLevel = '4' then '12'  when meterLevel = '5' then '13'  when meterLevel = '6' then '23'  when meterLevel = '7' then '123' else meterLevel end meterLevel
        from ynenergy_configure.configure_gauge where 1=1
        <foreach collection="list" open="and enterpriseCode not in (" separator="," close=")" item="item">
             #{item}
        </foreach>
    </select>

    <select id="getCalculaterAllInfo" resultType="com.nantian.cloud.dbcapp.vo.CompanyCalculaterVo">
        select id, enterpriseCode, calculaterName, phone, dept, job, technicalPost, certificate, certificateName, certificateNo, remark, state, digest, certificateIndex
        from ynenergy_info.company_calculater where 1=1
        <foreach collection="list" open="and enterpriseCode not in (" separator="," close=")" item="item">
             #{item}
        </foreach>
    </select>

    <select id="getConfigureById" resultType="com.nantian.cloud.dbcapp.vo.ConfigureGaugeVo">
        select id, enterpriseCode, left(replace(`nextAlignDate`,' ',''),10) nextAlignDate, alignOrg, unAlignReason, location, installer, left(replace(`installTime`,' ',''),10) installTime, linkSys, currentState, left(replace(`stateChangeTime`,' ',''),10) stateChangeTime, serNo, barCode,
        meterName, meterType, meterLevel, params, dataCode, reportArithmetic, reportRatio, manufacturer, model, precisionLevel, ranges, manageNo, alignState, alignCycle, LastAlignDate, state, remark, paramsType, uploadedCountry, digest, id as quoted, updateSay, deleteSay
        from ynenergy_configure.configure_gauge where 1=1
        <foreach collection="list" open="and id not in (" separator="," close=")" item="item">
            #{item}
        </foreach>
    </select>

    <select id="getCalculaterById" resultType="com.nantian.cloud.dbcapp.vo.CompanyCalculaterVo">
        select id, enterpriseCode, calculaterName, phone, dept, job, technicalPost, certificate, certificateName, certificateNo, remark, state, digest, certificateIndex, id as quoted
        from ynenergy_info.company_calculater where 1=1
        <foreach collection="list" open="and id not in (" separator="," close=")" item="item">
            #{item}
        </foreach>
    </select>

    <select id="getDeviceById" resultType="com.nantian.cloud.dbcapp.vo.ConfigureDeviceVo">
        select id, enterpriseCode, deviceName, deviceNo, model, location, dept, deviceType, left(replace(`usingDate`,' ',''),10) usingDate, currentState, manufacturer, energyCode, energyValue, processUnitCode, state, remark, id as quoted, digest
        from ynenergy_configure.configure_device where 1=1
        <foreach collection="list" open="and id not in (" separator="," close=")" item="item">
            #{item}
        </foreach>
    </select>

    <select id="getProductList" resultType="com.nantian.cloud.dbcapp.entity.CompanyMaterielProduct">
        SELECT * FROM ynenergy_info.company_materiel_product
    </select>

</mapper>
