123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- package dto
- import (
- "gas-cylinder-api/app/admin/model"
- "gas-cylinder-api/common/dto"
- common "gas-cylinder-api/common/model"
- )
- type DeviceGetPageReq struct {
- dto.Pagination `search:"-"`
- Sn string `form:"sn" search:"type:contains;column:sn;table:device"` // 设备编码
- DeviceOrder
- }
- type DeviceOrder struct {
- CreatedAtOrder string `search:"type:order;column:created_at;table:device" form:"createdAtOrder" default:"desc"`
- }
- func (m *DeviceGetPageReq) GetNeedSearch() interface{} {
- return *m
- }
- type DeviceInsertReq struct {
- Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
- ProvUserId string `json:"provUserId" gorm:"size:32;"` // 省平台用户id
- ProvCmpCode string `json:"provCmpCode" gorm:"size:48;" swaggerignore:"true"` // 所属机构登记编
- Sn string `json:"sn" gorm:"size:128;" vd:"len($)>0;msg:'sn不能为空'"` // 设备sn
- Type int `json:"type" gorm:"size:32;"` // 1-手持枪 2-龙门
- OptType string `json:"optType"` // 操作类型
- common.ControlBy `swaggerignore:"true"`
- common.DeptBy `swaggerignore:"true"`
- }
- func (s *DeviceInsertReq) Generate(model *model.Device) {
- if s.Id != 0 {
- model.Id = s.Id
- }
- model.ProvUserId = s.ProvUserId
- //model.UserId = s.UserId
- model.ProvCmpCode = s.ProvCmpCode
- model.Sn = s.Sn
- model.Type = s.Type
- model.OptType = s.OptType
- 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 *DeviceInsertReq) GetId() interface{} {
- return s.Id
- }
- type DeviceUpdateReq struct {
- Id int `json:"id" comment:"编码"` // 编码
- ProvUserId string `json:"provUserId"` // 省平台用户id
- UserId int `json:"userId" swaggerignore:"true"` // 客户id
- Sn string `json:"sn"` // 设备sn
- Type int `json:"type"` // 1-手持枪 2-龙门
- OptType string `json:"optType"` // 操作类型
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *DeviceUpdateReq) Generate(model *model.Device) {
- if s.Id != 0 {
- model.Id = s.Id
- }
- model.ProvUserId = s.ProvUserId
- model.Sn = s.Sn
- model.Type = s.Type
- model.OptType = s.OptType
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *DeviceUpdateReq) GetId() interface{} {
- return s.Id
- }
- type DeviceGetReq struct {
- Id int `uri:"id"`
- }
- func (s *DeviceGetReq) GetId() interface{} {
- return s.Id
- }
- type DeviceDeleteReq struct {
- Id int `json:"id"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *DeviceDeleteReq) GetId() interface{} {
- return s.Id
- }
|