<?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.thhy.materials.modules.biz.helmet.mapper.HelmetMapper">
|
<resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
This element was generated on Tue Oct 10 10:55:08 CST 2023.
|
-->
|
<id column="helmet_device_id" jdbcType="VARCHAR" property="helmetDeviceId" />
|
<result column="device_num" jdbcType="VARCHAR" property="deviceNum" />
|
<result column="user_id" jdbcType="INTEGER" property="userId" />
|
<result column="user_name" jdbcType="VARCHAR" property="userName" />
|
</resultMap>
|
|
|
<select id="helmetServiceList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
|
select helmet_device_id as helmetDeviceId,
|
device_num as deviceNum,
|
user_id as userId,
|
user_name as userName
|
from t_helmet_device
|
</select>
|
<select id="userIdIid" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
SELECT
|
i_id
|
FROM
|
t_helmet_picture
|
where user_id=#{userId}
|
ORDER BY
|
i_id DESC
|
LIMIT 0,1
|
</select>
|
<select id="userIdReport" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
SELECT
|
s_id
|
FROM
|
t_helmet_report
|
where user_id=#{userId}
|
ORDER BY
|
s_id DESC
|
LIMIT 0,1
|
</select>
|
<insert id="helmetPictureInsert" parameterType="com.thhy.materials.modules.biz.helmet.entity.THelmetPicture">
|
insert into t_helmet_picture
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="helmetPictureId != null">
|
helmet_picture_id,
|
</if>
|
<if test="imageUrl != null">
|
image_url,
|
</if>
|
<if test="userId != null">
|
user_id,
|
</if>
|
<if test="xPoint != null">
|
x_point,
|
</if>
|
<if test="yPoint != null">
|
y_point,
|
</if>
|
<if test="creTime != null">
|
cre_time,
|
</if>
|
<if test="iId != null">
|
i_id,
|
</if>
|
<if test="smTime != null">
|
sm_time,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="helmetPictureId != null">
|
#{helmetPictureId,jdbcType=INTEGER},
|
</if>
|
<if test="imageUrl != null">
|
#{imageUrl,jdbcType=VARCHAR},
|
</if>
|
<if test="userId != null">
|
#{userId,jdbcType=INTEGER},
|
</if>
|
<if test="xPoint != null">
|
#{xPoint,jdbcType=VARCHAR},
|
</if>
|
<if test="yPoint != null">
|
#{yPoint,jdbcType=VARCHAR},
|
</if>
|
<if test="creTime != null">
|
#{creTime,jdbcType=VARCHAR},
|
</if>
|
<if test="iId != null">
|
#{iId,jdbcType=INTEGER},
|
</if>
|
<if test="smTime != null">
|
#{smTime},
|
</if>
|
</trim>
|
</insert>
|
<insert id="helmetReportInsert" >
|
insert into t_helmet_report
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="reportId != null">
|
report_id,
|
</if>
|
<if test="sId != null">
|
s_id,
|
</if>
|
<if test="userId != null">
|
user_id,
|
</if>
|
<if test="userName != null">
|
user_name,
|
</if>
|
<if test="deviceId != null">
|
device_id,
|
</if>
|
<if test="xPoint != null">
|
x_point,
|
</if>
|
<if test="yPoint != null">
|
y_point,
|
</if>
|
<if test="cTime != null">
|
c_time,
|
</if>
|
<if test="sosType != null">
|
sos_type,
|
</if>
|
<if test="msg != null">
|
msg,
|
</if>
|
<if test="imgurl != null">
|
imgurl,
|
</if>
|
<if test="mobile != null">
|
mobile,
|
</if>
|
<if test="smTime != null">
|
sm_time,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="reportId != null">
|
#{reportId,jdbcType=INTEGER},
|
</if>
|
<if test="sId != null">
|
#{sId,jdbcType=INTEGER},
|
</if>
|
<if test="userId != null">
|
#{userId,jdbcType=INTEGER},
|
</if>
|
<if test="userName != null">
|
#{userName,jdbcType=VARCHAR},
|
</if>
|
<if test="deviceId != null">
|
#{deviceId,jdbcType=VARCHAR},
|
</if>
|
<if test="xPoint != null">
|
#{xPoint,jdbcType=VARCHAR},
|
</if>
|
<if test="yPoint != null">
|
#{yPoint,jdbcType=VARCHAR},
|
</if>
|
<if test="cTime != null">
|
#{cTime,jdbcType=VARCHAR},
|
</if>
|
<if test="sosType != null">
|
#{sosType,jdbcType=VARCHAR},
|
</if>
|
<if test="msg != null">
|
#{msg,jdbcType=VARCHAR},
|
</if>
|
<if test="imgurl != null">
|
#{imgurl,jdbcType=VARCHAR},
|
</if>
|
<if test="mobile != null">
|
#{mobile,jdbcType=VARCHAR},
|
</if>
|
<if test="smTime != null">
|
#{smTime,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<select id="trajectory" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetTrajectory">
|
SELECT
|
trajectory_id AS trajectoryId,
|
ctime,
|
ltime,
|
sec,
|
user_id AS userId
|
FROM
|
t_helmet_trajectory
|
WHERE
|
ctime = #{ctime} and user_id=#{userId}
|
</select>
|
<insert id="helmetTrajectoryInsert" >
|
insert into t_helmet_trajectory
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="trajectoryId != null">
|
trajectory_id,
|
</if>
|
<if test="ctime != null">
|
ctime,
|
</if>
|
<if test="ltime != null">
|
ltime,
|
</if>
|
<if test="sec != null">
|
sec,
|
</if>
|
<if test="userId != null">
|
user_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="trajectoryId != null">
|
#{trajectoryId,jdbcType=INTEGER},
|
</if>
|
<if test="ctime != null">
|
#{ctime,jdbcType=VARCHAR},
|
</if>
|
<if test="ltime != null">
|
#{ltime,jdbcType=VARCHAR},
|
</if>
|
<if test="sec != null">
|
#{sec,jdbcType=VARCHAR},
|
</if>
|
<if test="userId != null">
|
#{userId,jdbcType=INTEGER},
|
</if>
|
</trim>
|
</insert>
|
|
<update id="helmetTrajectoryUpdate">
|
update t_helmet_trajectory
|
<set>
|
<if test="ctime != null">
|
ctime = #{ctime,jdbcType=VARCHAR},
|
</if>
|
<if test="ltime != null">
|
ltime = #{ltime,jdbcType=VARCHAR},
|
</if>
|
<if test="sec != null">
|
sec = #{sec,jdbcType=VARCHAR},
|
</if>
|
<if test="userId != null">
|
user_id = #{userId,jdbcType=INTEGER},
|
</if>
|
</set>
|
where trajectory_id = #{trajectoryId,jdbcType=INTEGER}
|
</update>
|
<select id="helmetMotion" parameterType="java.lang.Integer" resultType="java.lang.String">
|
select times from t_helmet_motion where user_id=#{userId} order by times desc limit 0,1
|
</select>
|
<insert id="helmetMotionInsert">
|
insert into t_helmet_motion
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="motionId != null">
|
motion_id,
|
</if>
|
<if test="userId != null">
|
user_id,
|
</if>
|
<if test="xPoint != null">
|
x_point,
|
</if>
|
<if test="yPoint != null">
|
y_point,
|
</if>
|
<if test="times != null">
|
times,
|
</if>
|
<if test="cAngle != null">
|
c_angle,
|
</if>
|
<if test="cSpeed != null">
|
c_speed,
|
</if>
|
<if test="cTrust != null">
|
c_trust,
|
</if>
|
<if test="smTime != null">
|
sm_time,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="motionId != null">
|
#{motionId,jdbcType=INTEGER},
|
</if>
|
<if test="userId != null">
|
#{userId,jdbcType=INTEGER},
|
</if>
|
<if test="xPoint != null">
|
#{xPoint,jdbcType=VARCHAR},
|
</if>
|
<if test="yPoint != null">
|
#{yPoint,jdbcType=VARCHAR},
|
</if>
|
<if test="times != null">
|
#{times,jdbcType=VARCHAR},
|
</if>
|
<if test="cAngle != null">
|
#{cAngle,jdbcType=VARCHAR},
|
</if>
|
<if test="cSpeed != null">
|
#{cSpeed,jdbcType=VARCHAR},
|
</if>
|
<if test="cTrust != null">
|
#{cTrust,jdbcType=VARCHAR},
|
</if>
|
<if test="smTime != null">
|
#{smTime,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<select id="helmetList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
|
select helmet_device_id as helmetDeviceId,
|
device_num as deviceNum,
|
user_id as userId,
|
user_name as userName
|
from t_helmet_device
|
where 1=1
|
<if test="userName!=null and userName!='' ">
|
and user_name like concat('%',#{userName},'%')
|
</if>
|
<if test="deviceNum!=null and deviceNum!='' ">
|
and device_num like concat('%',#{deviceNum},'%')
|
</if>
|
</select>
|
|
<select id="helmetPictureList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetPicture">
|
select
|
thp.image_url as imageUrl,
|
thp.user_id as userId,
|
thp.x_point as xPoint,
|
thp.y_point as yPoint,
|
thp.cre_time as creTime,
|
thp.i_id as iId,
|
thp.sm_time as smTime
|
from t_helmet_picture thp
|
where 1=1
|
<if test="userId!=null and userId!='' ">
|
and thp.user_id=#{userId}
|
</if>
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and thp.sm_time between #{strTime} and #{endTime}
|
</if>
|
order by thp.cre_time desc
|
</select>
|
|
<select id="helmetTrajectoryList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetTrajectory">
|
select
|
trajectory_id as trajectoryId,
|
ctime,
|
ltime,
|
sec
|
from t_helmet_trajectory where 1=1
|
<if test="userId!=null and userId!='' ">
|
and user_id=#{userId}
|
</if>
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and ctime between #{strTime} and #{endTime}
|
</if>
|
</select>
|
|
<select id="helmetTrajectoryTime" resultType="java.lang.String">
|
SELECT
|
SUM( ltime )
|
FROM
|
t_helmet_trajectory
|
WHERE
|
1=1
|
<if test="userId!=null and userId!='' ">
|
and user_id=#{userId}
|
</if>
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and ctime between #{strTime} and #{endTime}
|
</if>
|
GROUP BY
|
user_id
|
</select>
|
|
<select id="helmetMotionList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetMotion">
|
select
|
motion_id as motionId,
|
user_id as userId,
|
x_point as xPoint,
|
y_point as yPoint,
|
times,
|
c_angle as cAngle,
|
c_speed as cSpeed,
|
c_trust as cTrust,
|
sm_time as smTime
|
from t_helmet_motion
|
where
|
user_id=#{userId}
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and sm_time between #{strTime} and #{endTime}
|
</if>
|
order by times asc
|
</select>
|
|
<insert id="dataValueInsert" >
|
insert into t_data_value
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="dataId != null">
|
data_id,
|
</if>
|
<if test="deviceId != null">
|
device_id,
|
</if>
|
<if test="deviceName != null">
|
device_name,
|
</if>
|
<if test="accountNumber != null">
|
account_number,
|
</if>
|
<if test="uploadTime != null">
|
upload_time,
|
</if>
|
<if test="pm25 != null">
|
pm25,
|
</if>
|
<if test="pm10 != null">
|
pm10,
|
</if>
|
<if test="tsp != null">
|
tsp,
|
</if>
|
<if test="temperature != null">
|
temperature,
|
</if>
|
<if test="humidity != null">
|
humidity,
|
</if>
|
<if test="data6 != null">
|
data6,
|
</if>
|
<if test="windSpeed != null">
|
wind_speed,
|
</if>
|
<if test="windDirection != null">
|
wind_direction,
|
</if>
|
<if test="tvoc != null">
|
tvoc,
|
</if>
|
<if test="no2 != null">
|
no2,
|
</if>
|
<if test="co != null">
|
co,
|
</if>
|
<if test="so2 != null">
|
so2,
|
</if>
|
<if test="o3 != null">
|
o3,
|
</if>
|
<if test="noise != null">
|
noise,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="dataId != null">
|
#{dataId,jdbcType=INTEGER},
|
</if>
|
<if test="deviceId != null">
|
#{deviceId,jdbcType=INTEGER},
|
</if>
|
<if test="deviceName != null">
|
#{deviceName,jdbcType=VARCHAR},
|
</if>
|
<if test="accountNumber != null">
|
#{accountNumber,jdbcType=VARCHAR},
|
</if>
|
<if test="uploadTime != null">
|
#{uploadTime,jdbcType=VARCHAR},
|
</if>
|
<if test="pm25 != null">
|
#{pm25,jdbcType=VARCHAR},
|
</if>
|
<if test="pm10 != null">
|
#{pm10,jdbcType=VARCHAR},
|
</if>
|
<if test="tsp != null">
|
#{tsp,jdbcType=VARCHAR},
|
</if>
|
<if test="temperature != null">
|
#{temperature,jdbcType=VARCHAR},
|
</if>
|
<if test="humidity != null">
|
#{humidity,jdbcType=VARCHAR},
|
</if>
|
<if test="data6 != null">
|
#{data6,jdbcType=VARCHAR},
|
</if>
|
<if test="windSpeed != null">
|
#{windSpeed,jdbcType=VARCHAR},
|
</if>
|
<if test="windDirection != null">
|
#{windDirection,jdbcType=VARCHAR},
|
</if>
|
<if test="tvoc != null">
|
#{tvoc,jdbcType=VARCHAR},
|
</if>
|
<if test="no2 != null">
|
#{no2,jdbcType=VARCHAR},
|
</if>
|
<if test="co != null">
|
#{co,jdbcType=VARCHAR},
|
</if>
|
<if test="so2 != null">
|
#{so2,jdbcType=VARCHAR},
|
</if>
|
<if test="o3 != null">
|
#{o3,jdbcType=VARCHAR},
|
</if>
|
<if test="noise != null">
|
#{noise,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<select id="helmetReportTotal" resultType="com.thhy.materials.modules.biz.helmet.entity.dto.ReportNumDto">
|
SELECT
|
COUNT(sm_time) AS num,
|
DATE(sm_time) as smTime
|
FROM
|
t_helmet_report
|
WHERE
|
user_id = #{userId}
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and DATE(sm_time) between #{strTime} and #{endTime}
|
</if>
|
GROUP BY
|
DATE( sm_time )
|
</select>
|
|
<select id="helmetReportUser" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetReport">
|
select user_id as userId,
|
user_name as userName,
|
sos_type as sosType,
|
x_point as xPoint,
|
y_point as yPoint,
|
sm_time as smTime
|
from t_helmet_report where
|
user_id=#{userId}
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and sm_time between #{strTime} and #{endTime}
|
</if>
|
order by sm_time desc
|
</select>
|
|
<insert id="smockInsert" >
|
insert into t_data_smock
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="smokeId != null">
|
smoke_id,
|
</if>
|
<if test="gatewayCyc != null">
|
gateway_cyc,
|
</if>
|
<if test="fans != null">
|
FanS,
|
</if>
|
<if test="v1run != null">
|
V1Run,
|
</if>
|
<if test="uv1run != null">
|
UV1Run,
|
</if>
|
<if test="fanrun != null">
|
FanRun,
|
</if>
|
<if test="uv2run != null">
|
UV2Run,
|
</if>
|
<if test="ssvrun != null">
|
SSVRun,
|
</if>
|
<if test="dp != null">
|
DP,
|
</if>
|
<if test="t != null">
|
T,
|
</if>
|
<if test="oc != null">
|
OC,
|
</if>
|
<if test="gatew != null">
|
gatew,
|
</if>
|
<if test="nxrun != null">
|
NXRun,
|
</if>
|
<if test="alarm != null">
|
Alarm,
|
</if>
|
<if test="times != null">
|
times,
|
</if>
|
<if test="rtcVolt != null">
|
RTC_VOLT,
|
</if>
|
<if test="v2run != null">
|
V2Run,
|
</if>
|
<if test="dxqvrun != null">
|
DXQVRun,
|
</if>
|
<if test="press != null">
|
Press,
|
</if>
|
<if test="dc != null">
|
Dc,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="smokeId != null">
|
#{smokeId,jdbcType=INTEGER},
|
</if>
|
<if test="gatewayCyc != null">
|
#{gatewayCyc,jdbcType=VARCHAR},
|
</if>
|
<if test="fans != null">
|
#{fans,jdbcType=VARCHAR},
|
</if>
|
<if test="v1run != null">
|
#{v1run,jdbcType=VARCHAR},
|
</if>
|
<if test="uv1run != null">
|
#{uv1run,jdbcType=VARCHAR},
|
</if>
|
<if test="fanrun != null">
|
#{fanrun,jdbcType=VARCHAR},
|
</if>
|
<if test="uv2run != null">
|
#{uv2run,jdbcType=VARCHAR},
|
</if>
|
<if test="ssvrun != null">
|
#{ssvrun,jdbcType=VARCHAR},
|
</if>
|
<if test="dp != null">
|
#{dp,jdbcType=VARCHAR},
|
</if>
|
<if test="t != null">
|
#{t,jdbcType=VARCHAR},
|
</if>
|
<if test="oc != null">
|
#{oc,jdbcType=VARCHAR},
|
</if>
|
<if test="gatew != null">
|
#{gatew,jdbcType=VARCHAR},
|
</if>
|
<if test="nxrun != null">
|
#{nxrun,jdbcType=VARCHAR},
|
</if>
|
<if test="alarm != null">
|
#{alarm,jdbcType=VARCHAR},
|
</if>
|
<if test="times != null">
|
#{times,jdbcType=VARCHAR},
|
</if>
|
<if test="rtcVolt != null">
|
#{rtcVolt,jdbcType=VARCHAR},
|
</if>
|
<if test="v2run != null">
|
#{v2run,jdbcType=VARCHAR},
|
</if>
|
<if test="dxqvrun != null">
|
#{dxqvrun,jdbcType=VARCHAR},
|
</if>
|
<if test="press != null">
|
#{press,jdbcType=VARCHAR},
|
</if>
|
<if test="dc != null">
|
#{dc,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<select id="dataSmockList" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataSmock">
|
select
|
smoke_id as smokeId,
|
gateway_cyc as gatewayCyc,
|
FanS as fans,
|
V1Run as v1run,
|
UV1Run as uv1run,
|
FanRun as fanrun,
|
UV2Run as uv2run,
|
SSVRun as ssvrun,
|
DP as dp,
|
T as t,
|
OC as oc,
|
gatew as gatew,
|
NXRun as nxrun,
|
Alarm as alarm,
|
times as times,
|
RTC_VOLT as rtcVolt,
|
V2Run as v2run,
|
DXQVRun as dxqvrun,
|
Press as press,
|
Dc as dc
|
from t_data_smock
|
where 1=1
|
<if test="strTime!=null and endTime!=null and strTime!='' and endTime!='' ">
|
and times between #{strTime} and #{endTime}
|
</if>
|
order by times desc
|
</select>
|
<select id="dataValuesList" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataValue">
|
select
|
data_id as dataId,
|
device_id as deviceId,
|
device_name as deviceName,
|
account_number as accountNumber,
|
upload_time as uploadTime,
|
pm25 as pm25,
|
pm10 as pm10,
|
tsp as tsp,
|
temperature as temperature,
|
humidity as humidity,
|
data6 as data6,
|
wind_speed as windSpeed,
|
wind_direction as windDirection,
|
tvoc as tvoc,
|
no2 as no2,
|
co as co,
|
so2 as so2,
|
o3 as o3,
|
noise as noise
|
from t_data_value
|
where 1=1
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and upload_time between #{strTime} and #{endTime}
|
</if>
|
order by upload_time desc
|
</select>
|
|
</mapper>
|