org_news.go 2.38 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
	"go-admin/common/dto"
	common "go-admin/common/models"
)

type OrgNewsGetPageReq struct {
haoyanbin's avatar
haoyanbin committed
10
	dto.Pagination `search:"-"`
haoyanbin's avatar
haoyanbin committed
11 12 13 14
	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
15 16 17 18 19 20 21
}

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

type OrgNewsInsertReq struct {
haoyanbin's avatar
haoyanbin committed
22 23 24 25
	Id          int    `json:"-" comment:""` //
	NewsName    string `json:"newsName" comment:""`
	NewsTitle   string `json:"newsTitle" comment:""`
	NewsContent string `json:"newsContent" comment:""`
haoyanbin's avatar
haoyanbin committed
26
	NewsImg     string `json:"newsImg" comment:""`
haoyanbin's avatar
haoyanbin committed
27 28
	Status      string `json:"status" comment:""`
	common.ControlBy
haoyanbin's avatar
1  
haoyanbin committed
29 30
}

haoyanbin's avatar
haoyanbin committed
31 32 33 34 35 36 37
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
haoyanbin's avatar
haoyanbin committed
38
	model.NewsImg = s.NewsImg
haoyanbin's avatar
haoyanbin committed
39
	model.Status = s.Status
haoyanbin's avatar
1  
haoyanbin committed
40 41 42 43 44 45 46
}

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

type OrgNewsUpdateReq struct {
haoyanbin's avatar
haoyanbin committed
47 48 49 50
	Id          int    `uri:"id" comment:""` //
	NewsName    string `json:"newsName" comment:""`
	NewsTitle   string `json:"newsTitle" comment:""`
	NewsContent string `json:"newsContent" comment:""`
haoyanbin's avatar
haoyanbin committed
51
	NewsImg     string `json:"newsImg" comment:""`
haoyanbin's avatar
haoyanbin committed
52 53
	Status      string `json:"status" comment:""`
	common.ControlBy
haoyanbin's avatar
1  
haoyanbin committed
54 55
}

haoyanbin's avatar
haoyanbin committed
56 57 58 59 60 61 62
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
haoyanbin's avatar
haoyanbin committed
63
	model.NewsImg = s.NewsImg
haoyanbin's avatar
haoyanbin committed
64
	model.Status = s.Status
haoyanbin's avatar
1  
haoyanbin committed
65 66 67 68 69 70 71 72
}

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

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

haoyanbin's avatar
1  
haoyanbin committed
76 77 78 79 80 81 82 83 84 85 86
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
87
}