Commit 49b8edb7 authored by hezhuozhi's avatar hezhuozhi

兼容mysql四舍五入

parent 91cfa074
...@@ -50,9 +50,9 @@ ...@@ -50,9 +50,9 @@
hjc.collector_sn_code, hjc.collector_sn_code,
hjc.update_time, hjc.update_time,
hjc.current_power, hjc.current_power,
CAST(hjc.day_power_generation AS DECIMAL(20, 3)) as dayPowerGeneration, CAST( (FLOOR(hjc.day_power_generation * 1000) / 1000) AS DECIMAL(20, 3)) as dayPowerGeneration,
CAST(hjc.month_power_generation AS DECIMAL(20, 3)) as monthPowerGeneration, CAST( (FLOOR(hjc.month_power_generation * 1000) / 1000) AS DECIMAL(20, 3)) as monthPowerGeneration,
CAST(hjc.year_power_generation AS DECIMAL(20, 3)) as yearPowerGeneration, CAST( (FLOOR(hjc.year_power_generation * 1000) / 1000) AS DECIMAL(20, 3)) as yearPowerGeneration,
hjc.brand, hjc.brand,
hjc.model, hjc.model,
hjc.national_standard, hjc.national_standard,
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
hjc.AFCI_version, hjc.AFCI_version,
hjc.ID, hjc.ID,
hjc.capacity, hjc.capacity,
CAST(hjc.total_power_generation/1000 AS DECIMAL(20, 3)) as totalPowerGeneration, CAST( (FLOOR(hjc.total_power_generation/1000 * 1000) / 1000) AS DECIMAL(20, 3)) as totalPowerGeneration,
hjc.third_station_id, hjc.third_station_id,
hjc.is_delete, hjc.is_delete,
hjc.third_code, hjc.third_code,
......
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
`day_power_use` dayPowerUse, `day_power_use` dayPowerUse,
`month_power_use` monthPowerUse, `month_power_use` monthPowerUse,
`year_power_use` yearPowerUse, `year_power_use` yearPowerUse,
CAST(`real_time_power` AS DECIMAL(20, 3)) realTimePower, CAST( (FLOOR(`real_time_power` * 1000) / 1000) AS DECIMAL(20, 3)) realTimePower,
CAST(`accumulated_power`/1000 AS DECIMAL(20, 3)) accumulatedPower, CAST( (FLOOR(`accumulated_power`/1000 * 1000) / 1000) AS DECIMAL(20, 3)) accumulatedPower,
`state` , `state` ,
`type`, `type`,
`organizational_code` organizationalCode, `organizational_code` organizationalCode,
`is_delete` isDelete, `is_delete` isDelete,
CAST(`day_generate` AS DECIMAL(20, 3)) dayGenerate, CAST( (FLOOR(`day_generate` * 1000) / 1000) AS DECIMAL(20, 3)) dayGenerate,
`month_generate` monthGenerate, `month_generate` monthGenerate,
`year_generate` yearGenerate, `year_generate` yearGenerate,
`day_income` dayIncome, `day_income` dayIncome,
...@@ -93,20 +93,20 @@ ...@@ -93,20 +93,20 @@
select select
CAST(sum(real_time_power) AS DECIMAL(20, 3)) realTimePower, CAST( (FLOOR(sum(real_time_power) * 1000) / 1000) AS DECIMAL(20, 3)) realTimePower,
CAST(sum(capacity)/1000 AS DECIMAL(20, 3)) capacity, CAST( (FLOOR(sum(capacity)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) capacity,
CAST(sum(day_generate)/1000 AS DECIMAL(20, 3)) dayGenerate, CAST( (FLOOR(sum(day_generate)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) dayGenerate,
CAST(sum(month_generate)/1000 AS DECIMAL(20, 3)) monthGenerate, CAST( (FLOOR(sum(month_generate)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) monthGenerate,
CAST(sum(year_generate)/1000 AS DECIMAL(20, 3)) yearGenerate, CAST( (FLOOR(sum(year_generate)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) yearGenerate,
CAST(sum(accumulated_power)/1000 AS DECIMAL(20, 3)) accumulatedPower, CAST( (FLOOR(sum(accumulated_power)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) accumulatedPower,
CAST( sum(day_income) AS DECIMAL(20, 3)) dayIncome, CAST( (FLOOR( sum(day_income) * 1000) / 1000) AS DECIMAL(20, 3)) dayIncome,
CAST(sum(month_income)/10000 AS DECIMAL(20, 3)) monthIncome, CAST( (FLOOR(sum(month_income)/10000 * 1000) / 1000) AS DECIMAL(20, 3)) monthIncome,
CAST(sum(year_income)/10000 AS DECIMAL(20, 3)) yearIncome, CAST( (FLOOR(sum(year_income)/10000 * 1000) / 1000) AS DECIMAL(20, 3)) yearIncome,
CAST(sum(cumulative_income)/10000 AS DECIMAL(20, 3)) cumulativeIncome, CAST( (FLOOR(sum(cumulative_income)/10000 * 1000) / 1000) AS DECIMAL(20, 3)) cumulativeIncome,
CAST(sum(day_power_use)/1000 AS DECIMAL(20, 3)) dayPowerUse, CAST( (FLOOR(sum(day_power_use)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) dayPowerUse,
CAST(sum(month_power_use)/1000 AS DECIMAL(20, 3)) monthPowerUse, CAST( (FLOOR(sum(month_power_use)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) monthPowerUse,
CAST(sum(year_power_use)/1000 AS DECIMAL(20, 3)) yearPowerUse, CAST( (FLOOR(sum(year_power_use)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) yearPowerUse,
CAST(sum(rated_power) AS DECIMAL(20, 3)) ratedPower, CAST( (FLOOR(sum(rated_power) * 1000) / 1000) AS DECIMAL(20, 3)) ratedPower,
count(*) countBuiltNum count(*) countBuiltNum
from hygf_jp_station from hygf_jp_station
<where> <where>
...@@ -366,20 +366,20 @@ ...@@ -366,20 +366,20 @@
<select id="getCountJpStationdata" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto"> <select id="getCountJpStationdata" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select select
CAST(sum(real_time_power) AS DECIMAL(20, 3)) realTimePower, CAST( (FLOOR(sum(real_time_power) * 1000) / 1000) AS DECIMAL(20, 3)) realTimePower,
CAST(sum(capacity)/1000 AS DECIMAL(20, 3)) capacity, CAST( (FLOOR(sum(capacity)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) capacity,
CAST(sum(day_generate)/1000 AS DECIMAL(20, 3)) dayGenerate, CAST( (FLOOR(sum(day_generate)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) dayGenerate,
CAST(sum(month_generate)/1000 AS DECIMAL(20, 3)) monthGenerate, CAST( (FLOOR(sum(month_generate)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) monthGenerate,
CAST(sum(year_generate)/1000 AS DECIMAL(20, 3)) yearGenerate, CAST( (FLOOR(sum(year_generate)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) yearGenerate,
CAST(sum(accumulated_power)/1000 AS DECIMAL(20, 3)) accumulatedPower, CAST( (FLOOR(sum(accumulated_power)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) accumulatedPower,
CAST( sum(day_income) AS DECIMAL(20, 3)) dayIncome, CAST( (FLOOR( sum(day_income) * 1000) / 1000) AS DECIMAL(20, 3)) dayIncome,
CAST(sum(month_income)/10000 AS DECIMAL(20, 3)) monthIncome, CAST( (FLOOR(sum(month_income)/10000 * 1000) / 1000) AS DECIMAL(20, 3)) monthIncome,
CAST(sum(year_income)/10000 AS DECIMAL(20, 3)) yearIncome, CAST( (FLOOR(sum(year_income)/10000 * 1000) / 1000) AS DECIMAL(20, 3)) yearIncome,
CAST(sum(cumulative_income)/10000 AS DECIMAL(20, 3)) cumulativeIncome, CAST( (FLOOR(sum(cumulative_income)/10000 * 1000) / 1000) AS DECIMAL(20, 3)) cumulativeIncome,
CAST(sum(day_power_use)/1000 AS DECIMAL(20, 3)) dayPowerUse, CAST( (FLOOR(sum(day_power_use)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) dayPowerUse,
CAST(sum(month_power_use)/1000 AS DECIMAL(20, 3)) monthPowerUse, CAST( (FLOOR(sum(month_power_use)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) monthPowerUse,
CAST(sum(year_power_use)/1000 AS DECIMAL(20, 3)) yearPowerUse, CAST( (FLOOR(sum(year_power_use)/1000 * 1000) / 1000) AS DECIMAL(20, 3)) yearPowerUse,
CAST(sum(rated_power) AS DECIMAL(20, 3)) ratedPower, CAST( (FLOOR(sum(rated_power) * 1000) / 1000) AS DECIMAL(20, 3)) ratedPower,
count(*) countBuiltNum count(*) countBuiltNum
from hygf_jp_station from hygf_jp_station
<where> <where>
...@@ -630,7 +630,7 @@ ...@@ -630,7 +630,7 @@
`rec_user_id` recUserId, `rec_user_id` recUserId,
`rec_user_name` recUserName, `rec_user_name` recUserName,
`sn_code` snCode, `sn_code` snCode,
CAST(`capacity` AS DECIMAL(20, 3)) capacity, CAST( (FLOOR(`capacity` * 1000) / 1000) AS DECIMAL(20, 3)) capacity,
`name` , `name` ,
`code` , `code` ,
`system_code` systemCode, `system_code` systemCode,
...@@ -652,15 +652,15 @@ ...@@ -652,15 +652,15 @@
`day_power_use` dayPowerUse, `day_power_use` dayPowerUse,
`month_power_use` monthPowerUse, `month_power_use` monthPowerUse,
`year_power_use` yearPowerUse, `year_power_use` yearPowerUse,
CAST(`real_time_power` AS DECIMAL(20, 3)) realTimePower, CAST( (FLOOR(`real_time_power` * 1000) / 1000) AS DECIMAL(20, 3)) realTimePower,
CAST(`accumulated_power`/1000 AS DECIMAL(20, 3)) accumulatedPower, CAST( (FLOOR(`accumulated_power`/1000 * 1000) / 1000) AS DECIMAL(20, 3)) accumulatedPower,
`state` , `state` ,
`type`, `type`,
`organizational_code` organizationalCode, `organizational_code` organizationalCode,
`is_delete` isDelete, `is_delete` isDelete,
CAST(`day_generate` AS DECIMAL(20, 3)) dayGenerate, CAST( (FLOOR(`day_generate` * 1000) / 1000) AS DECIMAL(20, 3)) dayGenerate,
CAST(`month_generate` AS DECIMAL(20, 3)) monthGenerate, CAST( (FLOOR(`month_generate` * 1000) / 1000) AS DECIMAL(20, 3)) monthGenerate,
CAST(`year_generate` AS DECIMAL(20, 3)) yearGenerate, CAST( (FLOOR(`year_generate` * 1000) / 1000) AS DECIMAL(20, 3)) yearGenerate,
`day_income` dayIncome, `day_income` dayIncome,
`month_income` monthIncome, `month_income` monthIncome,
`year_income` yearIncome, `year_income` yearIncome,
...@@ -668,7 +668,7 @@ ...@@ -668,7 +668,7 @@
`cumulative_income` cumulativeIncome, `cumulative_income` cumulativeIncome,
`email`, `email`,
rated_power ratedPower, rated_power ratedPower,
CAST(`day_generate`/capacity AS DECIMAL(20, 3)) fullhour, CAST( (FLOOR(`day_generate`/capacity * 1000) / 1000) AS DECIMAL(20, 3)) fullhour,
(select privilege_company.COMPANY_NAME from privilege_company where (select privilege_company.COMPANY_NAME from privilege_company where
privilege_company.ORG_CODE=hygf_jp_station.regional_companies_code) regionalCompaniesName privilege_company.ORG_CODE=hygf_jp_station.regional_companies_code) regionalCompaniesName
from hygf_jp_station from hygf_jp_station
...@@ -733,11 +733,11 @@ ...@@ -733,11 +733,11 @@
<!-- code参数为区域公司orgCode或经销商orgCode--> <!-- code参数为区域公司orgCode或经销商orgCode-->
<!-- <select id="getRegionStatistics" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics">--> <!-- <select id="getRegionStatistics" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics">-->
<!-- SELECT COUNT(*) AS powerStationNumber,--> <!-- SELECT COUNT(*) AS powerStationNumber,-->
<!-- CAST(SUM(capacity)/1000, 3) AS totalCapacity,--> <!-- CAST( (FLOOR(SUM(capacity)/1000, 3) AS totalCapacity,-->
<!-- CAST(SUM(day_generate)/1000, 3) AS totalDayGenerate,--> <!-- CAST( (FLOOR(SUM(day_generate)/1000, 3) AS totalDayGenerate,-->
<!-- CAST(SUM(rated_power), 3) AS totalRatedPower,--> <!-- CAST( (FLOOR(SUM(rated_power), 3) AS totalRatedPower,-->
<!-- CAST(SUM(real_time_power), 3) AS totalRealTimePower,--> <!-- CAST( (FLOOR(SUM(real_time_power), 3) AS totalRealTimePower,-->
<!-- CAST(SUM(day_income), 3) AS totalDayIncome--> <!-- CAST( (FLOOR(SUM(day_income), 3) AS totalDayIncome-->
<!-- FROM hygf_jp_station hjs--> <!-- FROM hygf_jp_station hjs-->
<!-- <where>--> <!-- <where>-->
<!-- <if test="regionCode != null and regionCode !=''">--> <!-- <if test="regionCode != null and regionCode !=''">-->
......
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