price_driven.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package yb
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // PriceDriven 价格驱动表
  7. type PriceDriven struct {
  8. PriceDrivenId int `orm:"column(price_driven_id);pk" description:"价格驱动ID"`
  9. //ChartPermissionId int `json:"chart_permission_id" description:"品种权限ID"`
  10. VarietyTagId int `json:"variety_tag_id" description:"标签ID"`
  11. VarietyTagName string `json:"variety_tag_name" description:"标签名称"`
  12. MainVariable string `json:"main_variable" description:"关键变量"`
  13. CoreDrivenType int `json:"core_driven_type" description:"核心驱动类型 0-多 1-空"`
  14. CoreDrivenContent string `json:"core_driven_content" description:"核心驱动内容"`
  15. CoreContent string `json:"core_content" description:"核心内容"`
  16. LastUpdateAdminId int `json:"last_update_admin_id" description:"最后更新人ID"`
  17. LastUpdateAdminName string `json:"last_update_admin_name" description:"最后更新人名称"`
  18. ThsMsgState int `json:"ths_msg_state" description:"同花顺推送状态:0-未推送 1-已推送"`
  19. TemplateMsgState int `json:"template_msg_state" description:"模板消息推送状态:0-未推送 1-已推送"`
  20. PublishState int `json:"publish_state" description:"发布状态:0-未发布 1-已发布"`
  21. SendThsMsgTime time.Time `json:"last_ths_msg_time" description:"最后推送同花顺客群消息时间"`
  22. SendTemplateMsgTime time.Time `json:"last_template_msg_time" description:"最后推送模板消息时间"`
  23. CreateTime time.Time `json:"create_time" description:"创建时间"`
  24. ModifyTime time.Time `json:"modify_time" description:"更新时间"`
  25. }
  26. // TableName 表名变更
  27. func (priceDrivenInfo *PriceDriven) TableName() string {
  28. return "yb_price_driven"
  29. }
  30. // Add 新增
  31. func (priceDrivenInfo *PriceDriven) Add() (err error) {
  32. o := orm.NewOrmUsingDB("weekly")
  33. id, err := o.Insert(priceDrivenInfo)
  34. if err != nil {
  35. return
  36. }
  37. priceDrivenInfo.PriceDrivenId = int(id)
  38. return
  39. }
  40. // Update 更新
  41. func (priceDrivenInfo *PriceDriven) Update(cols []string) (err error) {
  42. o := orm.NewOrmUsingDB("weekly")
  43. _, err = o.Update(priceDrivenInfo, cols...)
  44. return
  45. }
  46. // PriceDrivenSaveLog 价格驱动保存记录表
  47. type PriceDrivenSaveLog struct {
  48. Id int `orm:"column(id);pk"`
  49. PriceDrivenId int `json:"price_driven_id" description:"价格驱动ID"`
  50. //ChartPermissionId int `json:"chart_permission_id" description:"品种权限ID"`
  51. VarietyTagId int `json:"variety_tag_id" description:"标签ID"`
  52. MainVariable string `json:"main_variable" description:"关键变量"`
  53. CoreDrivenType int `json:"core_driven_type" description:"核心驱动类型 0-多 1-空"`
  54. CoreDrivenContent string `json:"core_driven_content" description:"核心驱动内容"`
  55. CoreContent string `json:"core_content" description:"核心内容"`
  56. AdminId int `json:"admin_id" description:"更新人ID"`
  57. AdminName string `json:"admin_name" description:"更新人名称"`
  58. CreateTime time.Time `json:"create_time" description:"创建时间"`
  59. }
  60. // TableName 表名变更
  61. func (priceDrivenSaveLogInfo *PriceDrivenSaveLog) TableName() string {
  62. return "yb_price_driven_save_log"
  63. }
  64. // Add 新增保存记录
  65. func (priceDrivenSaveLogInfo *PriceDrivenSaveLog) Add() (err error) {
  66. o := orm.NewOrmUsingDB("weekly")
  67. lastId, err := o.Insert(priceDrivenSaveLogInfo)
  68. if err != nil {
  69. return
  70. }
  71. priceDrivenSaveLogInfo.PriceDrivenId = int(lastId)
  72. return
  73. }