package dto

import (
	"go-admin/app/operate/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
	"time"
)

type OrgMsgGetPageReq struct {
	dto.Pagination `search:"-"`
	OrgMsgOrder
}

type OrgMsgOrder struct {
	Id        int       `form:"idOrder"  search:"type:order;column:id;table:org_msg"`
	Code      string    `form:"codeOrder"  search:"type:order;column:code;table:org_msg"`
	Username  string    `form:"usernameOrder"  search:"type:order;column:username;table:org_msg"`
	CreateBy  string    `form:"createByOrder"  search:"type:order;column:create_by;table:org_msg"`
	UpdateBy  string    `form:"updateByOrder"  search:"type:order;column:update_by;table:org_msg"`
	CreatedAt time.Time `form:"createdAtOrder"  search:"type:order;column:created_at;table:org_msg"`
	UpdatedAt time.Time `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:org_msg"`
	DeletedAt time.Time `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:org_msg"`
}

func (m *OrgMsgGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type OrgMsgInsertReq struct {
	Id       int    `json:"-" comment:""` //
	Code     string `json:"code" comment:""`
	Username string `json:"username" comment:""`
	common.ControlBy
}

func (s *OrgMsgInsertReq) Generate(model *models.OrgMsg) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Code = s.Code
	model.Username = s.Username
}

func (s *OrgMsgInsertReq) GetId() interface{} {
	return s.Id
}

type OrgMsgUpdateReq struct {
	Id       int    `uri:"id" comment:""` //
	Code     string `json:"code" comment:""`
	Username string `json:"username" comment:""`
	common.ControlBy
}

func (s *OrgMsgUpdateReq) Generate(model *models.OrgMsg) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Code = s.Code
	model.Username = s.Username
}

func (s *OrgMsgUpdateReq) GetId() interface{} {
	return s.Id
}

// OrgMsgGetReq 功能获取请求参数
type OrgMsgGetReq struct {
	Id int `uri:"id"`
}

func (s *OrgMsgGetReq) GetId() interface{} {
	return s.Id
}

// OrgMsgDeleteReq 功能删除请求参数
type OrgMsgDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *OrgMsgDeleteReq) GetId() interface{} {
	return s.Ids
}
