yangys
2024-09-04 04c57331cf84c8f606c2838dcb6fe5463fb9b68c
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
<?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.qianwen.smartman.modules.andon.mapper.AndonRecordMapper">
 
 
    <select id="queryCard" resultType="com.qianwen.smartman.modules.andon.vo.AndonStatisticalCardVO">
        select SUM(IF(cur_status = 3, unix_timestamp(end_time), unix_timestamp(NOW())) -
        unix_timestamp(call_time)) as callTimeTotal,
        count(*)                       as callCountTotal,
        SUM(IF(response_time is not null, unix_timestamp(response_time) - unix_timestamp(call_time),
        0))                     as avgResponseTimeTotal
        from blade_andon_record
        where is_deleted = 0 and call_time between #{startTime} and #{endTime}
          and workstation_id in
        <foreach collection="workstations" item="workstationId" open="(" separator="," close=")">
            #{workstationId}
        </foreach>
    </select>
 
    <select id="getTableAndon" resultType="com.qianwen.smartman.modules.andon.vo.AndonTableStatisticalVO">
        select type_code                      as typeCode,
               type_name                      as typeName,
               SUM(IF(cur_status = 3, unix_timestamp(end_time), unix_timestamp(NOW())) -
                   unix_timestamp(call_time)) as callTimeTotal,
               count(*)                       as callTimeCount,
               SUM(IF(response_time is not null, unix_timestamp(response_time) - unix_timestamp(call_time),
                      0))                     as responseTimeTotal
        from blade_andon_record
        where is_deleted = 0
          and call_time between #{startTime} and #{endTime}
          and workstation_id in
        <foreach collection="workstationIds" item="workstationId" open="(" separator="," close=")">
            #{workstationId}
        </foreach>
        group by type_code, type_name
        order by type_code;
    </select>
</mapper>