Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hg-smart
Commits
9336e033
Commit
9336e033
authored
Oct 21, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-10-21
1.设备驾驶舱接口
parent
a13c62ab
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
541 additions
and
0 deletions
+541
-0
ServiceHGSB010.java
.../java/com/baosight/hggp/hg/sb/service/ServiceHGSB010.java
+98
-0
HGSB010.xml
src/main/java/com/baosight/hggp/hg/sb/sql/HGSB010.xml
+443
-0
No files found.
src/main/java/com/baosight/hggp/hg/sb/service/ServiceHGSB010.java
0 → 100644
View file @
9336e033
package
com
.
baosight
.
hggp
.
hg
.
sb
.
service
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.EiInfoUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @author LiuYang
* @version 1.0 2024/10/21
* @description
*/
public
class
ServiceHGSB010
extends
ServiceEPBase
{
@OperationLogAnnotation
(
operModul
=
"设备监控"
,
operType
=
"查询"
,
operDesc
=
"查询设备状态"
)
public
EiInfo
queryBySbStatus
(
EiInfo
inInfo
)
{
Map
params
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
if
(
params
.
containsKey
(
"date"
)){
params
.
put
(
"date"
,
DateUtils
.
formatShort
(
params
.
get
(
"date"
)));
}
List
<
Map
>
result
=
DaoBase
.
getInstance
().
query
(
"HGSB010.queryBySbStatus"
,
params
);
inInfo
.
set
(
"result"
,
result
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
return
inInfo
;
}
/**
* 近7日设备运行时长
* @param inInfo
* @return
*/
public
EiInfo
querySbYes
(
EiInfo
inInfo
){
Map
params
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
if
(
params
.
containsKey
(
"date"
)){
params
.
put
(
"date"
,
DateUtils
.
formatShort
(
params
.
get
(
"date"
)));
}
params
.
put
(
"logValues"
,
Arrays
.
asList
(
"1"
,
"2"
,
"4"
));
List
<
Map
>
result
=
new
ArrayList
<>();
List
<
Map
>
listMap
=
DaoBase
.
getInstance
().
query
(
"HGSB010.queryBySbYes"
,
params
,
0
,
100
);
List
listMap2
=
listMap
.
stream
().
map
(
map
->
map
.
get
(
"date"
)).
sorted
().
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Object
,
List
<
Map
>>
listMap1
=
listMap
.
stream
().
collect
(
Collectors
.
groupingBy
(
m
->
m
.
get
(
"deviceCode"
)));
for
(
Object
key:
listMap1
.
keySet
())
{
Map
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
key
);
map
.
put
(
"type"
,
"line"
);
map
.
put
(
"stack"
,
"Total"
);
List
list1
=
new
ArrayList
<>();
for
(
Map
map1:
listMap1
.
get
(
key
))
{
list1
.
add
(
map1
.
get
(
"num"
));
}
map
.
put
(
"data"
,
list1
);
result
.
add
(
map
);
}
inInfo
.
set
(
"date"
,
listMap2
);
inInfo
.
set
(
"name"
,
listMap1
.
keySet
());
inInfo
.
set
(
EiConstant
.
resultBlock
,
result
);
return
inInfo
;
}
/**
* 近7日设备运行时长
* @param inInfo
* @return
*/
public
EiInfo
querySbNo
(
EiInfo
inInfo
){
Map
params
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
if
(
params
.
containsKey
(
"date"
)){
params
.
put
(
"date"
,
DateUtils
.
formatShort
(
params
.
get
(
"date"
)));
}
params
.
put
(
"logValues"
,
Arrays
.
asList
(
"3"
,
"5"
,
"6"
));
List
<
Map
>
result
=
new
ArrayList
<>();
List
<
Map
>
listMap
=
DaoBase
.
getInstance
().
query
(
"HGSB010.queryBySbYes"
,
params
,
0
,
100
);
List
listMap2
=
listMap
.
stream
().
map
(
map
->
map
.
get
(
"date"
)).
sorted
().
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Object
,
List
<
Map
>>
listMap1
=
listMap
.
stream
().
collect
(
Collectors
.
groupingBy
(
m
->
m
.
get
(
"deviceCode"
)));
for
(
Object
key:
listMap1
.
keySet
())
{
Map
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
key
);
map
.
put
(
"type"
,
"line"
);
map
.
put
(
"stack"
,
"Total"
);
List
list1
=
new
ArrayList
<>();
for
(
Map
map1:
listMap1
.
get
(
key
))
{
list1
.
add
(
map1
.
get
(
"num"
));
}
map
.
put
(
"data"
,
list1
);
result
.
add
(
map
);
}
inInfo
.
set
(
"date"
,
listMap2
);
inInfo
.
set
(
"name"
,
listMap1
.
keySet
());
inInfo
.
set
(
EiConstant
.
resultBlock
,
result
);
return
inInfo
;
}
}
src/main/java/com/baosight/hggp/hg/sb/sql/HGSB010.xml
0 → 100644
View file @
9336e033
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap
namespace=
"HGSB010"
>
<sql
id=
"condition"
>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"accountCode"
>
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"fileName"
>
FILE_NAME = #fileName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"equipmentType"
>
EQUIPMENT_TYPE = #equipmentType#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"equipmentCode"
>
EQUIPMENT_CODE LIKE CONCAT('%', #equipmentCode#, '%')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"logInivalue"
>
LOG_INIVALUE = #logInivalue#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"logValue"
>
LOG_VALUE = #logValue#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"createdBy"
>
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"createdName"
>
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"createdTime"
>
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"updatedBy"
>
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"updatedName"
>
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"updatedTime"
>
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deleteFlag"
>
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
</sql>
<select
id=
"query"
parameterClass=
"java.util.HashMap"
resultClass=
"com.baosight.hggp.hg.sb.domain.HGSB010"
>
SELECT
ID as "id",
<!-- ID -->
ACCOUNT_CODE as "accountCode",
FILE_NAME as "fileName",
<!-- 文件名 -->
EQUIPMENT_TYPE as "equipmentType",
<!-- 设备状态 -->
EQUIPMENT_CODE as "equipmentCode",
<!-- 设备编码 -->
LOG_INIVALUE as "logInivalue",
<!-- 初始类容 -->
LOG_VALUE as "logValue",
<!-- 日志类容 -->
CREATED_BY as "createdBy",
<!-- 创建人 -->
CREATED_NAME as "createdName",
<!-- 创建人名称 -->
CREATED_TIME as "createdTime",
<!-- 创建时间 -->
UPDATED_BY as "updatedBy",
<!-- 更新人 -->
UPDATED_NAME as "updatedName",
<!-- 更新人名称 -->
UPDATED_TIME as "updatedTime",
<!-- 更新时间 -->
DELETE_FLAG as "deleteFlag"
<!-- 是否删除0.否1.是 -->
FROM ${hggpSchema}.HGSB010 WHERE 1=1
<include
refid=
"condition"
/>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
</isNotEmpty>
<isEmpty
property=
"orderBy"
>
CREATED_TIME DESC
</isEmpty>
</dynamic>
</select>
<select
id=
"count"
resultClass=
"int"
>
SELECT COUNT(*) FROM ${hggpSchema}.HGSB010 WHERE 1=1
<include
refid=
"condition"
/>
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileName">
FILE_NAME = #fileName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentType">
EQUIPMENT_TYPE = #equipmentType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="equipmentCode">
EQUIPMENT_CODE = #equipmentCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logInivalue">
LOG_INIVALUE = #logInivalue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="logValue">
LOG_VALUE = #logValue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
-->
<insert
id=
"insert"
>
INSERT INTO ${hggpSchema}.HGSB010 (ID,
<!-- ID -->
ACCOUNT_CODE,
FILE_NAME,
<!-- 文件名 -->
EQUIPMENT_TYPE,
<!-- 设备状态 -->
EQUIPMENT_CODE,
<!-- 设备编码 -->
LOG_INIVALUE,
<!-- 初始类容 -->
LOG_VALUE,
<!-- 日志类容 -->
CREATED_BY,
<!-- 创建人 -->
CREATED_NAME,
<!-- 创建人名称 -->
CREATED_TIME,
<!-- 创建时间 -->
UPDATED_BY,
<!-- 更新人 -->
UPDATED_NAME,
<!-- 更新人名称 -->
UPDATED_TIME,
<!-- 更新时间 -->
DELETE_FLAG
<!-- 是否删除0.否1.是 -->
)
VALUES (#id#, #accountCode#, #fileName#, #equipmentType#, #equipmentCode#, #logInivalue#, #logValue#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#)
</insert>
<delete
id=
"delete"
>
DELETE FROM ${hggpSchema}.HGSB010 WHERE ID = #id#
</delete>
<update
id=
"update"
>
UPDATE ${hggpSchema}.HGSB010
SET
ACCOUNT_CODE = #accountCode#,
FILE_NAME = #fileName#,
<!-- 文件名 -->
EQUIPMENT_TYPE = #equipmentType#,
<!-- 设备状态 -->
EQUIPMENT_CODE = #equipmentCode#,
<!-- 设备编码 -->
LOG_INIVALUE = #logInivalue#,
<!-- 初始类容 -->
LOG_VALUE = #logValue#,
<!-- 日志类容 -->
CREATED_BY = #createdBy#,
<!-- 创建人 -->
CREATED_NAME = #createdName#,
<!-- 创建人名称 -->
CREATED_TIME = #createdTime#,
<!-- 创建时间 -->
UPDATED_BY = #updatedBy#,
<!-- 更新人 -->
UPDATED_NAME = #updatedName#,
<!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#,
<!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#
<!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<delete
id=
"deleteByCreatedTime"
>
DELETE FROM ${hggpSchema}.HGSB010 WHERE
SUBSTR(CREATED_TIME,1,8)
<
DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 day),'%Y%m%d')
</delete>
<select
id=
"queryBySbStatus"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
select
a.DEVICE_CODE as "deviceCode",
a.DEVICE_NAME as "deviceName",
a.DEVICE_MODEL as "deviceModel",
case when c.LOG_VALUE = 3 || c.LOG_VALUE = 5 || c.LOG_VALUE = 6 then '关机' else '开机' end as status
from ${hggpSchema}.HGSB001 a
join ${hggpSchema}.HGSB010 c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1 and c.EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
c.CREATED_TIME =(
select MAX(CREATED_TIME) from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE' and left(CREATED_TIME,8) = #date#
)
</isNotEmpty>
order by a.DEVICE_CODE
</select>
<select
id=
"queryBySbYes"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
select
a.DEVICE_CODE as "deviceCode",
a.DEVICE_MODEL as "deviceModel",
a.DATE as "date",
a.NUM as "num"
from (
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 6 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 5 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 4 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 3 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 2 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0
and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
concat(substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 5, 2), '', substring(replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', ''), 7, 2)) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(date_sub(str_to_date(#date#, '%Y%m%d'), interval 1 day), '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
union all
select
a.DEVICE_CODE,
a.DEVICE_MODEL,
right(replace(#date#, '-', ''), 4) as DATE,
ifnull(c.NUM, 0) NUM
from ${hggpSchema}.HGSB001 a
left join (
select
EQUIPMENT_CODE,
count(1) as NUM
from ${hggpSchema}.HGSB010
where EQUIPMENT_TYPE = 'STARUS_TYPE'
<isNotEmpty
prepend=
" AND "
property=
"logValues"
>
LOG_VALUE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"logValues"
>
#logValues[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
left(CREATED_TIME,8) = replace(#date#, '-', '')
</isNotEmpty>
group by EQUIPMENT_CODE
) c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
a.DELETE_FLAG = 0 and DEVICE_STATUS = 1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
) a
order by a.DEVICE_CODE
</select>
</sqlMap>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment