<?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.unis.statisticalReport.info.modular.grainTempCheck.mapper.GrainTempMapper">
    <select id="getPage" parameterType="string" resultType="com.unis.statisticalReport.info.modular.grainTempCheck.entity.GrainTemp">
        SELECT
            id,
            org_name orgName,
            storehouse_name storehouseName,
            in_temp inTemp,
            temp_max tempMax,
            temp_min tempMin,
            temp_avg tempAvg,
            compare_last_temp_avg compareLastTempAvg,
            gather_time gatherTime
        FROM
            depot_qh.t_lq_data
        <where>
            iLq_yq = '0'
            <if test="storehouseName != null and storehouseName != ''">
                AND storehouse_name LIKE concat("%",#{storehouseName},"%")
            </if>
        </where>
    </select>
    <select id="exportExcel" parameterType="string" resultType="com.unis.statisticalReport.info.modular.grainTempCheck.entity.GrainTempExcel">
        SELECT
            id,
            org_name orgName,
            storehouse_name storehouseName,
            in_temp inTemp,
            temp_max tempMax,
            temp_min tempMin,
            temp_avg tempAvg,
            CASE
        WHEN compare_last_temp_avg = 1 THEN
            '-'
        WHEN compare_last_temp_avg = 2 THEN
            '上升↑'
        WHEN compare_last_temp_avg = 3 THEN
            '下降↓'
        END AS compareLastTempAvgName,
         gather_time gatherTime
        FROM
            depot_qh.t_lq_data
        WHERE
            iLq_yq = '0'
        AND gather_time BETWEEN #{startDate} AND #{endDate}
    </select>

</mapper>