fix(park):完成园区部分的数据库迁移调整。
This commit is contained in:
parent
a9f93d5239
commit
1e04922cee
|
@ -79,8 +79,8 @@ type _ParkInfoFormData struct {
|
||||||
Area decimal.NullDecimal `json:"area" from:"area"`
|
Area decimal.NullDecimal `json:"area" from:"area"`
|
||||||
Capacity decimal.NullDecimal `json:"capacity" from:"capacity"`
|
Capacity decimal.NullDecimal `json:"capacity" from:"capacity"`
|
||||||
TenementQuantity decimal.NullDecimal `json:"tenement" from:"tenement"`
|
TenementQuantity decimal.NullDecimal `json:"tenement" from:"tenement"`
|
||||||
Category int `json:"category" form:"category"`
|
Category int8 `json:"category" form:"category"`
|
||||||
SubmeterType int `json:"submeter" form:"submeter"`
|
SubmeterType int8 `json:"submeter" form:"submeter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func createNewPark(c *gin.Context) {
|
func createNewPark(c *gin.Context) {
|
||||||
|
|
|
@ -31,8 +31,8 @@ type Park struct {
|
||||||
Area decimal.NullDecimal `json:"area"`
|
Area decimal.NullDecimal `json:"area"`
|
||||||
TenementQuantity decimal.NullDecimal `json:"tenement"`
|
TenementQuantity decimal.NullDecimal `json:"tenement"`
|
||||||
Capacity decimal.NullDecimal `json:"capacity"`
|
Capacity decimal.NullDecimal `json:"capacity"`
|
||||||
Category int8 `bun:"type:smallint,notnull,default:0" json:"category"`
|
Category int8 `bun:"type:smallint,notnull" json:"category"`
|
||||||
SubmeterType int8 `bun:"meter_04kv_type,type:smallint,notnull,default:0" json:"meter04kvType"`
|
SubmeterType int8 `bun:"meter_04kv_type,type:smallint,notnull" json:"meter04kvType"`
|
||||||
Region *string `json:"region"`
|
Region *string `json:"region"`
|
||||||
Address *string `json:"address"`
|
Address *string `json:"address"`
|
||||||
Contact *string `json:"contact"`
|
Contact *string `json:"contact"`
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (_ParkService) SaveNewPark(park model.Park) error {
|
||||||
func (_ParkService) UpdateParkInfo(park *model.Park) error {
|
func (_ParkService) UpdateParkInfo(park *model.Park) error {
|
||||||
ctx, cancel := global.TimeoutContext()
|
ctx, cancel := global.TimeoutContext()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
res, err := global.DB.NewUpdate().Model(&park).
|
res, err := global.DB.NewUpdate().Model(park).
|
||||||
Where("id = ?", park.Id).
|
Where("id = ?", park.Id).
|
||||||
Where("user_id = ?", park.UserId).
|
Where("user_id = ?", park.UserId).
|
||||||
Column("name", "abbr", "region", "address", "contact", "phone", "capacity", "tenement_quantity", "category", "meter_04kv_type").
|
Column("name", "abbr", "region", "address", "contact", "phone", "capacity", "tenement_quantity", "category", "meter_04kv_type").
|
||||||
|
@ -126,7 +126,7 @@ func (_ParkService) FetchParkDetail(pid string) (*model.Park, error) {
|
||||||
ctx, cancel := global.TimeoutContext()
|
ctx, cancel := global.TimeoutContext()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
var park = new(model.Park)
|
var park = new(model.Park)
|
||||||
err := global.DB.NewSelect().Model(&park).
|
err := global.DB.NewSelect().Model(park).
|
||||||
Where("id = ?", pid).
|
Where("id = ?", pid).
|
||||||
Scan(ctx)
|
Scan(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user