Commit 36087d9e authored by zhengjiawei's avatar zhengjiawei

sql修改

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