Commit 7cfa8945 authored by wanghao's avatar wanghao

1 大屏端全局搜索调整

parent 60d5b515
...@@ -82,12 +82,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -82,12 +82,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != ''"> site_station_name like concat('%', #{name}, '%') AND</if> <if test="name != null and name != ''"> site_station_name like concat('%', #{name}, '%') AND</if>
longitude IS NOT NULL longitude IS NOT NULL
AND latitude IS NOT NULL UNION AND latitude IS NOT NULL UNION
SELECT select t1.userId as id,
user_id AS id, t1.nickName as NAME,
nick_name AS NAME, CONCAT( '[[', t1.longitude, ', ', t1.latitude, ']]' ) AS coordinates,
CONCAT( '[[', longitude, ', ', latitude, ']]' ) AS coordinates,
CASE CASE
user_type t1.userType
WHEN '1' THEN WHEN '1' THEN
'4' '4'
WHEN '2' THEN WHEN '2' THEN
...@@ -95,12 +94,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -95,12 +94,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN '3' THEN WHEN '3' THEN
'6' '6'
END AS type END AS type
FROM from(
t_detector_user
WHERE select a.user_id AS userId,
<if test="name != null and name != ''"> nick_name like concat('%', #{name}, '%') AND</if> a.detector_id AS detectorId,
longitude IS NOT NULL a.detector_status AS detectorStatus,
AND latitude IS NOT NULL UNION a.nick_name AS nickName,
a.user_type AS userType,
a.address AS address,
a.longitude AS longitude,
a.latitude AS latitude,
a.linkman AS linkman,
a.phone AS phone,
a.email AS email,
CASE a.detector_type
WHEN '1' THEN '家用探测器'
WHEN '2' THEN '工业探测器' END AS detectorType,
COUNT(a.detector_id) AS detectorCount,
SUM(CASE a.detector_status WHEN '0' THEN 1 ELSE 0 END) AS onLineNum,
SUM(CASE a.detector_status WHEN '1' THEN 1 ELSE 0 END) AS offLineNum
from(select
a1.* ,
a2.detector_id,
a2.detector_type,
a2.detector_status FROM t_detector_user a1
LEFT JOIN t_detector_info a2 ON a1.user_id = a2.user_id AND a2.is_del = '0'
where a1.is_del = '0' and a1.longitude is not null and a1.latitude is not null) a
group by a.user_id,a.detector_type
) t1 left join (
select b.user_id AS userId,
COUNT(b.id) AS historyAlarmNum,
SUM(CASE b.is_cancel_alarm WHEN '0' THEN 1 ELSE 0 END) AS processingAlarmNum,
COUNT(b.id) - SUM(CASE b.is_cancel_alarm WHEN '0' THEN 1 ELSE 0 END) AS cancelAlarmNum
from(select b1.id,b1.is_cancel_alarm,b2.*
from t_detector_report_data b1
left join t_detector_info b2 on b1.detector_code = b2.detector_code
right join t_detector_user b3 on b2.user_id = b3.user_id
where b2.is_del = '0' and b3.is_del = '0' ) b
group by b.user_id,b.detector_type
) t2 on t2.userId = t1.userId where <if test="name != null and name != ''"> t1.nickName like concat('%', #{name}, '%')</if> UNION
SELECT SELECT
video_manager_id AS id, video_manager_id AS id,
video_name AS NAME, video_name AS NAME,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment