package dto import ( "gas-cylinder-api/app/admin/model" "gas-cylinder-api/common/dto" common "gas-cylinder-api/common/model" ) type CustomerGetPageReq struct { dto.Pagination `search:"-"` PrincipalPhone string `form:"principalPhone" search:"type:contains;column:principal_phone;table:customer"` // 电话 Type string `form:"type" search:"type:exact;column:type;table:customer"` // 类型 Address string `form:"address" search:"type:contains;column:address;table:customer"` // 地址 CustomerOrder } type CustomerOrder struct { CreatedAtOrder string `search:"type:order;column:created_at;table:customer" form:"createdAtOrder" default:"desc"` } func (m *CustomerGetPageReq) GetNeedSearch() interface{} { return *m } type CustomerInsertReq struct { Id string `json:"id" swaggerignore:"true"` // 主键ID Name string `json:"name"` // 名字 PrincipalPhone string `json:"principalPhone" vd:"len($)>0;msg:'电话不能为空'"` // 负责人电话 Address string `json:"address"` // 地址 AddressImg string `json:"addressImg"` // 现场图片 Lng float64 `json:"lng"` // 经度 Lat float64 `json:"lat"` // 纬度 Type int `json:"type"` // 类型 0-商户 1-私人 City string `json:"city"` // 所在地市 Area string `json:"area"` // 所属区/县 Remark string `json:"remark"` // 备注描述 StoreCode string `swaggerignore:"true"` // 门店登记编号 common.ControlBy `swaggerignore:"true"` common.DeptBy `swaggerignore:"true"` } func (s *CustomerInsertReq) Generate(model *model.Customer) { model.Name = s.Name if s.Type == 0 { model.ShopName = s.Name } if s.Type == 1 { model.PrincipalName = s.Name } model.PrincipalPhone = s.PrincipalPhone model.Address = s.Address if len(s.AddressImg) > 0 { model.AddressImg = s.AddressImg } model.Lng = s.Lng model.Lat = s.Lat model.Type = s.Type model.City = s.City model.Area = s.Area model.Remark = s.Remark model.StoreCode = s.StoreCode if s.ControlBy.UpdateBy != 0 { model.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { model.CreateBy = s.CreateBy } if s.DeptBy.DeptId != 0 { model.DeptId = s.DeptId } } func (s *CustomerInsertReq) GetId() interface{} { return s.Id } func (s *CustomerInsertReq) SetStoreCode(storeCode string) { s.StoreCode = storeCode } type CustomerUpdateReq struct { Id string `json:"id" vd:"len($)>0"` // 主键ID Name string `json:"name"` // 名字 PrincipalPhone string `json:"principalPhone" vd:"len($)>0;msg:'电话不能为空'"` // 负责人电话 Address string `json:"address"` // 地址 AddressImg string `json:"addressImg"` // 现场图片 Lng float64 `json:"lng"` // 经度 Lat float64 `json:"lat"` // 纬度 Type int `json:"type"` // 类型 0-商户 1-私人 City string `json:"city"` // 所在地市 Area string `json:"area"` // 所属区/县 Remark string `json:"remark"` // 备注描述 StoreCode string `swaggerignore:"true"` // 门店登记编号 common.ControlBy `swaggerignore:"true"` common.DeptBy `swaggerignore:"true"` } func (s *CustomerUpdateReq) Generate(model *model.Customer) { model.Name = s.Name if s.Type == 0 { model.ShopName = s.Name } if s.Type == 1 { model.PrincipalName = s.Name } model.PrincipalPhone = s.PrincipalPhone model.Address = s.Address model.AddressImg = s.AddressImg model.Lng = s.Lng model.Lat = s.Lat model.Type = s.Type model.City = s.City model.Area = s.Area model.Remark = s.Remark model.StoreCode = s.StoreCode if s.ControlBy.UpdateBy != 0 { model.UpdateBy = s.UpdateBy } if s.ControlBy.CreateBy != 0 { model.CreateBy = s.CreateBy } } func (s *CustomerUpdateReq) GetId() interface{} { return s.Id } type CustomerGetReq struct { Id string `uri:"id"` } func (s *CustomerGetReq) GetId() interface{} { return s.Id } type CustomerGetByPhoneReq struct { Phone string `form:"phone" vd:"len($)>0"` } type CustomerGetBorrowGasCylinderReq struct { CustomerId string `form:"customerId" vd:"len($)>0"` } type CustomerDeleteReq struct { Id string `json:"id" vd:"len($)>0"` common.ControlBy `swaggerignore:"true"` } func (s *CustomerDeleteReq) GetId() interface{} { return s.Id } type AppletCustomerUpdateReq struct { Id string `json:"id" swaggerignore:"true"` // 主键ID Name string `json:"name" vd:"len($)>0;msg:'姓名不能为空'"` // 名字 PrincipalPhone string `json:"principalPhone" vd:"len($)>0;msg:'电话不能为空'"` // 负责人电话 Type int `json:"type"` // 类型 0-商户 1-私人 } func (s *AppletCustomerUpdateReq) GetId() interface{} { return s.Id }