mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
增加索引
This commit is contained in:
@@ -13,9 +13,15 @@ import org.hibernate.annotations.Formula;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
|
||||
@jakarta.persistence.Table(indexes = @jakarta.persistence.Index(name ="idx_meter_log_org_id", columnList = "organization_id"))
|
||||
|
||||
@jakarta.persistence.Table(
|
||||
indexes = {
|
||||
@jakarta.persistence.Index(
|
||||
name = "idx_meter_log_org_id",
|
||||
columnList = "organization_id"),
|
||||
@jakarta.persistence.Index(
|
||||
name = "idx_meter_log_meter_id",
|
||||
columnList = "meter_id")
|
||||
})
|
||||
public class MeterLogEntity extends OrgCommonEntity {
|
||||
|
||||
@ManyToOne private cn.lihongjie.coal.meter.entity.MeterEntity meter;
|
||||
@@ -26,7 +32,6 @@ public class MeterLogEntity extends OrgCommonEntity {
|
||||
@Comment("抄表值")
|
||||
private java.lang.Double value;
|
||||
|
||||
|
||||
@Comment("归档状态")
|
||||
@ColumnDefault("'0'")
|
||||
private String archiveStatus = "0";
|
||||
@@ -34,11 +39,11 @@ public class MeterLogEntity extends OrgCommonEntity {
|
||||
@Comment("数据来源")
|
||||
private String source;
|
||||
|
||||
|
||||
|
||||
|
||||
@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 ) )")
|
||||
@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(" (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))")
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user