yangys
2024-09-03 52ff3bda72646a532c3297e4843bc4d5aee8b949
collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/DeviceStateMapper.xml
@@ -5,7 +5,6 @@
   <resultMap id="BaseResultMap" type="com.qianwen.mdc.collect.entity.iotdb.DeviceState">
       <result column="workstation_id" jdbcType="BIGINT" property="workstationId"/>
        <result column="value_collect" jdbcType="BIGINT" property="valueCollect"/>
        <result column="param_type" jdbcType="INTEGER" property="paramType"/>
        <result column="calendar_code" jdbcType="VARCHAR" property="calendarCode"/>
        <result column="factory_year" jdbcType="INTEGER" property="factoryYear"/>
        <result column="factory_month" jdbcType="INTEGER" property="factoryMonth"/>
@@ -14,10 +13,11 @@
        <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="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="BIGINT" property="isPlan"/>
        <result column="employee_id" jdbcType="BIGINT" property="employeeId"/>
    </resultMap>
   <!-- 
@@ -80,9 +80,9 @@
        where is_sync=false and is_fix_point=false and feedback_point_type=0 and is_deleted=false
        order by time asc limit 1
    </select>
    <!--  -->
     <select id="statesInTimeRange" resultMap="BaseResultMap">
        select <include refid="all_columns" /> FROM root.f2.aggregate_state_${workstationId}
        select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
        <where>
           is_deleted=false
           <if test="timeRange.startTime != null">
@@ -92,8 +92,23 @@
       </where>
        
        order by time asc
          align by device
    </select>
    
     <!-- 只能用as 和resultType的形式??? resultType="com.qianwen.mdc.collect.entity.iotdb.DeviceState"
     <select id="statesInTimeRange" resultMap="BaseResultMap">
        select <include refid="all_columns" /> FROM root.f2.state_${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>-->
    <select id="fixPointCountByDate" resultType="Long">
        select count(factory_date) FROM root.f2.state_* where factory_date=#{factoryDate} and is_fix_point=true
    </select>