123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- "time"
- )
- // CygxMorningMeetingReviews [...]
- type CygxMorningMeetingReviews struct {
- Id int `orm:"column(id);pk"`
- MeetingTime time.Time `json:"meetingTime"` // 晨会日期
- PublishTime time.Time `json:"publishTime"` // 发布日期
- CreateTime time.Time `json:"createTime"`
- ModifyTime time.Time `json:"modifyTime"`
- Status int `json:"status"` // 0:未发布,1:已发布
- PartNums int `json:"partNums"` // 段落数
- IndustryNames string `json:"industryName"` // 产业名称
- }
- //添加晨报点评
- func AddCygxMorningMeetingReviews(item *CygxMorningMeetingReviews) (id int64, err error) {
- o := orm.NewOrm()
- id, err = o.Insert(item)
- return
- }
- //列表
- func GetCygxMorningMeetingReviewsList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxMorningMeetingReviews, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_morning_meeting_reviews WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- sql += ` LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
- return
- }
- func GetCygxMorningMeetingReviewsListCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count FROM cygx_morning_meeting_reviews WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- type CygxMorningMeetingReviewItem struct {
- Id int `orm:"column(id);pk"`
- MeetingTime string `json:"meetingTime"` // 晨会日期
- PublishTime string `json:"publishTime"` // 发布日期
- CreateTime string `json:"createTime"`
- ModifyTime string `json:"modifyTime"`
- Status int `json:"status"` // 0:未发布,1:已发布
- PartNums int `json:"partNums"` // 段落数
- IndustryNames string `json:"industryName"` // 产业名称
- }
- type CygxMorningMeetingReviewsList struct {
- List []*CygxMorningMeetingReviewItem
- Paging *paging.PagingItem `description:"分页数据"`
- }
- func GetMorningMeetingReviewById(reviewId int) (item *CygxMorningMeetingReviews, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_morning_meeting_reviews WHERE id=?`
- err = o.Raw(sql, reviewId).QueryRow(&item)
- return
- }
- // 发布报告
- func PublishMorningMeetingReviewById(reviewId int) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE cygx_morning_meeting_reviews SET status=1,publish_time=now(),modify_time=NOW() WHERE id = ? `
- _, err = o.Raw(sql, reviewId).Exec()
- return
- }
- type MorningReviewPublishReq struct {
- ReviewIds string `description:"晨会id,多个用英文逗号隔开"`
- }
- type MorningReviewPublishCancelReq struct {
- ReviewId int `description:"晨会id"`
- }
- //取消发布报告
- func PublishCancelMorningMeetingReview(reviewId int) (err error) {
- o := orm.NewOrm()
- sql := ` UPDATE cygx_morning_meeting_reviews SET status=0,publish_time=null WHERE id =? `
- _, err = o.Raw(sql, reviewId).Exec()
- return
- }
- type MorningReviewDeleteReq struct {
- ReviewId int `description:"晨会id"`
- }
- //删除晨会点评
- func DeleteMorningMeeting(reviewId int) (err error) {
- o := orm.NewOrm()
- sql := ` DELETE FROM cygx_morning_meeting_reviews WHERE id =? `
- _, err = o.Raw(sql, reviewId).Exec()
- return
- }
- //更新晨报点评
- func UpdateCygxMorningMeetingReviews(item *CygxMorningMeetingReviews) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE cygx_morning_meeting_reviews
- SET
- meeting_time =?,
- publish_time = ?,
- modify_time = ?,
- part_nums = ?,
- industry_names = ?,
- status = ?
- WHERE id = ? `
- _, err = o.Raw(sql, item.MeetingTime, item.PublishTime, item.ModifyTime, item.PartNums, item.IndustryNames, item.Status, item.Id).Exec()
- return
- }
|