Browse Source

修改统计使用结构体

pull/13/head
yehongyang 3 years ago
parent
commit
7b9bea9d5a
2 changed files with 7 additions and 2 deletions
  1. +2
    -2
      web/models/chargetab.go
  2. +5
    -0
      web/models/propertytab.go

+ 2
- 2
web/models/chargetab.go View File

@ -2360,13 +2360,13 @@ func (t *Chargetab) PropertyFeeData(startDate string) (datalist CatPropertytabDa
})
}
//查询楼层统计
var proper []Propertytab
var proper []PropertytabTemporary
//查询住户统计
err = e.Table("propertytab").Select("buildingid,count(1) count,sum(constructionarea) constructionarea").In("propertytypeid", rateMap["住宅"]).In("buildingid", buildingId).Where("cid=?", t.Cid).GroupBy("buildingid").Find(&proper)
if err != nil {
return datalist, err
}
properMap := make(map[string]Propertytab)
properMap := make(map[string]PropertytabTemporary)
for _, v := range proper {
properMap[v.Buildingid] = v
}


+ 5
- 0
web/models/propertytab.go View File

@ -7,6 +7,11 @@ import (
"xorm.io/core"
)
type PropertytabTemporary struct {
Buildingid string `json:"buildingid" xorm:"VARCHAR(100)"`
Count int `json:"-" xorm:"count"`
Constructionarea float64 `json:"constructionarea" xorm:"DECIMAL(10,2)"`
}
type Propertytab struct {
Cid int `json:"cid" xorm:"not null pk INT(4)"`
Propertyid string `json:"propertyid" xorm:"not null pk VARCHAR(100)"`


Loading…
Cancel
Save