水电表统计小数位处理

This commit is contained in:
2024-10-08 08:59:32 +08:00
parent a383495fcb
commit 7a07684750
2 changed files with 4 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ order by DATE_TRUNC('day', time), meter_id, organization_id, t_meter_log.time de
""")
@jakarta.persistence.Table(indexes = @jakarta.persistence.Index(name ="idx_meter_day_log_org_id", columnList = "organization_id"))
//@jakarta.persistence.Table(indexes = @jakarta.persistence.Index(name ="idx_meter_day_log_org_id", columnList = "organization_id"))
public class MeterDayLogEntity extends OrgCommonEntity {
@@ -52,6 +52,6 @@ public class MeterDayLogEntity extends OrgCommonEntity {
@Formula("( lag(value, 1, (select tm.init_value from t_meter tm where tm.id = meter_id)) over (partition by meter_id order by time asc ) )")
private java.lang.Double previousValue;
@Formula(" ( value - ( lag(value, 1, (select tm.init_value from t_meter tm where tm.id = meter_id)) over (partition by meter_id order by time asc ) ) )")
@Formula(" (round( ( value - ( lag(value, 1, (select tm.init_value from t_meter tm where tm.id = meter_id)) over (partition by meter_id order by time asc ) ) )::numeric, 2))")
private java.lang.Double usage;
}

View File

@@ -37,7 +37,7 @@ order by DATE_TRUNC('month', time), meter_id, organization_id, t_meter_log.time
""")
@jakarta.persistence.Table(indexes = @jakarta.persistence.Index(name ="idx_meter_month_log_org_id", columnList = "organization_id"))
//@jakarta.persistence.Table(indexes = @jakarta.persistence.Index(name ="idx_meter_month_log_org_id", columnList = "organization_id"))
public class MeterMonthLogEntity extends OrgCommonEntity {
@@ -52,6 +52,6 @@ public class MeterMonthLogEntity extends OrgCommonEntity {
@Formula("( lag(value, 1, (select tm.init_value from t_meter tm where tm.id = meter_id)) over (partition by meter_id order by time asc ) )")
private java.lang.Double previousValue;
@Formula(" ( value - ( lag(value, 1, (select tm.init_value from t_meter tm where tm.id = meter_id)) over (partition by meter_id order by time asc ) ) )")
@Formula(" (round(( value - ( lag(value, 1, (select tm.init_value from t_meter tm where tm.id = meter_id)) over (partition by meter_id order by time asc ) ) )::numeric, 2))")
private java.lang.Double usage;
}