package dto

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

type OrgNewsGetPageReq struct {
	dto.Pagination     `search:"-"`
    OrgNewsOrder
}

type OrgNewsOrder struct {Id int `form:"idOrder"  search:"type:order;column:id;table:org_news"`
    NewsName string `form:"newsNameOrder"  search:"type:order;column:news_name;table:org_news"`
    NewsTitle string `form:"newsTitleOrder"  search:"type:order;column:news_title;table:org_news"`
    NewsContent string `form:"newsContentOrder"  search:"type:order;column:news_content;table:org_news"`
    Status string `form:"statusOrder"  search:"type:order;column:status;table:org_news"`
    CreateBy string `form:"createByOrder"  search:"type:order;column:create_by;table:org_news"`
    UpdateBy string `form:"updateByOrder"  search:"type:order;column:update_by;table:org_news"`
    CreatedAt time.Time `form:"createdAtOrder"  search:"type:order;column:created_at;table:org_news"`
    UpdatedAt time.Time `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:org_news"`
    DeletedAt time.Time `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:org_news"`
    
}

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

type OrgNewsInsertReq struct {
    Id int `json:"-" comment:""` // 
    NewsName string `json:"newsName" comment:""`
    NewsTitle string `json:"newsTitle" comment:""`
    NewsContent string `json:"newsContent" comment:""`
    Status string `json:"status" comment:""`
    common.ControlBy
}

func (s *OrgNewsInsertReq) Generate(model *models.OrgNews)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.NewsName = s.NewsName
    model.NewsTitle = s.NewsTitle
    model.NewsContent = s.NewsContent
    model.Status = s.Status
}

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

type OrgNewsUpdateReq struct {
    Id int `uri:"id" comment:""` // 
    NewsName string `json:"newsName" comment:""`
    NewsTitle string `json:"newsTitle" comment:""`
    NewsContent string `json:"newsContent" comment:""`
    Status string `json:"status" comment:""`
    common.ControlBy
}

func (s *OrgNewsUpdateReq) Generate(model *models.OrgNews)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.NewsName = s.NewsName
    model.NewsTitle = s.NewsTitle
    model.NewsContent = s.NewsContent
    model.Status = s.Status
}

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

// OrgNewsGetReq 功能获取请求参数
type OrgNewsGetReq struct {
     Id int `uri:"id"`
}
func (s *OrgNewsGetReq) GetId() interface{} {
	return s.Id
}

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

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