stat_day,
site_id,
channel_id,
customer_id,
building_id,
device_count,
read_times,
real_read_times,
un_read_times,
read_rate,
date_create,
date_update
INSERT INTO sc_stat_meter_read_rate_by_building (
stat_day,
site_id,
channel_id,
customer_id,
building_id,
device_count,
read_times,
real_read_times,
un_read_times,
read_rate,
date_create,
date_update
) VALUES (
#{statMeterReadRateByBuilding.statDay,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.siteId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.channelId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.customerId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.buildingId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.deviceCount,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.readTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.realReadTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.unReadTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.readRate,jdbcType=DECIMAL},
#{statMeterReadRateByBuilding.dateCreate,jdbcType=TIMESTAMP},
#{statMeterReadRateByBuilding.dateUpdate,jdbcType=TIMESTAMP}
)
INSERT INTO sc_stat_meter_read_rate_by_building
stat_day, site_id, channel_id, customer_id, building_id, device_count, read_times, real_read_times, un_read_times, read_rate, date_create, date_update,
VALUES
#{statMeterReadRateByBuilding.statDay,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.siteId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.channelId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.customerId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.buildingId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.deviceCount,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.readTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.realReadTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.unReadTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.readRate,jdbcType=DECIMAL},
#{statMeterReadRateByBuilding.dateCreate,jdbcType=TIMESTAMP},
#{statMeterReadRateByBuilding.dateUpdate,jdbcType=TIMESTAMP},
INSERT INTO sc_stat_meter_read_rate_by_building (
stat_day,
site_id,
channel_id,
customer_id,
building_id,
device_count,
read_times,
real_read_times,
un_read_times,
read_rate,
date_create,
date_update
)VALUES
(
#{statMeterReadRateByBuilding.statDay,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.siteId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.channelId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.customerId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.buildingId,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.deviceCount,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.readTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.realReadTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.unReadTimes,jdbcType=INTEGER},
#{statMeterReadRateByBuilding.readRate,jdbcType=DECIMAL},
#{statMeterReadRateByBuilding.dateCreate,jdbcType=TIMESTAMP},
#{statMeterReadRateByBuilding.dateUpdate,jdbcType=TIMESTAMP}
)
UPDATE sc_stat_meter_read_rate_by_building
site_id= #{statMeterReadRateByBuilding.siteId,jdbcType=INTEGER}, channel_id= #{statMeterReadRateByBuilding.channelId,jdbcType=INTEGER}, customer_id= #{statMeterReadRateByBuilding.customerId,jdbcType=INTEGER}, building_id= #{statMeterReadRateByBuilding.buildingId,jdbcType=INTEGER}, device_count= #{statMeterReadRateByBuilding.deviceCount,jdbcType=INTEGER}, read_times= #{statMeterReadRateByBuilding.readTimes,jdbcType=INTEGER}, real_read_times= #{statMeterReadRateByBuilding.realReadTimes,jdbcType=INTEGER}, un_read_times= #{statMeterReadRateByBuilding.unReadTimes,jdbcType=INTEGER}, read_rate= #{statMeterReadRateByBuilding.readRate,jdbcType=DECIMAL}, date_create= #{statMeterReadRateByBuilding.dateCreate,jdbcType=TIMESTAMP}, date_update= #{statMeterReadRateByBuilding.dateUpdate,jdbcType=TIMESTAMP}
WHERE stat_day = #{statMeterReadRateByBuilding.statDay,jdbcType=INTEGER}
WHERE 1 = 1
and rb.channel_id = #{param.channelId}
and rb.site_id = #{param.siteId}
and
b.${item.dimensionCode} = #{item.dimensionValue}
b.id = #{item.dimensionValue}
c.id = #{item.dimensionValue}
and rb.stat_day = #{param.statDay} and rb.stat_day >= #{param.startDate} and rb.stat_day #{param.endDate} and rb.read_rate >= #{param.beginRate} and rb.read_rate #{param.endRate} and rb.customer_id = #{param.custormerId} and b.community = #{param.communityId} and rb.building_id = #{param.buildingId}
SELECT
rb.stat_day as stat_day,
rb.building_id as building_id,
b.`name` AS building_name,
rb.device_count AS device_count,
rb.read_times AS read_times,
rb.real_read_times AS real_read_times,
rb.un_read_times AS un_read_times,
rb.read_rate AS read_rate,
de.alarm_device_num AS alarm_device_num ,
c.customer_name as customer_name
FROM
sc_stat_meter_read_rate_by_building rb
LEFT JOIN sc_stat_device_error_day de ON (
rb.stat_day = de.stat_day
AND rb.site_id = de.site_id
AND rb.channel_id = de.sys_id
AND rb.building_id = de.building_id
AND de.alarm_category = '0'
AND de.alarm_type = 0
AND de.handle_status = '0'
)
LEFT JOIN sc_building b ON ( rb.building_id = b.id )
LEFT JOIN sc_customer c on (rb.customer_id = c.id)
select
rb.stat_day as stat_day,
rb.building_id as building_id,
b.`name` AS building_name,
rb.device_count AS device_count,
rb.read_times AS read_times,
rb.real_read_times AS real_read_times,
rb.un_read_times AS un_read_times,
rb.read_rate AS read_rate,
rb.customer_id as customer_id,
c.customer_name as customer_name
from
sc_stat_meter_read_rate_by_building rb
LEFT JOIN sc_building b ON ( rb.building_id = b.id )
LEFT JOIN sc_customer c on (rb.customer_id = c.id)
select
rb.stat_day as stat_day,
rb.building_id as building_id,
b.`name` AS building_name,
rb.device_count AS device_count,
rb.read_times AS read_times,
rb.real_read_times AS real_read_times,
rb.un_read_times AS un_read_times,
rb.customer_id as customer_id,
c.customer_name as customer_name,
(
SELECT
count( 1 )
FROM
sc_install_list l
WHERE
l.`status` = 1
AND l.is_installed = 1
AND l.is_accepted = 0
AND l.building_id = rb.building_id
) AS installed_device_count,
(
SELECT
SUM( IF ( d.device_status = 5, 1, 0 ) )
FROM
sc_device d
WHERE
d.building_id = rb.building_id
AND d.`status` = 1
AND d.sys_id = - 99
) AS unenable_device_count ,
FORMAT(rb.real_read_times/ (
SELECT
count( 1 )
FROM
sc_install_list l
WHERE
l.`status` = 1
AND l.is_installed = 1
AND l.is_accepted = 0
AND l.building_id = rb.building_id
) *100, 2) as read_rate
from
sc_stat_meter_read_rate_by_building rb
LEFT JOIN sc_building b ON ( rb.building_id = b.id )
LEFT JOIN sc_customer c on (rb.customer_id = c.id)
select
rb.stat_day as stat_day,
rb.building_id as building_id,
b.`name` AS building_name,
rb.device_count AS device_count,
rb.read_times AS read_times,
rb.real_read_times AS real_read_times,
rb.un_read_times AS un_read_times,
rb.read_rate AS read_rate,
rb.customer_id as customer_id,
c.customer_name as customer_name
from
sc_stat_meter_read_rate_by_building_7day rb
LEFT JOIN sc_building b ON ( rb.building_id = b.id )
LEFT JOIN sc_customer c on (rb.customer_id = c.id)
select
rb.stat_day as stat_day,
rb.building_id as building_id,
b.`name` AS building_name,
rb.device_count AS device_count,
rb.read_times AS read_times,
rb.real_read_times AS real_read_times,
rb.un_read_times AS un_read_times,
rb.customer_id as customer_id,
c.customer_name as customer_name,
(
SELECT
count( 1 )
FROM
sc_install_list l
WHERE
l.`status` = 1
AND l.is_installed = 1
AND l.is_accepted = 0
AND l.building_id = rb.building_id
) AS installed_device_count,
(
SELECT
SUM( IF ( d.device_status = 5, 1, 0 ) )
FROM
sc_device d
WHERE
d.building_id = rb.building_id
AND d.`status` = 1
AND d.sys_id = - 99
) AS unenable_device_count ,
FORMAT(rb.real_read_times/ (
SELECT
count( 1 )
FROM
sc_install_list l
WHERE
l.`status` = 1
AND l.is_installed = 1
AND l.is_accepted = 0
AND l.building_id = rb.building_id
) *100, 2) as read_rate
from
sc_stat_meter_read_rate_by_building_7day rb
LEFT JOIN sc_building b ON ( rb.building_id = b.id )
LEFT JOIN sc_customer c on (rb.customer_id = c.id)
select
rb.stat_day as stat_day,
rb.building_id as building_id,
b.`name` AS building_name,
rb.device_count AS device_count,
rb.read_times AS read_times,
rb.real_read_times AS real_read_times,
rb.un_read_times AS un_read_times,
rb.read_rate AS read_rate,
rb.customer_id as customer_id,
c.customer_name as customer_name
from
sc_stat_meter_read_rate_by_building_15day rb
LEFT JOIN sc_building b ON ( rb.building_id = b.id )
LEFT JOIN sc_customer c on (rb.customer_id = c.id)
select
rb.stat_day as stat_day,
rb.building_id as building_id,
b.`name` AS building_name,
rb.device_count AS device_count,
rb.read_times AS read_times,
rb.real_read_times AS real_read_times,
rb.un_read_times AS un_read_times,
rb.read_rate AS read_rate,
rb.customer_id as customer_id,
c.customer_name as customer_name
from
sc_stat_meter_read_rate_by_building_month rb
LEFT JOIN sc_building b ON ( rb.building_id = b.id )
LEFT JOIN sc_customer c on (rb.customer_id = c.id)
select
rb.stat_day as stat_day,
rb.building_id as building_id,
b.`name` AS building_name,
rb.device_count AS device_count,
rb.read_times AS read_times,
rb.real_read_times AS real_read_times,
rb.un_read_times AS un_read_times,
rb.customer_id as customer_id,
c.customer_name as customer_name,
(
SELECT
count( 1 )
FROM
sc_install_list l
WHERE
l.`status` = 1
AND l.is_installed = 1
AND l.is_accepted = 0
AND l.building_id = rb.building_id
) AS installed_device_count,
(
SELECT
SUM( IF ( d.device_status = 5, 1, 0 ) )
FROM
sc_device d
WHERE
d.building_id = rb.building_id
AND d.`status` = 1
AND d.sys_id = - 99
) AS unenable_device_count ,
FORMAT(rb.real_read_times/ (
SELECT
count( 1 )
FROM
sc_install_list l
WHERE
l.`status` = 1
AND l.is_installed = 1
AND l.is_accepted = 0
AND l.building_id = rb.building_id
) *100, 2) as read_rate
from
sc_stat_meter_read_rate_by_building_15day rb
LEFT JOIN sc_building b ON ( rb.building_id = b.id )
LEFT JOIN sc_customer c on (rb.customer_id = c.id)