package dto import ( "gas-cylinder-api/app/admin/model" "gas-cylinder-api/common/dto" common "gas-cylinder-api/common/model" ) type AddressGetPageReq struct { dto.Pagination `search:"-"` CustomerId string `form:"customerId" search:"type:contains;column:customer_id;table:address"` // 角色名称 AddressOrder } type AddressOrder struct { CreatedAtOrder string `search:"type:order;column:created_at;table:address" form:"createdAtOrder" default:"desc"` } func (m *AddressGetPageReq) GetNeedSearch() interface{} { return *m } type AddressInsertReq struct { Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码 CustomerId string `json:"customerId" swaggerignore:"true"` // 客户id Name string `json:"name"` // 收货人名称 Phone string `json:"phone" vd:"len($)>0;msg:'手机号不能为空'"` // 联系电话 City string `json:"city" vd:"len($)>0;msg:'所在地市不能为空'"` // 所在地市 Area string `json:"area" vd:"len($)>0;msg:'所属区/县不能为空'"` // 所属区/县 Address string `json:"address"` // 详细地址 IsDefault bool `json:"isDefault"` // 默认地址 Lng float64 `json:"lng"` // 经度 Lat float64 `json:"lat"` // 纬度 } func (s *AddressInsertReq) Generate(m *model.Address) { if s.Id != 0 { m.Id = s.Id } m.CustomerId = s.CustomerId m.Name = s.Name m.Phone = s.Phone m.City = s.City m.Area = s.Area m.Address = s.Address m.IsDefault = s.IsDefault m.Lng = s.Lng m.Lat = s.Lat } func (e *AddressInsertReq) SetCustomerId(CustomerId string) { e.CustomerId = CustomerId } func (s *AddressInsertReq) GetId() interface{} { return s.Id } type AddressUpdateReq struct { Id int `json:"id" comment:"编码"` // 编码 Name string `json:"name"` // 收货人名称 Phone string `json:"phone"` // 联系电话 City string `json:"city"` // 所在地市 Area string `json:"area"` // 所属区/县 Address string `json:"address"` // 详细地址 IsDefault bool `json:"isDefault"` // 默认地址 Lng float64 `json:"lng"` // 经度 Lat float64 `json:"lat"` // 纬度 common.ControlBy `swaggerignore:"true"` } func (s *AddressUpdateReq) Generate(m *model.Address) { if s.Id != 0 { m.Id = s.Id } m.Name = s.Name m.Phone = s.Phone m.City = s.City m.Area = s.Area m.Address = s.Address m.IsDefault = s.IsDefault m.Lng = s.Lng m.Lat = s.Lat if s.ControlBy.UpdateBy != 0 { m.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { m.CreateBy = s.CreateBy } } func (s *AddressUpdateReq) GetId() interface{} { return s.Id } type AddressGetReq struct { Id int `uri:"id"` } func (s *AddressGetReq) GetId() interface{} { return s.Id } type AddressDeleteReq struct { Id int `json:"id"` common.ControlBy `swaggerignore:"true"` } func (s *AddressDeleteReq) GetId() interface{} { return s.Id }