yangys
2024-09-27 26f8e5990686bdba2119024a260d986266506757
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
<?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.mdc.collect.mapper.iotdb.AggregateStateWithFeedbackMapper">
 
    <resultMap id="BaseResultMap" type="com.qianwen.mdc.collect.entity.iotdb.AggregateStateWithFeedback">
        <result column="workstation_id" jdbcType="BIGINT" property="workstationId"/>
        <result column="end_time" jdbcType="BIGINT" property="endTime"/>
        <result column="duration_collect" jdbcType="BIGINT" property="durationCollect"/>
        
        <result column="value_collect" jdbcType="INTEGER" property="valueCollect"/>
        
        <result column="calendar_code" jdbcType="VARCHAR" property="calendarCode"/>
        
        <result column="factory_year" jdbcType="INTEGER" property="factoryYear"/>
        <result column="factory_month" jdbcType="INTEGER" property="factoryMonth"/>
        <result column="factory_week" jdbcType="INTEGER" property="factoryWeek"/>
        <result column="factory_date" jdbcType="INTEGER" property="factoryDate"/>
        <result column="shift_index" jdbcType="INTEGER" property="shiftIndex"/>
        <result column="shift_time_type" jdbcType="INTEGER" property="shiftTimeType"/>
        <result column="wcs" jdbcType="INTEGER" property="wcs"/>
        <result column="rps" jdbcType="INTEGER" property="rps"/>
        <result column="feedback_id" jdbcType="BIGINT" property="feedbackId"/>
        <result column="is_deleted" jdbcType="BOOLEAN" property="isDeleted"/>
        <result column="is_plan" jdbcType="BIGINT" property="isPlan"/>
        
    </resultMap>
    
    <sql id="all_columns">
    workstation_id,end_time,duration_collect,value_collect,calendar_code,factory_year,factory_month,factory_date,factory_week,shift_index,shift_time_type,wcs,rps,is_fix_point,is_sync,is_plan,feedback_point_type,feedback_id,is_deleted
    </sql>
      <!-- 
       WorkstationAggregateStateWithFeedback match = stateWithFeedbackMapper.selectOne(Wrappers.<WorkstationAggregateStateWithFeedback>lambdaQuery()
                  .eq(WorkstationAggregateStateWithFeedback::getWorkstationId, feedback.getWorkstationId())
                  .eq(WorkstationAggregateStateWithFeedback::getTs, endState.getTs())
                  .eq(WorkstationAggregateStateWithFeedback::getEndTime, Long.valueOf(endState.getTs().longValue() + 1L)));
       -->
     <select id="workstationStateByTimeAndEndTime" resultMap="BaseResultMap">
        select <include refid="all_columns" /> FROM root.f2.aggregate_state_with_feedback_${workstationId}
        <where>
            is_deleted=false
            <if test="timeRange.startTime != null">
                AND time &gt;= #{timeRange.startTime}
            </if>
             AND time &lt;= #{timeRange.endTime}
        </where>
        
        order by time asc
          align by device
    </select>
    
    
</mapper>