cygx_morning_meeting_review_chapter.go 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // CygxMorningMeetingReviewChapter [...]
  7. type CygxMorningMeetingReviewChapter struct {
  8. Id int `orm:"column(id);pk"`
  9. MeetingTime time.Time `json:"meetingTime"` // 晨会日期
  10. CreateTime time.Time `json:"createTime"`
  11. ModifyTime time.Time `json:"modifyTime"`
  12. IndustryId int `json:"industryId"` // 产业id
  13. IndustryName string `json:"industryName"` // 产业名称
  14. ChartPermissionName string `json:"chartPermissionName"` // 行业名称
  15. ChartPermissionId int `json:"chartPermissionId"` // 行业id
  16. IndustrialSubjectIds string `json:"industrialSubjectId"` // 标的id
  17. MeetingId int64 `json:"meetingId"` // 主表id
  18. Content string `json:"content"` // 内容
  19. Title string `json:"title"` // 标题
  20. ReportLink string `json:"reportLink"` // 报告链接
  21. LinkArticleId int `json:"linkArticleId"` // 报告ID链接
  22. }
  23. type AddMorningMeetingReviewItem struct {
  24. ChapterId int
  25. Content string
  26. ChartPermissionId int
  27. ChartPermissionName string
  28. IndustryId int
  29. IndustryName string
  30. IndustrialSubjectIds string
  31. ReportLink string `description:"报告链接"`
  32. Title string `description:"标题"`
  33. }
  34. type AddMorningMeetingReviewsReq struct {
  35. List []*AddMorningMeetingReviewItem
  36. MeetingId int
  37. MeetingTime string
  38. PublishTime string
  39. DoType int `description:"操作类型 0,保存 、1,发布"`
  40. }
  41. // 添加晨报点评章节
  42. func AddCygxMorningMeetingReviewChapter(item *CygxMorningMeetingReviewChapter) (err error) {
  43. o := orm.NewOrmUsingDB("hz_cygx")
  44. _, err = o.Insert(item)
  45. return
  46. }
  47. // 列表
  48. func GetCygxMorningMeetingReviewsListById(meetingId int) (items []*CygxMorningMeetingReviewChapter, err error) {
  49. o := orm.NewOrmUsingDB("hz_cygx")
  50. sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE meeting_id = ? `
  51. _, err = o.Raw(sql, meetingId).QueryRows(&items)
  52. return
  53. }
  54. // 列表
  55. func GetCygxMorningMeetingReviewChapterList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxMorningMeetingReviewChapter, err error) {
  56. o := orm.NewOrmUsingDB("hz_cygx")
  57. sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE 1=1 `
  58. if condition != "" {
  59. sql += condition
  60. }
  61. sql += ` LIMIT ?,? `
  62. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  63. return
  64. }
  65. type IndustrialSubjectItem struct {
  66. IndustrialSubjectId int `orm:"column(industrial_subject_id);pk" description:"标的id"`
  67. SubjectName string `description:"标的名称"`
  68. }
  69. type CygxMorningMeetingReviewChapterRespItem struct {
  70. Id int `orm:"column(id);pk"`
  71. MeetingTime time.Time `json:"meetingTime"` // 晨会日期
  72. CreateTime time.Time `json:"createTime"`
  73. ModifyTime time.Time `json:"modifyTime"`
  74. IndustryId int `json:"industryId"` // 产业id
  75. IndustryName string `json:"industryName"` // 产业名称
  76. ChartPermissionName string `json:"chartPermissionName"` // 行业名称
  77. ChartPermissionId int `json:"chartPermissionId"` // 行业id
  78. IndustrialSubjectList []*IndustrialSubjectItem `json:"industrialSubjectList"` // 标的list
  79. MeetingId int64 `json:"meetingId"` // 主表id
  80. Content string `json:"content"` // 内容
  81. Title string `json:"title"` // 标题
  82. ReportLink string `json:"reportLink"` // 报告链接
  83. }
  84. type CygxMorningMeetingReviewChapterResp struct {
  85. MeetingTime string
  86. Status int
  87. List []*CygxMorningMeetingReviewChapterRespItem
  88. }
  89. // 删除晨会点评章节
  90. func DeleteMorningMeetingChapter(reviewId int) (err error) {
  91. o := orm.NewOrmUsingDB("hz_cygx")
  92. sql := ` DELETE FROM cygx_morning_meeting_review_chapter WHERE meeting_id =? `
  93. _, err = o.Raw(sql, reviewId).Exec()
  94. return
  95. }
  96. // 更新晨报点评章节
  97. func UpdateCygxMorningMeetingReviewChapter(item *CygxMorningMeetingReviewChapter) (err error) {
  98. o := orm.NewOrmUsingDB("hz_cygx")
  99. sql := `UPDATE cygx_morning_meeting_review_chapter
  100. SET
  101. meeting_time =?,
  102. modify_time = ?,
  103. industry_id = ?,
  104. industry_name = ?,
  105. chart_permission_id = ?,
  106. chart_permission_name = ?,
  107. industrial_subject_ids = ?,
  108. content = ?,
  109. report_link = ?,
  110. link_article_id = ?,
  111. title = ?
  112. WHERE id = ? `
  113. _, err = o.Raw(sql, item.MeetingTime, item.ModifyTime, item.IndustryId, item.IndustryName,
  114. item.ChartPermissionId, item.ChartPermissionName, item.IndustrialSubjectIds, item.Content, item.ReportLink, item.LinkArticleId, item.Title, item.Id).Exec()
  115. return
  116. }
  117. func GetCygxMorningMeetingReviewsListByIdAndIndustryId(meetingId, industryId int) (item *CygxMorningMeetingReviewChapter, err error) {
  118. o := orm.NewOrmUsingDB("hz_cygx")
  119. sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE meeting_id = ? AND industry_id = ? `
  120. err = o.Raw(sql, meetingId, industryId).QueryRow(&item)
  121. return
  122. }
  123. // 删除晨会点评章节
  124. func DeleteMorningMeetingChapterById(chapterId int) (err error) {
  125. o := orm.NewOrmUsingDB("hz_cygx")
  126. sql := ` DELETE FROM cygx_morning_meeting_review_chapter WHERE id =? `
  127. _, err = o.Raw(sql, chapterId).Exec()
  128. return
  129. }
  130. type CygxMorningMeetingGather struct {
  131. Id int `orm:"column(id);pk"`
  132. MeetingIds string `description:"主表ID多个用 , 隔开"`
  133. PublishTime string `description:"发布日期"`
  134. CreateTime time.Time `description:"创建时间"`
  135. ModifyTime time.Time `description:"更新时间"`
  136. Title string `description:"标题"`
  137. Status int `description:"0:未发布,1:已发布"`
  138. }
  139. // 列表
  140. func GetCygxMorningMeetingGatherList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxMorningMeetingGather, err error) {
  141. o := orm.NewOrmUsingDB("hz_cygx")
  142. sql := `SELECT * FROM cygx_morning_meeting_gather WHERE 1=1 `
  143. if condition != "" {
  144. sql += condition
  145. }
  146. sql += ` LIMIT ?,? `
  147. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  148. return
  149. }
  150. // 更改
  151. func UpdateCygxMorningMeetingGather(meetingIds string, meetingGatherId int) (err error) {
  152. o := orm.NewOrmUsingDB("hz_cygx")
  153. sql := ` UPDATE cygx_morning_meeting_gather SET meeting_ids=? WHERE id =? `
  154. _, err = o.Raw(sql, meetingIds, meetingGatherId).Exec()
  155. return
  156. }
  157. // 详情
  158. func GetCygxMorningMeetingReviewChapterDetail(meetingGatherId int) (item *CygxMorningMeetingReviewChapter, err error) {
  159. o := orm.NewOrmUsingDB("hz_cygx")
  160. sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE id= ? `
  161. err = o.Raw(sql, meetingGatherId).QueryRow(&item)
  162. return
  163. }
  164. // 获取数量
  165. func GetCygxMorningMeetingReviewChapterCount(cid int) (count int, err error) {
  166. o := orm.NewOrmUsingDB("hz_cygx")
  167. sqlCount := ` SELECT
  168. COUNT( 1 ) AS count
  169. FROM
  170. cygx_morning_meeting_review_chapter AS c
  171. INNER JOIN cygx_morning_meeting_reviews AS a ON a.id = c.meeting_id
  172. WHERE
  173. 1 = 1
  174. AND c.id = ?
  175. AND a.STATUS = 1`
  176. err = o.Raw(sqlCount, cid).QueryRow(&count)
  177. return
  178. }