| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- 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
- }
|