Pu Zhibing
2025-03-28 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?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.stylefeng.guns.modular.system.dao.DriverOnlineMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.DriverOnline">
        <id column="id" property="id" />
        <result column="driverId" property="driverId" />
        <result column="date" property="date" />
        <result column="duration" property="duration" />
        <result column="assessment" property="assessment" />
    </resultMap>
 
 
    <select id="query" resultType="DriverOnline">
        select
        id as id,
        driverId as driverId,
        `date` as `date`,
        duration as duration,
        assessment as assessment
        from t_driver_online where driverId = #{driverId} and DATE_FORMAT(`date`, '%Y-%m-%d') = #{day} and type = #{type} and assessment = #{assessment}
    </select>
 
 
 
    <select id="querySumTime" resultType="int">
        select
        ifnull(sum(duration), 0) as duration
        from t_driver_online where 1 = 1
        <if test="null != driverId">
            and driverId = #{driverId}
        </if>
        <if test="null != assessment">
            and assessment = #{assessment}
        </if>
        <if test="null != start and null != end">
            and `date` between #{start} and #{end}
        </if>
    </select>
 
 
    <select id="queryList" resultType="DriverOnline">
        select
        id as id,
        driverId as driverId,
        `date` as `date`,
        duration as duration,
        assessment as assessment
        from t_driver_online where DATE_FORMAT(`date`, '%Y-%m-%d') = #{day}
        <if test="null != driverId">
            and driverId = #{driverId}
        </if>
        <if test="null != type">
            and type = #{type}
        </if>
        and duration &gt;= #{duration}
    </select>
</mapper>