<?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.dmpLog.mapper.DmpLogSignalMapper">
|
<!--新增-->
|
<insert id="save" parameterType="com.qianwen.smartman.modules.dmpLog.entity.SignalLog">
|
insert into iot_data.dmp_log_signal_${MachineCode}_${collectMonth}
|
USING iot_data.super_dmp_log_signal TAGS (${MachineCode},${collectMonth})
|
(ts, trace_id, type, machine_name, affected_variable, variable_value,
|
status)
|
values (#{TimeStamp}, #{TraceId}, #{type}, #{MachineName}, #{AffectedVariable},
|
#{VariableValue}, #{status})
|
</insert>
|
<!--创建子表-->
|
<update id="createTable">
|
create table if not exists iot_data.dmp_log_signal_${machineCode}_${collectMonth} using iot_data.super_dmp_log_signal TAGS
|
(
|
${machineCode},${collectMonth}
|
)
|
|
</update>
|
|
<select id="pageDmpLog" resultType="com.qianwen.smartman.modules.dmpLog.vo.DmpLogVo">
|
select * from iot_data.super_dmp_log_signal
|
<where>
|
<if test="param.machineCode != null and param.machineCode != ''">
|
AND machine_code = #{param.machineCode}
|
</if>
|
<if test="param.affectedVariable != null and param.affectedVariable != ''">
|
AND affected_variable = #{param.affectedVariable}
|
</if>
|
<if test="param.variableValue != null and param.variableValue != ''">
|
AND variable_value = #{param.variableValue}
|
</if>
|
<if test="param.startTime != null and param.endTime != ''">
|
AND ts BETWEEN #{param.startTime} AND #{param.endTime}
|
</if>
|
</where>
|
order by ts desc
|
limit #{start}, #{end}
|
</select>
|
|
<select id="countDmpLog" resultType="java.lang.Integer">
|
select count(*)
|
from iot_data.super_dmp_log_signal
|
<where>
|
<if test="param.machineCode != null and param.machineCode != ''">
|
AND machine_code = #{param.machineCode}
|
</if>
|
<if test="param.affectedVariable != null and param.affectedVariable != ''">
|
AND affected_variable = #{param.affectedVariable}
|
</if>
|
<if test="param.variableValue != null and param.variableValue != ''">
|
AND variable_value = #{param.variableValue}
|
</if>
|
<if test="param.startTime != null and param.endTime != ''">
|
AND ts BETWEEN #{param.startTime} AND #{param.endTime}
|
</if>
|
</where>
|
</select>
|
|
<select id="getTableNamesByMonth" parameterType="int" resultType="string">
|
select tbname
|
from super_dmp_log_signal
|
where collect_month <= #{rangeParam}
|
union all
|
select tbname
|
from super_dmp_log_signal_flow
|
where collect_month <= #{rangeParam}
|
union all
|
select tbname
|
from super_dmp_log_method_time
|
where collect_month <= #{rangeParam}
|
</select>
|
</mapper>
|