cjl
2024-04-23 ee8bb47024e9ef5a585a5f4d61d1ab236c9d4341
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?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.HistoryMonthlyMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.moral.api.entity.HistoryMonthly">
        <result column="mac" property="mac"/>
        <result column="time" property="time"/>
        <result column="value" property="value"/>
    </resultMap>
 
    <select id="listAll" resultType="com.moral.api.pojo.vo.historyMonthly.HistoryResultVo">
        select  DATE_FORMAT(time,'%Y-%m') time,${type}
        from history_monthly
        where date(time) <![CDATA[>=]]> #{startTime}
        and date(time) <![CDATA[<=]]> #{endTime}
        and mac in
        <foreach collection="macs" item="id" index="index" open="(" close=")" separator=",">
            #{id}
        </foreach>
        group by time
        order by time
    </select>
 
 
 
</mapper>