select
distinct
c.id,
c.dept_id,
c.device_code,
c.device_name,
b.device_category_id,
d.person_id user_id
from
rq_iot_model_template a,
rq_iot_model_template_attrs b,
rq_iot_device c,
rq_iot_device_person d
where
a.device_category_id = b.device_category_id
and
a.device_category_id = c.asset_class
and
c.id = d.device_id
and
c.device_status in ('sg','dm')
and
a.deleted = 0
and
c.deleted = 0
and
d.deleted = 0
and c.id in
#{id}
select * from rq_iot_opeation_fill_order where id = #{id}
select
distinct
c.id,
c.dept_id,
c.device_code,
c.device_name,
b.device_category_id,
d.person_id user_id,
e.name dept_name,
f.nickname,
g.name,
c.device_status
from
rq_iot_model_template a,
rq_iot_model_template_attrs b,
rq_iot_device c,
rq_iot_device_person d,
system_dept e,
system_users f,
rq_iot_product_classify g
where
a.device_category_id = b.device_category_id
and
a.device_category_id = c.asset_class
and
c.id = d.device_id
and
c.dept_id = e.id
and
d.person_id = f.id
and
a.device_category_id = g.id
and
c.device_status in ('sg','dm')
and
a.deleted = 0
and
c.deleted = 0
and
d.deleted = 0
and e.id in
#{id}
order by c.dept_id
select
distinct
c.id,
c.dept_id,
c.device_code,
c.device_name,
b.device_category_id,
d.person_id user_id,
e.name dept_name,
f.nickname,
g.name,
c.device_status
from
rq_iot_model_template a,
rq_iot_model_template_attrs b,
rq_iot_device c,
rq_iot_device_person d,
system_dept e,
system_users f,
rq_iot_product_classify g
where
a.device_category_id = b.device_category_id
and
a.device_category_id = c.asset_class
and
c.id = d.device_id
and
c.dept_id = e.id
and
d.person_id = f.id
and
a.device_category_id = g.id
and
c.device_status = 'sg'
and
a.deleted = 0
and
c.deleted = 0
and
d.deleted = 0
and e.id in
#{id}
order by c.dept_id
insert into rq_iot_opeation_fill(device_id,device_code,device_name,device_category_id,create_time,dept_id,order_id,is_report)
values
(#{item.deviceId},#{item.deviceCode},#{item.deviceName},
#{item.deviceCategoryId},#{item.createTime},#{item.deptId},#{item.orderId},#{item.isReport})
insert into rq_iot_device_run_log
(dept_id,device_id,device_code,point_code,fill_content,create_time,point_name,total_run_time,is_sum)
values
(#{item.deptId},#{item.deviceId},#{item.deviceCode},
#{item.pointCode},#{item.fillContent},#{item.createTime},#{item.pointName},#{item.totalRunTime},#{item.isSum})
insert into rq_iot_device_run_log
(dept_id, device_id, device_code, point_code, fill_content, create_time, point_name, total_run_time,is_sum)
values
(#{deptId}, #{deviceId}, #{deviceCode},
#{pointCode}, #{fillContent}, #{createTime}, #{pointName}, #{totalRunTime},#{isSum})
update rq_iot_device_run_log
set
fill_content = #{fillContent}
where
device_code = #{deviceCode}
and
point_name = #{pointName}
and
DATE(create_time) = #{createTime}
and
is_sum = 0
update rq_iot_device_run_log
set
total_run_time = #{totalRunTime}
where
device_code = #{deviceCode}
and
point_name = #{pointName}
and
DATE(create_time) = #{createTime}
and
is_sum = 1
SELECT * FROM
rq_iot_opeation_fill
WHERE DATE(create_time) = CURDATE()
and device_id in (select device_id from
rq_iot_device_person where person_id = #{userId})
SELECT * FROM
rq_iot_opeation_fill
WHERE 1=1
and device_id in
#{id}
update rq_iot_opeation_fill set dept_id = #{deptId} where 1=1
and device_id in
#{id}
update rq_iot_opeation_fill_order
set order_status = '3',
reason = #{reason}
where
id = #{id}
update rq_iot_opeation_fill
set is_fill = '3'
where
order_id = #{id}
select device_id from
rq_iot_device_person where person_id = #{userId}
SELECT DISTINCT
a.*,
b.name org_name
FROM
rq_iot_opeation_fill a
JOIN system_dept b ON a.dept_id = b.id
JOIN rq_iot_model_template_attrs c ON a.device_category_id = c.device_category_id
JOIN rq_iot_opeation_fill_order d ON a.order_id = d.id
WHERE
a.dept_id IN (
SELECT id FROM (
SELECT d1.id FROM system_dept d1 WHERE d1.id = #{deptId}
UNION ALL
SELECT d2.id FROM system_dept d1 JOIN system_dept d2 ON d2.parent_id = d1.id WHERE d1.id = #{deptId}
UNION ALL
SELECT d3.id FROM system_dept d1 JOIN system_dept d2 ON d2.parent_id = d1.id JOIN system_dept d3 ON d3.parent_id = d2.id WHERE d1.id = #{deptId}
UNION ALL
SELECT d4.id FROM system_dept d1 JOIN system_dept d2 ON d2.parent_id = d1.id JOIN system_dept d3 ON d3.parent_id = d2.id JOIN system_dept d4 ON d4.parent_id = d3.id WHERE d1.id = #{deptId}
) AS dept_hierarchy
)
AND (
a.order_id = #{orderId}
)
ORDER BY
CASE WHEN device_code IS NULL OR device_code = '' THEN 1 ELSE 0 END ASC,
CAST(SUBSTRING(device_code, 3) AS UNSIGNED) ASC
select
distinct a.order_id
from
rq_iot_opeation_fill a,
rq_iot_opeation_fill_order b
where
a.order_id = b.id
and
a.deleted = 0
and
b.deleted = 0
and
a.order_id is not null
and(
(
a.device_name LIKE CONCAT('%', #{orgName}, '%')
OR a.device_code LIKE CONCAT('%', #{orgName}, '%')
or b.user_name LIKE CONCAT('%', #{orgName}, '%')
or b.order_name LIKE CONCAT('%', #{orgName}, '%')
)
1=1
)
select
distinct
a.*,
b.name org_name
from
rq_iot_opeation_fill a,
system_dept b,
rq_iot_model_template_attrs c
where
a.dept_id = b.id
and
a.device_category_id = c.device_category_id
and a.order_id = #{orderId}
and a.device_id = #{deviceId}
SELECT
COUNT(*) AS allDev, -- 总数量
SUM(CASE WHEN is_fill = 1 THEN 1 ELSE 0 END) AS fillDev, -- is_fill为1的数量
SUM(CASE WHEN is_fill = 0 THEN 1 ELSE 0 END) AS unFillDev -- is_fill为0的数量
FROM
rq_iot_opeation_fill
WHERE
order_id = #{orderId}
and
dept_id IN (
SELECT id FROM (
SELECT d1.id FROM system_dept d1 WHERE d1.id = #{deptId}
UNION ALL
SELECT d2.id FROM system_dept d1 JOIN system_dept d2 ON d2.parent_id = d1.id WHERE d1.id = #{deptId}
UNION ALL
SELECT d3.id FROM system_dept d1 JOIN system_dept d2 ON d2.parent_id = d1.id JOIN system_dept d3 ON d3.parent_id = d2.id WHERE d1.id = #{deptId}
UNION ALL
SELECT d4.id FROM system_dept d1 JOIN system_dept d2 ON d2.parent_id = d1.id JOIN system_dept d3 ON d3.parent_id = d2.id JOIN system_dept d4 ON d4.parent_id = d3.id WHERE d1.id = #{deptId}
) AS dept_hierarchy
)
and device_name != '日报填报'
SELECT *
FROM rq_iot_opeation_fill
WHERE is_report = 1
AND dept_id = #{deptId}
AND YEAR(create_time) = #{year}
SELECT a.*
FROM rq_iot_opeation_fill_order a
JOIN rq_iot_opeation_fill b ON a.id = b.order_id
WHERE b.device_id = #{deviceId}
AND (a.order_name LIKE CONCAT('%', #{orderName}, '%')
OR b.device_code LIKE CONCAT('%', #{orderName}, '%')
OR b.device_name LIKE CONCAT('%', #{orderName}, '%'))
AND a.order_status = #{orderStatus}
ORDER BY a.create_time DESC
SELECT a.id, a.create_time
FROM rq_iot_opeation_fill_order a
WHERE a.create_time BETWEEN #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler} AND #{createTime[1],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
AND a.dept_id IN
#{key}
SELECT au.id, au.name, au.parent_id
FROM (SELECT * FROM system_dept WHERE parent_id IS NOT NULL) au,
(SELECT @parent_id := '157') pd
WHERE FIND_IN_SET(parent_id, @parent_id) > 0
AND @parent_id := concat(@parent_id, ',', id)
UNION
SELECT id, name, parent_id
FROM system_dept
WHERE id = '157'
ORDER BY id;
SELECT au.id, au.name, au.parent_id
FROM (SELECT * FROM system_dept WHERE parent_id IS NOT NULL) au,
(SELECT @parent_id := '163') pd
WHERE FIND_IN_SET(parent_id, @parent_id) > 0
AND @parent_id := concat(@parent_id, ',', id)
UNION
SELECT id, name, parent_id
FROM system_dept
WHERE id = '163'
ORDER BY id;
SELECT au.id, au.name, au.parent_id
FROM (SELECT * FROM system_dept WHERE parent_id IS NOT NULL) au,
(SELECT @parent_id := '158') pd
WHERE FIND_IN_SET(parent_id, @parent_id) > 0
AND @parent_id := concat(@parent_id, ',', id)
UNION
SELECT id, name, parent_id
FROM system_dept
WHERE id = '158'
ORDER BY id;
SELECT au.id, au.name, au.parent_id
FROM (SELECT * FROM system_dept WHERE parent_id IS NOT NULL) au,
(SELECT @parent_id := #{id}) pd
WHERE FIND_IN_SET(parent_id, @parent_id) > 0
AND @parent_id := concat(@parent_id, ',', id)
UNION
SELECT id, name, parent_id
FROM system_dept
WHERE id = #{id}
ORDER BY id;
SELECT au.id, au.name, au.parent_id
FROM (SELECT * FROM rq_iot_product_classify WHERE parent_id IS NOT NULL) au,
(SELECT @parent_id := #{id}) pd
WHERE FIND_IN_SET(parent_id, @parent_id) > 0
AND @parent_id := concat(@parent_id, ',', id)
UNION
SELECT id, name, parent_id
FROM rq_iot_product_classify
WHERE id = #{id}
ORDER BY id;
select
distinct
b.id user_id,
b.nickname user_name,
c.id dept_id,
b.mobile,
c.name orgName
from
rq_iot_device_person a
left join
system_users b
on
a.person_id = b.id
left join
system_dept c
on
b.dept_id = c.id
where b.id is not null
and a.device_id in
#{id}
select distinct user_name
from
rq_iot_opeation_fill_order
where
DATE(create_time) = DATE(#{localDateTime})
and user_name in
#{userName}
select
distinct
b.id user_id,
b.nickname user_name,
c.id dept_id,
b.mobile,
c.name orgName
from
rq_iot_device_person a
left join
system_users b
on
a.person_id = b.id
left join
system_dept c
on
b.dept_id = c.id
where
b.id is not null
and
c.id is not null
and c.id in
#{id}
and
a.person_id
not in
(select
distinct
d.person_id
from
rq_iot_model_template a,
rq_iot_model_template_attrs b,
rq_iot_device c,
rq_iot_device_person d
where
a.device_category_id = b.device_category_id
and
a.device_category_id = c.asset_class
and
c.id = d.device_id
and
c.device_status in ('sg','dm')
and
a.deleted = 0
and
c.deleted = 0
and
d.deleted = 0)
SELECT * FROM
rq_iot_opeation_fill_order
WHERE 1=1
and dept_id = #{deptId}
select
id,
name,
type,
model_attr,
is_sum,
threshold,
default_value,
sum_id,
description
from
rq_iot_model_template_attrs
where
device_category_id = #{deviceCategoryId} and deleted = 0
update rq_iot_opeation_fill
set is_fill = '1'
where device_id = #{deviceId}
and DATE(create_time) = DATE(#{createTime})
select distinct b.* from
rq_iot_opeation_fill b,
rq_iot_opeation_fill_order c
where
c.id = #{orderId}
and
b.dept_id = c.dept_id
and
b.order_id = c.id
and
DATE(b.create_time)=DATE(#{createTime})
order by b.create_time desc
SELECT
point_name,
fill_content,
(select max(total_run_time) from rq_iot_device_run_log where device_id = #{deviceId})total_run_time
FROM rq_iot_device_run_log
WHERE
device_id = #{deviceId}
and
DATE(create_time) = DATE(#{createTime})
order by id
desc
limit 1
SELECT
*
FROM rq_iot_device_run_log
WHERE
device_id = #{deviceId}
and
point_name = #{pointName}
and
DATE(create_time) = DATE(#{createTime})
order by id
desc
limit 1
select max(total_run_time)total_run_time
from rq_iot_device_run_log
where
device_id = #{deviceId}
and
point_name=#{pointName}
select device_id from rq_iot_opeation_fill where order_id = #{orderId}
select distinct order_id
from
rq_iot_opeation_fill
where
device_id = #{deviceId}
and DATE(create_time) = #{creDate}
and order_id != #{orderId}
select * from rq_iot_opeation_fill where order_id = #{orderId}
delete from rq_iot_opeation_fill where order_id = #{orderId}
delete from rq_iot_opeation_fill_order where id = #{orderId}
update rq_iot_opeation_fill_order set order_status = 1,update_time = NOW() where id = #{id}
update rq_iot_opeation_fill_order set order_status = 0 where id = #{id}
update rq_iot_opeation_fill_order set order_status = 2,update_time = NOW() where id = #{id}
select distinct device_code ,car_id from rq_iot_car_zhbd
update rq_iot_device set location= #{location} where device_code = #{deviceCode}
select
distinct
a.device_code,
a.device_name,
a.create_time,
b.name dept_name,
a.is_fill,
d.nickname,
e.order_name
FROM rq_iot_opeation_fill a
LEFT JOIN system_dept b
ON a.dept_id = b.id
AND b.deleted = 0 -- 将删除检查移至JOIN条件
LEFT JOIN rq_iot_device_person c
ON a.device_id = c.device_id
AND c.deleted = 0 -- 将删除检查移至JOIN条件
LEFT JOIN system_users d
ON c.person_id = d.id
AND d.deleted = 0 -- 将删除检查移至JOIN条件
LEFT JOIN rq_iot_opeation_fill_order e
ON a.order_id = e.id
and e.deleted = 0
WHERE a.deleted = 0
and e.order_name is not null
and a.device_name != '生产日报'
AND b.id IN (
SELECT id FROM system_dept WHERE id = #{deptId}
UNION ALL
SELECT id FROM system_dept WHERE parent_id = #{deptId}
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = #{deptId})
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = #{deptId}))
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = #{deptId})))
)
and a.is_fill = #{isFill}
AND a.create_time = #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
AND a.create_time BETWEEN #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler} AND #{createTime[1],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
AND (e.order_name LIKE CONCAT('%', #{orderName}, '%')
OR a.device_code LIKE CONCAT('%', #{orderName}, '%')
OR a.device_name LIKE CONCAT('%', #{orderName}, '%')
OR d.nickname LIKE CONCAT('%', #{orderName}, '%'))
order by a.create_time desc,a.is_fill asc,b.name asc
-- 统计指定部门及其子部门的工单状态
SELECT
dept_id,
name,
COALESCE(total_count, 0) AS total_count,
COALESCE(filled_count, 0) AS filled_count,
COALESCE(unfilled_count, 0) AS unfilled_count,
COALESCE(filling_count, 0) AS filling_count,
COALESCE(ignore_count, 0) AS ignore_count
FROM (
-- 第一行:汇总数据
SELECT
#{deptId} AS dept_id,
(SELECT name FROM system_dept WHERE id = #{deptId}) AS name,
COUNT(o.id) AS total_count,
SUM(CASE WHEN o.order_status = 1 THEN 1 ELSE 0 END) AS filled_count,
SUM(CASE WHEN o.order_status = 0 THEN 1 ELSE 0 END) AS unfilled_count,
SUM(CASE WHEN o.order_status = 2 THEN 1 ELSE 0 END) AS filling_count,
SUM(CASE WHEN o.order_status = 3 THEN 1 ELSE 0 END) AS ignore_count,
0 AS sort_order -- 确保汇总数据排在第一行
FROM rq_iot_opeation_fill_order o
WHERE o.deleted = 0
AND o.create_time = #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
AND o.create_time BETWEEN #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler} AND #{createTime[1],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
AND o.dept_id IN (
SELECT id FROM system_dept WHERE id = #{deptId} -- 包含根部门自身
UNION ALL
SELECT id FROM system_dept WHERE parent_id = #{deptId} -- 一级子部门
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = #{deptId}) -- 二级子部门
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = #{deptId})) -- 三级子部门
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = #{deptId}))) -- 四级子部门
)
UNION ALL
-- 后续行:直接子部门数据
SELECT
d.id AS dept_id,
d.name,
COUNT(o.id) AS total_count,
SUM(CASE WHEN o.order_status = 1 THEN 1 ELSE 0 END) AS filled_count,
SUM(CASE WHEN o.order_status = 0 THEN 1 ELSE 0 END) AS unfilled_count,
SUM(CASE WHEN o.order_status = 2 THEN 1 ELSE 0 END) AS filling_count,
SUM(CASE WHEN o.order_status = 3 THEN 1 ELSE 0 END) AS ignore_count,
1 AS sort_order -- 子部门数据排在后面
FROM system_dept d
LEFT JOIN rq_iot_opeation_fill_order o
ON o.deleted = 0
AND o.create_time = #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
AND o.create_time BETWEEN #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler} AND #{createTime[1],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
AND o.dept_id IN (
SELECT id FROM system_dept WHERE id = d.id -- 子部门自身
UNION ALL
SELECT id FROM system_dept WHERE parent_id = d.id -- 子部门的一级子部门
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = d.id) -- 子部门的二级子部门
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = d.id)) -- 子部门的三级子部门
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = d.id))) -- 子部门的四级子部门
)
WHERE d.parent_id = #{deptId} -- 只查询直接子部门
AND d.deleted = 0 -- 排除已删除的部门
GROUP BY d.id, d.name
HAVING COUNT(o.id) > 0 -- 只显示有数据的部门
) t
ORDER BY sort_order, dept_id;
-- 统计指定部门及其子部门的工单状态
-- 第一行:汇总数据
SELECT
COUNT(*) AS total_count,
SUM(CASE WHEN is_fill = 1 THEN 1 ELSE 0 END) AS filled_count,
SUM(CASE WHEN is_fill = 3 THEN 1 ELSE 0 END) AS ignore_count,
COUNT(*) - SUM(CASE WHEN is_fill = 1 THEN 1 ELSE 0 END)-SUM(CASE WHEN is_fill = 3 THEN 1 ELSE 0 END) AS unfilled_count
from(
select
distinct
a.device_code,
a.device_name,
a.create_time,
b.name dept_name,
a.is_fill,
d.nickname,
e.order_name
FROM rq_iot_opeation_fill a
LEFT JOIN system_dept b
ON a.dept_id = b.id
AND b.deleted = 0 -- 将删除检查移至JOIN条件
LEFT JOIN rq_iot_device_person c
ON a.device_id = c.device_id
AND c.deleted = 0 -- 将删除检查移至JOIN条件
LEFT JOIN system_users d
ON c.person_id = d.id
AND d.deleted = 0 -- 将删除检查移至JOIN条件
LEFT JOIN rq_iot_opeation_fill_order e
ON a.order_id = e.id
and e.deleted = 0
WHERE a.deleted = 0
and e.order_name is not null
and a.device_name != '生产日报'
AND b.id IN (
SELECT id FROM system_dept WHERE id = #{deptId}
UNION ALL
SELECT id FROM system_dept WHERE parent_id = #{deptId}
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = #{deptId})
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM
system_dept WHERE parent_id = #{deptId}))
UNION ALL
SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id IN (SELECT id FROM
system_dept WHERE parent_id IN (SELECT id FROM system_dept WHERE parent_id = #{deptId})))
)
AND a.create_time = #{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
AND a.create_time BETWEEN
#{createTime[0],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler} AND
#{createTime[1],typeHandler=org.apache.ibatis.type.LocalDateTimeTypeHandler}
) a
SELECT id dept_id
FROM system_dept
WHERE parent_id = #{deptId}
AND deleted = 0
select * from
rq_iot_opeation_fill
where
device_id = #{deviceId}
and
DATE(create_time) = #{createTime}
LIMIT 1
select
order_id
from
rq_iot_opeation_fill
where
device_id = #{deviceId}
and
DATE(create_time) = #{createTime}
SELECT DISTINCT
a.device_id,
a.device_code,
a.device_name,
a.create_time,
b.name AS org_name
FROM
rq_iot_opeation_fill a
INNER JOIN
rq_iot_model_template_attrs b
ON
a.device_category_id = b.device_category_id
WHERE
a.order_id = #{orderId}
AND (
-- 第一个查询的条件
(a.is_report = 1 AND b.daily_report = 0
AND b.name NOT IN (
SELECT
DISTINCT
b2.name
FROM
rq_iot_opeation_fill a2
INNER JOIN
rq_iot_model_template_attrs b2
ON
a2.device_category_id = b2.device_category_id
WHERE
a2.order_id = #{orderId}
AND
a2.is_report = 0
AND
b2.daily_report = 1
))
-- 第二个查询的条件(通过OR代替UNION)
OR (a.is_report = 0 AND b.daily_report = 1)
)
SELECT DISTINCT
a.device_id,
a.device_code,
a.device_name,
a.create_time,
b.name AS org_name
FROM
rq_iot_opeation_fill a
INNER JOIN
rq_iot_model_template_attrs b
ON
a.device_category_id = b.device_category_id
WHERE
a.order_id = #{orderId}
and
a.is_report = 1
select * from
rq_iot_device_run_log
where
device_id = #{deviceId}
and
point_name = #{pointName}
and DATE(create_time) = DATE(#{createTime})
select * from
rq_iot_device_run_log
where
device_id = #{deviceId}
and
point_name = #{pointName}
and DATE(create_time) = DATE(#{createTime})
select
description point_name
from
rq_iot_model_template_attrs
where
name = #{pointName}
and
device_category_id =
(select device_category_id from rq_iot_opeation_fill where device_id = #{deviceId} and DATE(create_time) = #{createTime})