<?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="cn.cecep.talroad.mapper.OdsAirRegionHourIMapper">

    <resultMap type="cn.cecep.talroad.domain.OdsAirRegionHourI" id="OdsAirRegionHourIResult">
        <result property="id"    column="id"    />
        <result property="datatime"    column="datatime"    />
        <result property="uploadtime"    column="uploadtime"    />
        <result property="value2473"    column="value_2473"    />
        <result property="value2481"    column="value_2481"    />
        <result property="value2483"    column="value_2483"    />
        <result property="value2484"    column="value_2484"    />
        <result property="value4402"    column="value_4402"    />
        <result property="value4404"    column="value_4404"    />
        <result property="value4405"    column="value_4405"    />
        <result property="value4406"    column="value_4406"    />
        <result property="value4407"    column="value_4407"    />
        <result property="value4467"    column="value_4467"    />
        <result property="value4468"    column="value_4468"    />
        <result property="value4471"    column="value_4471"    />
        <result property="value4d71"    column="value_4D71"    />
        <result property="value4472"    column="value_4472"    />
        <result property="value4474"    column="value_4474"    />
        <result property="value4482"    column="value_4482"    />
        <result property="value4485"    column="value_4485"    />
        <result property="value4486"    column="value_4486"    />
        <result property="value4487"    column="value_4487"    />
        <result property="value4488"    column="value_4488"    />
        <result property="value4489"    column="value_4489"    />
        <result property="value448a"    column="value_448A"    />
        <result property="value448b"    column="value_448B"    />
        <result property="status2473"    column="status_2473"    />
        <result property="status2481"    column="status_2481"    />
        <result property="status2483"    column="status_2483"    />
        <result property="status2484"    column="status_2484"    />
        <result property="status4402"    column="status_4402"    />
        <result property="status4404"    column="status_4404"    />
        <result property="status4405"    column="status_4405"    />
        <result property="status4406"    column="status_4406"    />
        <result property="status4407"    column="status_4407"    />
        <result property="status4467"    column="status_4467"    />
        <result property="status4468"    column="status_4468"    />
        <result property="status4471"    column="status_4471"    />
        <result property="status4d71"    column="status_4D71"    />
        <result property="status4472"    column="status_4472"    />
        <result property="status4474"    column="status_4474"    />
        <result property="status4482"    column="status_4482"    />
        <result property="status4485"    column="status_4485"    />
        <result property="status4486"    column="status_4486"    />
        <result property="status4487"    column="status_4487"    />
        <result property="status4488"    column="status_4488"    />
        <result property="status4489"    column="status_4489"    />
        <result property="status448a"    column="status_448A"    />
        <result property="status448b"    column="status_448B"    />
        <result property="code"    column="code"    />
        <result property="name"    column="name"    />
        <result property="cityname"    column="cityname"    />
        <result property="provincename"    column="provincename"    />
    </resultMap>


    <sql id="selectOdsAirRegionHourIVo">
        select id, datatime, uploadtime, value_2473, value_2481, value_2483, value_2484, value_4402, value_4404, value_4405, value_4406, value_4407, value_4467, value_4468, value_4471, value_4D71, value_4472, value_4474, value_4482, value_4485, value_4486, value_4487, value_4488, value_4489, value_448A, value_448B, status_2473, status_2481, status_2483, status_2484, status_4402, status_4404, status_4405, status_4406, status_4407, status_4467, status_4468, status_4471, status_4D71, status_4472, status_4474, status_4482, status_4485, status_4486, status_4487, status_4488, status_4489, status_448A, status_448B, code, "name", cityname, provincename from ods_air_region_hour_i
    </sql>

    <select id="selectOdsAirRegionHourIList" parameterType="cn.cecep.talroad.domain.OdsAirRegionHourI" resultMap="OdsAirRegionHourIResult">
        <include refid="selectOdsAirRegionHourIVo"/>
        <where>
            <if test="datatime != null  and datatime != ''"> and datatime = #{datatime}</if>
            <if test="uploadtime != null  and uploadtime != ''"> and uploadtime = #{uploadtime}</if>
            <if test="value2473 != null  and value2473 != ''"> and value_2473 = #{value2473}</if>
            <if test="value2481 != null  and value2481 != ''"> and value_2481 = #{value2481}</if>
            <if test="value2483 != null  and value2483 != ''"> and value_2483 = #{value2483}</if>
            <if test="value2484 != null  and value2484 != ''"> and value_2484 = #{value2484}</if>
            <if test="value4402 != null  and value4402 != ''"> and value_4402 = #{value4402}</if>
            <if test="value4404 != null  and value4404 != ''"> and value_4404 = #{value4404}</if>
            <if test="value4405 != null  and value4405 != ''"> and value_4405 = #{value4405}</if>
            <if test="value4406 != null  and value4406 != ''"> and value_4406 = #{value4406}</if>
            <if test="value4407 != null  and value4407 != ''"> and value_4407 = #{value4407}</if>
            <if test="value4467 != null  and value4467 != ''"> and value_4467 = #{value4467}</if>
            <if test="value4468 != null  and value4468 != ''"> and value_4468 = #{value4468}</if>
            <if test="value4471 != null  and value4471 != ''"> and value_4471 = #{value4471}</if>
            <if test="value4d71 != null  and value4d71 != ''"> and value_4D71 = #{value4d71}</if>
            <if test="value4472 != null  and value4472 != ''"> and value_4472 = #{value4472}</if>
            <if test="value4474 != null  and value4474 != ''"> and value_4474 = #{value4474}</if>
            <if test="value4482 != null  and value4482 != ''"> and value_4482 = #{value4482}</if>
            <if test="value4485 != null  and value4485 != ''"> and value_4485 = #{value4485}</if>
            <if test="value4486 != null  and value4486 != ''"> and value_4486 = #{value4486}</if>
            <if test="value4487 != null  and value4487 != ''"> and value_4487 = #{value4487}</if>
            <if test="value4488 != null  and value4488 != ''"> and value_4488 = #{value4488}</if>
            <if test="value4489 != null  and value4489 != ''"> and value_4489 = #{value4489}</if>
            <if test="value448a != null  and value448a != ''"> and value_448A = #{value448a}</if>
            <if test="value448b != null  and value448b != ''"> and value_448B = #{value448b}</if>
            <if test="status2473 != null  and status2473 != ''"> and status_2473 = #{status2473}</if>
            <if test="status2481 != null  and status2481 != ''"> and status_2481 = #{status2481}</if>
            <if test="status2483 != null  and status2483 != ''"> and status_2483 = #{status2483}</if>
            <if test="status2484 != null  and status2484 != ''"> and status_2484 = #{status2484}</if>
            <if test="status4402 != null  and status4402 != ''"> and status_4402 = #{status4402}</if>
            <if test="status4404 != null  and status4404 != ''"> and status_4404 = #{status4404}</if>
            <if test="status4405 != null  and status4405 != ''"> and status_4405 = #{status4405}</if>
            <if test="status4406 != null  and status4406 != ''"> and status_4406 = #{status4406}</if>
            <if test="status4407 != null  and status4407 != ''"> and status_4407 = #{status4407}</if>
            <if test="status4467 != null  and status4467 != ''"> and status_4467 = #{status4467}</if>
            <if test="status4468 != null  and status4468 != ''"> and status_4468 = #{status4468}</if>
            <if test="status4471 != null  and status4471 != ''"> and status_4471 = #{status4471}</if>
            <if test="status4d71 != null  and status4d71 != ''"> and status_4D71 = #{status4d71}</if>
            <if test="status4472 != null  and status4472 != ''"> and status_4472 = #{status4472}</if>
            <if test="status4474 != null  and status4474 != ''"> and status_4474 = #{status4474}</if>
            <if test="status4482 != null  and status4482 != ''"> and status_4482 = #{status4482}</if>
            <if test="status4485 != null  and status4485 != ''"> and status_4485 = #{status4485}</if>
            <if test="status4486 != null  and status4486 != ''"> and status_4486 = #{status4486}</if>
            <if test="status4487 != null  and status4487 != ''"> and status_4487 = #{status4487}</if>
            <if test="status4488 != null  and status4488 != ''"> and status_4488 = #{status4488}</if>
            <if test="status4489 != null  and status4489 != ''"> and status_4489 = #{status4489}</if>
            <if test="status448a != null  and status448a != ''"> and status_448A = #{status448a}</if>
            <if test="status448b != null  and status448b != ''"> and status_448B = #{status448b}</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="name != null  and name != ''"> and "name" like concat('%', #{name}, '%')</if>
            <if test="cityname != null  and cityname != ''"> and cityname like concat('%', #{cityname}, '%')</if>
            <if test="provincename != null  and provincename != ''"> and provincename like concat('%', #{provincename}, '%')</if>
        </where>
    </select>
    <select id="selectAvgTemp" resultType="java.math.BigDecimal">
        select
            round( AVG ( CAST ( value_2481 AS DECIMAL ) ), 2 ) AS value_2481
        from ods_air_region_hour_i
        where datatime = #{lastHour}

    </select>

</mapper>
