yangys
2025-11-18 8e944cfabb253fc2556588e308e282586043f7b0
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
<?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.mdc.mapper.StateMapper">
    <resultMap id="voResultMap" type="com.qianwen.smartman.modules.mdc.vo.StateVO">
        <result column="workstation_id" jdbcType="BIGINT" property="workstationId"/>
        <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="is_sync" jdbcType="BOOLEAN" property="isSync"/>
        <result column="feedback_id" jdbcType="BIGINT" property="feedbackId"/>
        <result column="is_deleted" jdbcType="BOOLEAN" property="isDeleted"/>
        <result column="is_plan" jdbcType="INTEGER" property="isPlan"/>
 
        <result column="feedback_point_type" jdbcType="INTEGER" property="feedbackPointType"/><!-- new -->
 
        <result column="employee_id" jdbcType="BIGINT" property="employeeId"/>
    </resultMap>
 
    <sql id="all_columns">
        workstation_id,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,employee_id
    </sql>
    <select id="lastStateNotEqValueLtTime" resultMap="voResultMap">
        select <include refid="all_columns" /> from root.f2.state_${workstationId} where is_fix_point=false and is_deleted=false and wcs &lt;&gt;#{value} and wcs &gt; 0 and time &lt; #{beforeTime} order by time desc limit 1 align by device
    </select>
 
    <select id="firstStateEqValueGtTime" resultMap="voResultMap">
        select <include refid="all_columns" /> from root.f2.state_${workstationId} where is_fix_point=false and is_deleted=false and wcs=#{value} and time &gt; #{time} order by time asc limit 1 align by device
    </select>
    <select id="firstStateEqValue" resultMap="voResultMap">
        select <include refid="all_columns" /> from root.f2.state_${workstationId} where is_fix_point=false and is_deleted=false and wcs=#{value} order by time asc limit 1 align by device
    </select>
</mapper>