package dto import ( "IotAdmin/app/iot/models" "IotAdmin/common/dto" comModels "IotAdmin/common/models" "time" ) type IotGroupGetPageReq struct { dto.Pagination `search:"-"` BeginTime string `form:"beginTime" search:"type:gte;column:created_at;table:iot_group" comment:"创建时间"` EndTime string `form:"endTime" search:"type:lte;column:created_at;table:iot_group" comment:"创建时间"` IotGroupOrder } type IotGroupOrder struct { Name string `form:"nameOrder" search:"type:order;column:name;table:iot_group"` } func (m *IotGroupGetPageReq) GetNeedSearch() interface{} { return *m } // IotGroupInsertReq 添加分组请求参数 type IotGroupInsertReq struct { Id int `json:"-" comment:"ID"` // ID ParentId string `json:"parentId" comment:"父ID"` Name string `json:"name" comment:"分组名称"` Description string `json:"description" comment:"分组描述"` comModels.ControlBy } func (s *IotGroupInsertReq) Generate(model *models.IotGroup) { if s.Id == 0 { model.Model = comModels.Model{ Id: s.Id } } model.ParentId = s.ParentId model.Name = s.Name model.Description = s.Description model.CreateBy = s.CreateBy // 添加这而,需要记录是被谁创建的 } func (s *IotGroupInsertReq) GetId() interface{} { return s.Id } // IotGroupUpdateReq 修改分组请求参数 type IotGroupUpdateReq struct { Id int `uri:"id" comment:"ID"` // ID ParentId string `json:"parentId" comment:"父ID"` Name string `json:"name" comment:"分组名称"` Description string `json:"description" comment:"分组描述"` comModels.ControlBy } func (s *IotGroupUpdateReq) Generate(model *models.IotGroup) { if s.Id == 0 { model.Model = comModels.Model{ Id: s.Id } } model.ParentId = s.ParentId model.Name = s.Name model.Description = s.Description model.UpdateBy = s.UpdateBy // 添加这而,需要记录是被谁更新的 } func (s *IotGroupUpdateReq) GetId() interface{} { return s.Id } // IotGroupGetReq 获取分组请求参数 type IotGroupGetReq struct { Id int `uri:"id"` } func (s *IotGroupGetReq) GetId() interface{} { return s.Id } // IotGroupDeleteReq 删除分组请求参数 type IotGroupDeleteReq struct { Ids []int `json:"ids"` } func (s *IotGroupDeleteReq) GetId() interface{} { return s.Ids } // IotGroupResp 获取分组响应参数 type IotGroupResp struct { Id int `uri:"id" comment:"ID"` // ID ParentId string `json:"parentId" comment:"父ID"` Name string `json:"name" comment:"分组名称"` Description string `json:"description" comment:"分组描述"` CreateBy int `json:"createBy" comment:"创建者"` CreatedAt time.Time `json:"createdAt" comment:"创建时间"` } func (s *IotGroupResp) Generate(model *models.IotGroup) { s.Id = model.Id s.ParentId = model.ParentId s.Name = model.Name s.Description = model.Description s.CreateBy = model.CreateBy s.CreatedAt = model.CreatedAt }