Commit 36087d9e authored by zhengjiawei's avatar zhengjiawei

sql修改

parent 1f95e80a
package com.yeejoin.amos.fas.business.dao.mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.vo.View3dNodeVo;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
public interface View3dMapper extends BaseMapper{
/**
* 按类型查询点
* @param type
* @param orgCode
* @return
*/
List<RegionTreeResponse> getPointByType(@Param("type")String type,@Param("orgCode")String orgCode,@Param("channelType") String channelType);
/**
* 获取点详情
* @param type
* @param pointId
* @return map
*/
HashMap<String, Object> getPointDetailByTypeAndId(@Param("type")String type, @Param("pointId")Long pointId);
/**
* 统计风险上升异常数量(风险点)-日期+机构
* @param param:{type,orgCode}
* @return Long
*/
Long countUpperRiskPoint(Map<String,Object> param);
/**
* 统计巡检异常数量(不合格、漏检)-日期+机构
* @param param{}
* @return Long
*/
Long countCheckException(Map<String,Object> param);
/**
* 统计故障告警数量(不合格、漏检)-日期+机构
* @param param
* @return
*/
Long countFireException(Map<String,Object> param);
/**
* 今日安全指数详情
* @param params orgCode,date
* @return list
*/
List<RiskPointRpnChangeBo> getAllErrorRiskPoint(Map<String, Object> params);
/**
* 一周安全指数趋势查询
* @param orgCode
* @return
*/
List<HashMap<String, Object>> getSafetyIndexWeek(@Param("orgCode")String orgCode);
/**
* 今日安全指数详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params);
/**
* 今日安全指数故障告警详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllFaultAlarm(Map<String, Object> params);
/**
* 今日巡检统计接口
* @param orgCode
* @return
*/
List<HashMap<String, Object>> getStatisticsCheck(String orgCode);
/**
* 风险异常显示最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getRiskErrorTop5(String orgCode);
/**
* 巡检异常示最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
/**
* 火灾告警最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getFireAlarmTop5(String orgCode);
/**
* 设备状态最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getEquipStatusTop5(String orgCode);
/**
* 按照类型查询点
* @param params {orgCode,type}
* @return 列表
*/
List<HashMap<String, Object>> getPintsByType(Map<String, Object> params);
/**
* 更新safetyIndexchangelog
*/
void safetyIndexRefresh();
/**
* 重点模式设备
* @return
*/
List<View3dNodeVo> getImpEqu3dPoints(String orgCode);
/**
* 异常点
* @param type
* @param orgCode
* @param riskSourceId 区域id
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode);
List<Node3DVoResponse> findViewDataByType(@Param("type")String type,@Param("riskSourceId")Long riskSourceId,@Param("orgCode")String orgCode,@Param("abnormalStatus")Boolean abnormalStatus);
Long retrieveAllCount(String type, Long riskSourceId, String inputText,String orgCode,String dataLevel,String protectObjName);
List<HashMap<String, Object>> retrieveAll(String type, Long riskSourceId, String inputText, long start, int length,String orgCode,String dataLevel,String protectObjName);
/**
* 查询区域下点
* @param ids 区域ids
* @return list
*/
List<Map<String, Object>> getAllPointInRegions(@Param("ids") List<Long> ids);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.vo.View3dNodeVo;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
public interface View3dMapper extends BaseMapper{
/**
* 按类型查询点
* @param type
* @param orgCode
* @return
*/
List<RegionTreeResponse> getPointByType(@Param("type")String type,@Param("orgCode")String orgCode,@Param("channelType") String channelType);
/**
* 获取点详情
* @param type
* @param pointId
* @return map
*/
HashMap<String, Object> getPointDetailByTypeAndId(@Param("type")String type, @Param("pointId")Long pointId);
/**
* 统计风险上升异常数量(风险点)-日期+机构
* @param param:{type,orgCode}
* @return Long
*/
Long countUpperRiskPoint(Map<String,Object> param);
/**
* 统计巡检异常数量(不合格、漏检)-日期+机构
* @param param{}
* @return Long
*/
Long countCheckException(Map<String,Object> param);
/**
* 统计故障告警数量(不合格、漏检)-日期+机构
* @param param
* @return
*/
Long countFireException(Map<String,Object> param);
/**
* 今日安全指数详情
* @param params orgCode,date
* @return list
*/
List<RiskPointRpnChangeBo> getAllErrorRiskPoint(Map<String, Object> params);
/**
* 一周安全指数趋势查询
* @param orgCode
* @return
*/
List<HashMap<String, Object>> getSafetyIndexWeek(@Param("orgCode")String orgCode);
/**
* 今日安全指数详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params);
/**
* 今日安全指数故障告警详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllFaultAlarm(Map<String, Object> params);
/**
* 今日巡检统计接口
* @param orgCode
* @return
*/
List<HashMap<String, Object>> getStatisticsCheck(String orgCode);
/**
* 风险异常显示最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getRiskErrorTop5(String orgCode);
/**
* 巡检异常示最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
/**
* 火灾告警最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getFireAlarmTop5(String orgCode);
/**
* 设备状态最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getEquipStatusTop5(String orgCode);
/**
* 按照类型查询点
* @param params {orgCode,type}
* @return 列表
*/
List<HashMap<String, Object>> getPintsByType(Map<String, Object> params);
/**
* 更新safetyIndexchangelog
*/
void safetyIndexRefresh();
/**
* 重点模式设备
* @return
*/
List<View3dNodeVo> getImpEqu3dPoints(String orgCode);
/**
* 异常点
* @param type
* @param orgCode
* @param riskSourceId 区域id
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode);
List<Node3DVoResponse> findViewDataByType(@Param("type")String type,@Param("riskSourceId")Long riskSourceId,@Param("orgCode")String orgCode,@Param("abnormalStatus")Boolean abnormalStatus);
Long retrieveAllCount(String type, Long riskSourceId, String inputText,String orgCode,String dataLevel,String protectObjName);
List<HashMap<String, Object>> retrieveAll(String type, Long riskSourceId, String inputText, long start, int length,String orgCode,String dataLevel,String protectObjName);
/**
* 查询区域下点
* @param ids 区域ids
* @return list
*/
List<Map<String, Object>> getAllPointInRegions(@Param("ids") List<Long> ids);
}
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.repository.IStationMaintenDao;
import com.yeejoin.amos.fas.business.service.intfc.IStationMaintenService;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.StationInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.List;
@Service("stationMaintenService")
public class StationMaintenServiceImp implements IStationMaintenService {
@Autowired
private IStationMaintenDao iStationMaintenDao;
@Override
public void save(StationInfo stationInfo){
// 状态为启用(0)下只能修改换流站名称
if(stationInfo.getId() == 0){
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(stationInfo.getUseType());
stringBuilder.append(stationInfo.getRegionCode());
stringBuilder.append(stationInfo.getCode());
stationInfo.setStationCode(stringBuilder.toString());
}else{
StationInfo station = detail();
// 判断状态是否切换
if(!station.getStatus().equals(stationInfo.getStatus())){
StringBuilder stringBuilder = new StringBuilder();
if(StringUtils.isEmpty(stationInfo.getRegionCode())){
stringBuilder.append(station.getStationCode());
}else{
stringBuilder.append(stationInfo.getUseType());
stringBuilder.append(stationInfo.getRegionCode());
stringBuilder.append(stationInfo.getCode());
}
stationInfo.setStationCode(stringBuilder.toString());
}
}
//保存
iStationMaintenDao.save(stationInfo);
}
@Override
public StationInfo detail(){
List<StationInfo> list = iStationMaintenDao.findAll();
if(list != null && !ObjectUtils.isEmpty(list)) {
return list.get(0);
}else{
return new StationInfo();
}
}
}
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.repository.IStationMaintenDao;
import com.yeejoin.amos.fas.business.service.intfc.IStationMaintenService;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.StationInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.List;
@Service("stationMaintenService")
public class StationMaintenServiceImp implements IStationMaintenService {
@Autowired
private IStationMaintenDao iStationMaintenDao;
@Override
public void save(StationInfo stationInfo){
// 状态为启用(0)下只能修改换流站名称
if(stationInfo.getId() == 0){
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(stationInfo.getUseType());
stringBuilder.append(stationInfo.getRegionCode());
stringBuilder.append(stationInfo.getCode());
stationInfo.setStationCode(stringBuilder.toString());
}else{
StationInfo station = detail();
// 判断状态是否切换
if(!station.getStatus().equals(stationInfo.getStatus())){
StringBuilder stringBuilder = new StringBuilder();
if(StringUtils.isEmpty(stationInfo.getRegionCode())){
stringBuilder.append(station.getStationCode());
}else{
stringBuilder.append(stationInfo.getUseType());
stringBuilder.append(stationInfo.getRegionCode());
stringBuilder.append(stationInfo.getCode());
}
stationInfo.setStationCode(stringBuilder.toString());
}
}
//保存
iStationMaintenDao.save(stationInfo);
}
@Override
public StationInfo detail(){
List<StationInfo> list = iStationMaintenDao.findAll();
if(list != null && !ObjectUtils.isEmpty(list)) {
return list.get(0);
}else{
return new StationInfo();
}
}
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import java.math.BigDecimal;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -133,6 +134,10 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
private RemoteSecurityService remoteSecurityService;
@Value("${station.equipment.code}")
private String equipmentCode;
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResponse setPoint3dPosition(List<BindPointBo> pointBoList) {
......@@ -547,7 +552,7 @@ public class View3dServiceImpl implements IView3dService {
@Override
public List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode) {
return view3dMapper.initViewErrorNode(type,riskSourceId,orgCode);
return view3dMapper.initViewErrorNode(type,riskSourceId,orgCode);
}
@Override
......@@ -611,7 +616,7 @@ public class View3dServiceImpl implements IView3dService {
@Override
public CommonResponse retrieveAll(String type, String riskSourceId, String inputText, int current, int pageSize,String orgCode,String dataLevel,String protectObjName,String token,String appKey,String product) {
CommonPageable pageable = new CommonPageable( current, pageSize);
CommonPageable pageable = new CommonPageable( current, pageSize);
Long riskSource = StringUtils.isEmpty(riskSourceId) ? null : Long.parseLong(riskSourceId);
Long count = view3dMapper.retrieveAllCount(type,riskSource,inputText,orgCode,dataLevel,protectObjName);
List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieveAll(type, riskSource,inputText,pageable.getOffset(),pageable.getPageSize(),orgCode,dataLevel,protectObjName);
......
......@@ -76,3 +76,16 @@ file.downLoad.url=http://39.98.246.31:8888/
#站端名称使用全拼
station.name = yinan
#查询装备分类
#消防车:2101
#灭火器:3104
#消火栓:3105
#探测器:8501
#消防小室:9301
#消防水池:9302
#消防泡沫间:9305
#消防视频:xfsp
station.equipment.code=2101,3104,3105,8501,9301,9302,9305,xfsp
......@@ -785,22 +785,21 @@
where status in ('0','2','3')
AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
select
distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join f_fire_equipment fe ON efe.fire_equipment_id = fe.id
where fe.equip_status = 1
AND (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
) tmp
left join wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
where (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
) tmp
where 1=1
<if test="riskSourceId != null">
AND FIND_IN_SET(tmp.risk_source_id,queryRiskSourceChildrenIds(#{riskSourceId}))
......@@ -1233,35 +1232,77 @@
select name,code,'impEquipment' as typeCode,org_code as orgCode, e.risk_source_id as riskSourceId
from f_equipment e
UNION all
select m.name,m.code,'monitorEquipment' as typeCode,m.org_code as orgCode, m.risk_source_id as riskSourceId
from f_fire_equipment m
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
where equip_classify = 0
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
</if>
UNION all
select name,code,'video' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 2
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_water_resource where type = 1
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_water_resource where type = 2
UNION all
select name,car_num as code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_car
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 3
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_station where type = 2
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_station where type = 1
-- 消防车
select
car.name ,
substr(cat.code ,1,4) as code,
'fireEquipment' as typeCode,
car.org_code as orgCode,
#{riskSourceId} as riskSourceId
from
wl_car as car
left join wl_equipment as equ on car.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
-- 视频
UNION all
select
vi.name,
'xfsp' as code,
'video' as typeCode,
vi.org_code as orgCode,
visou.source_id as risk_source_id
from
wl_video as vi
left join wl_video_source as visou on vi.id = visou.video_id
where visou.source_id is not null
group by vi.id
-- 建筑
UNION all
select
bu.name,
substr(cat.code ,1,4) as code ,
'fireEquipment' as typeCode,
bu.org_code as orgCode,
bu.region_id as risk_source_id
from
wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) in('9302','9301','9305')
-- 探测器
UNION all
select
det.name,
substr(cat.code ,1,4) as code,
'monitorEquipment' as typeCode,
spe.org_code as orgCode,
str.source_id as risk_source_id
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.id
where substr(cat.code ,1,4) = 8501
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
</if>
-- 消火栓 灭火器
UNION all
select
det.name,
substr(cat.code ,1,4) as code,
'fireEquipment' as typeCode,
spe.org_code as orgCode,
str.source_id as risk_source_id
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.id
where substr(cat.code ,1,4) in (3104,3105)
) as tmp
where 1=1
<if test="inputText!=null and inputText != ''" >
......@@ -1283,376 +1324,401 @@
<select id="retrieveAll" resultType="java.util.HashMap">
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO
from (select concat('riskSource-',r.id) as id,r.id as originId,r.name,r.code,r.ue4_location as ue4Location,r.ue4_rotation as ue4Rotation ,'riskSource' as type,r.org_code as orgCode,
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
CASE
WHEN (
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(r.position3d, ',', 1),
',"y":',
substring_index(
substring_index(r.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(r.position3d, ',', - 1),
'}'
)
END positionDTO,
r.name as label,
r.name as protectObjName,
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
from (select concat('riskSource-',r.id) as id,r.id as originId,r.name,r.code,r.ue4_location as ue4Location,r.ue4_rotation as ue4Rotation ,'riskSource' as type,r.org_code as orgCode,
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
CASE
WHEN (
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(r.position3d, ',', 1),
',"y":',
substring_index(
substring_index(r.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(r.position3d, ',', - 1),
'}'
)
END positionDTO,
r.name as label,
r.name as protectObjName,
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION all
select concat('patrol-',p.id) as id,p.id as originId,p.name,p.point_no as code,p.ue4_location as ue4Location,p.ue4_rotation as ue4Rotation ,'patrol' as type,p.org_code as orgCode,
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as typeCode,
CASE
WHEN (
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(p.coordinates, ',', 1),
',"y":',
substring_index(
substring_index(p.coordinates, ',', - 2),
',',
1
),
',"z":',
substring_index(p.coordinates, ',', - 1),
'}'
)
END positionDTO,
p.name as label,
p.name as protectObjName,
p.route_name as routeName,
p.charge_person_id as person,
case
when p.status = '0' then '未执行'
when p.status = '1' then '合格'
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId
from p_point p
WHERE is_delete = FALSE
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as typeCode,
CASE
WHEN (
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(p.coordinates, ',', 1),
',"y":',
substring_index(
substring_index(p.coordinates, ',', - 2),
',',
1
),
',"z":',
substring_index(p.coordinates, ',', - 1),
'}'
)
END positionDTO,
p.name as label,
p.name as protectObjName,
p.route_name as routeName,
p.charge_person_id as person,
case
when p.status = '0' then '未执行'
when p.status = '1' then '合格'
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId
from p_point p
WHERE is_delete = FALSE
UNION all
select concat('impEquipment-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'impEquipment' as type,org_code as orgCode,
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
CASE
WHEN (
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(e.position3d, ',', 1),
',"y":',
substring_index(
substring_index(e.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(e.position3d, ',', - 1),
'}'
)
END positionDTO,
e.name as label,
e.name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId
from f_equipment e
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
CASE
WHEN (
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(e.position3d, ',', 1),
',"y":',
substring_index(
substring_index(e.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(e.position3d, ',', - 1),
'}'
)
END positionDTO,
e.name as label,
e.name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId
from f_equipment e
UNION all
select concat('monitorEquipment-',m.id) as id,m.id as originId,m.name,m.code,m.ue4_location as ue4Location,m.ue4_rotation as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
m.equip_status as level , concat('level_',m.equip_status) as levelStr,m.is_indoor as isIndoor,'探测器' as typeName,'monitorEquipment' as typeCode,
CASE
WHEN (
ISNULL(m.position3d) || LENGTH(trim(m.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(m.position3d, ',', 1),
',"y":',
substring_index(
substring_index(m.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(m.position3d, ',', - 1),
'}'
)
END positionDTO,
m.name as label,
IFNULL(group_concat(f.name),'') as protectObjName,
'' as routeName,
'' as person,
m.name as title,
concat('monitorEquipment-',m.id) as `key`,
m.risk_source_id as riskSourceId
from f_fire_equipment m
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
where equip_classify = 0
group By m.code
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
</if>
select concat('monitorEquipment-',m.id) as id,m.id as originId,det.name,substr(cat.code ,1,4),'' as ue4Location,'' as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
IFNULL(group_concat(f.name),'') as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
str.source_id as riskSourceId
from wl_equipment_specific m
left join wl_equipment_detail as det on m.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = m.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.id
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
where substr(cat.code ,1,4) = 8501
group By m.code
<if test="protectObjName != null and protectObjName != ''">
AND f.name = #{protectObjName}
</if>
UNION all
select concat('video-',m.id) as id,m.id as originId,m.name,m.code,m.ue4_location as ue4Location,m.ue4_rotation as ue4Rotation ,'video' as type,m.org_code as orgCode,
m.equip_status as level , concat('level_',m.equip_status) as levelStr,m.is_indoor as isIndoor,'摄像头' as typeName,'video' as typeCode,
CASE
WHEN (
ISNULL(m.position3d) || LENGTH(trim(m.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(m.position3d, ',', 1),
',"y":',
substring_index(
substring_index(m.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(m.position3d, ',', - 1),
'}'
)
END positionDTO,
m.name as label,
f.name as protectObjName,
'' as routeName,
'' as person,
m.name as title,
concat('video-',m.id) as `key`,
m.risk_source_id as riskSourceId
from f_fire_equipment m
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
where m.equip_classify = 2
select concat('video-',vi.id) as id,vi.id as originId,vi.name,vi.code,null as ue4Location,null as ue4Rotation ,'video' as type,vi.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
vi.name as label,
sou.name as protectObjName,
'' as routeName,
'' as person,
vi.name as title,
concat('video-',vi.id) as `key`,
vis.source_id as riskSourceId
from wl_video as vi
left join wl_video_source as vis on vi.id = vis.video_id
left join f_risk_source as sou on sou.id = vis.source_id
UNION all
select concat('hydrant-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('hydrant-',id) as `key`,
risk_source_id as riskSourceId
from f_water_resource where type = 1
select concat('hydrant-',spe.id) as id,spe.id as originId,det.name,substr(cat.code ,1,4) as code,null as ue4Location,null as ue4Rotation ,'hydrant' as type,spe.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('hydrant-',spe.id) as `key`,
str.source_id as riskSourceId
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.id
where substr(cat.code ,1,4)= 3105
UNION all
select concat('pool-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('pool-',id) as `key`,
risk_source_id as riskSourceId
from f_water_resource where type = 2
select concat('pool-',bu.id) as id,bu.id as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation,'pool' as type,bu.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
bu.name as label,
bu.name as protectObjName,
'' as routeName,
'' as person,
bu.name as title,
concat('pool-',bu.id) as `key`,
bu.region_id as riskSourceId
from wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) = 9302
UNION all
select concat('fireCar-',id) as id,id as originId,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('fireCar-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_car
select concat('fireCar-',car.id) as id,car.id as originId,car.name,car.car_num as code,null as ue4Location,null as ue4Rotation, 'fireCar' as type,car.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
car.name as label,
car.name as protectObjName,
'' as routeName,
'' as person,
car.name as title,
concat('fireCar-',car.id) as `key`,
#{riskSourceId} as riskSourceId
from wl_car as car
left join wl_equipment as equ on car.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
UNION all
select concat('fireEquipment-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode,
equip_status as level , concat('level_',equip_status) as levelStr,is_indoor as isIndoor,'灭火器' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('fireEquipment-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 3
select concat('fireEquipment-',spe.id) as id,spe.id as originId,det.name,substr(cat.code ,1,4) as code,null as ue4Location,null as ue4Rotation,'fireEquipment' as type,spe.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('fireEquipment-',spe.id) as `key`,
str.source_id as riskSourceId
from wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.id
where substr(cat.code ,1,4) = 3104
UNION all
select concat('fireChamber-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('fireChamber-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_station where type = 2
select concat('fireChamber-',bu.id) as id,bu.id as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation , 'fireChamber' as type,bu.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
bu.name as label,
bu.name as protectObjName,
'' as routeName,
'' as person,
bu.name as title,
concat('fireChamber-',bu.id) as `key`,
bu.region_id as riskSourceId
from wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) = 9305
UNION all
select concat('fireFoamRoom-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode,
0 as level , 'level_0' as levelStr,is_indoor as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(position3d, ',', 1),
',"y":',
substring_index(
substring_index(position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(position3d, ',', - 1),
'}'
)
END positionDTO,
name as label,
name as protectObjName,
'' as routeName,
'' as person,
name as title,
concat('fireFoamRoom-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_station where type = 1
select concat('fireFoamRoom-',bu.id) as id,bu.id as originId,bu.name,bu.code,null as ue4Location,null as ue4Rotation , 'fireFoamRoom' as type,bu.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
bu.name as label,
bu.name as protectObjName,
'' as routeName,
'' as person,
bu.name as title,
concat('fireFoamRoom-',bu.id) as `key`,
bu.region_id as riskSourceId
from wl_building as bu
left join wl_equipment_category as cat on bu.equipment_code = cat.id
where substr(cat.code ,1,4) = 9301
) as tmp
<where>
<if test="inputText!=null and inputText != ''" >
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
......
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