cjl
2024-08-09 a022ae9804d0c2f402711b6b5202319d853919cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?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.moral.api.mapper.SecondCruiserSortMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.moral.api.entity.SecondCruiserSort">
        <result column="road" property="road"/>
        <result column="time" property="time"/>
        <result column="value" property="value"/>
        <result column="mac" property="mac"/>
        <result column="organization_id" property="organizationId"/>
    </resultMap>
 
    <select id="getSort" resultType="com.moral.api.entity.SecondCruiserSort">
        select road,avg(value) as "avg",time,mac from second_cruiser_sort
        where mac =#{mac} and time BETWEEN #{startTime} and #{endTime} GROUP BY road ORDER BY avg DESC
 
    </select>
 
</mapper>