<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.epp.access.dao.ReportDao">
    <insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Report">
        INSERT INTO report (`user_id`, `name`, `address`, `time`, `temperature`)
        VALUES (#{userId}, #{name}, #{address}, #{time}, #{temperature})
    </insert>
    <select id="getReportListByUserId" parameterType="java.lang.Integer" resultType="com.cxyxiaomo.epp.common.pojo.Report">
        SELECT * FROM report
        WHERE `user_id` = #{userId}
        order by time desc
    </select>
    <select id="getLatestReportByUserId" parameterType="java.lang.Integer" resultType="com.cxyxiaomo.epp.common.pojo.Report">
        SELECT * FROM report
        WHERE `user_id` = #{userId}
        order by time desc
        LIMIT 1
    </select>
</mapper>
