org_news.go 3.23 KB
Newer Older
haoyanbin's avatar
1  
haoyanbin committed
1 2 3
package dto

import (
haoyanbin's avatar
1  
haoyanbin committed
4
	"go-admin/app/operate/models"
haoyanbin's avatar
1  
haoyanbin committed
5 6 7 8 9 10
	"go-admin/common/dto"
	common "go-admin/common/models"
	"time"
)

type OrgNewsGetPageReq struct {
haoyanbin's avatar
haoyanbin committed
11
	dto.Pagination `search:"-"`
haoyanbin's avatar
haoyanbin committed
12 13 14 15
	NewsName       string `form:"newsName"  search:"type:contains;column:news_name;table:org_news"`             //新闻名称
	StartTime      string `form:"startTime"  search:"type:gte;column:created_at;table:org_news" comment:"开始时间"` //开始时间
	EndTime        string `form:"endTime"  search:"type:lte;column:created_at;table:org_news" comment:"结束时间"`   //结束时间
	Status         string `form:"status"  search:"type:exact;column:status;table:org_news"`                     //新闻状态
haoyanbin's avatar
1  
haoyanbin committed
16 17
}

haoyanbin's avatar
haoyanbin committed
18 19 20 21 22 23 24 25 26 27 28
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"`
haoyanbin's avatar
1  
haoyanbin committed
29 30 31 32 33 34 35
}

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

type OrgNewsInsertReq struct {
haoyanbin's avatar
haoyanbin committed
36 37 38 39 40 41
	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
haoyanbin's avatar
1  
haoyanbin committed
42 43
}

haoyanbin's avatar
haoyanbin committed
44 45 46 47 48 49 50 51
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
haoyanbin's avatar
1  
haoyanbin committed
52 53 54 55 56 57 58
}

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

type OrgNewsUpdateReq struct {
haoyanbin's avatar
haoyanbin committed
59 60 61 62 63 64
	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
haoyanbin's avatar
1  
haoyanbin committed
65 66
}

haoyanbin's avatar
haoyanbin committed
67 68 69 70 71 72 73 74
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
haoyanbin's avatar
1  
haoyanbin committed
75 76 77 78 79 80 81 82
}

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

// OrgNewsGetReq 功能获取请求参数
type OrgNewsGetReq struct {
haoyanbin's avatar
haoyanbin committed
83
	Id int `uri:"id"`
haoyanbin's avatar
1  
haoyanbin committed
84
}
haoyanbin's avatar
haoyanbin committed
85

haoyanbin's avatar
1  
haoyanbin committed
86 87 88 89 90 91 92 93 94 95 96
func (s *OrgNewsGetReq) GetId() interface{} {
	return s.Id
}

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

func (s *OrgNewsDeleteReq) GetId() interface{} {
	return s.Ids
haoyanbin's avatar
haoyanbin committed
97
}