123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package yb
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- // PriceDriven 价格驱动表
- type PriceDriven struct {
- PriceDrivenId int `orm:"column(price_driven_id);pk" description:"价格驱动ID"`
- //ChartPermissionId int `json:"chart_permission_id" description:"品种权限ID"`
- VarietyTagId int `json:"variety_tag_id" description:"标签ID"`
- VarietyTagName string `json:"variety_tag_name" description:"标签名称"`
- MainVariable string `json:"main_variable" description:"关键变量"`
- CoreDrivenType int `json:"core_driven_type" description:"核心驱动类型 0-多 1-空"`
- CoreDrivenContent string `json:"core_driven_content" description:"核心驱动内容"`
- CoreContent string `json:"core_content" description:"核心内容"`
- LastUpdateAdminId int `json:"last_update_admin_id" description:"最后更新人ID"`
- LastUpdateAdminName string `json:"last_update_admin_name" description:"最后更新人名称"`
- LastThsMsgTime time.Time `json:"last_ths_msg_time" description:"最后推送同花顺客群消息时间"`
- LastTemplateMsgTime time.Time `json:"last_template_msg_time" description:"最后推送模板消息时间"`
- CreateTime time.Time `json:"create_time" description:"创建时间"`
- ModifyTime time.Time `json:"modify_time" description:"更新时间"`
- }
- // TableName 表名变更
- func (priceDrivenInfo *PriceDriven) TableName() string {
- return "yb_price_driven"
- }
- // Add 新增
- func (priceDrivenInfo *PriceDriven) Add() (err error) {
- o := orm.NewOrm()
- id, err := o.Insert(priceDrivenInfo)
- if err != nil {
- return
- }
- priceDrivenInfo.PriceDrivenId = int(id)
- return
- }
- // Update 更新
- func (priceDrivenInfo *PriceDriven) Update(cols []string) (err error) {
- o := orm.NewOrm()
- _, err = o.Update(priceDrivenInfo, cols...)
- return
- }
- // GetPriceDrivenByChartPermissionId 通过品种获取价格驱动
- func GetPriceDrivenByChartPermissionId(chartPermissionId int) (item *PriceDriven, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM yb_price_driven WHERE chart_permission_id = ? LIMIT 1`
- err = o.Raw(sql, chartPermissionId).QueryRow(&item)
- return
- }
- // GetPriceDrivenById 主键获取价格驱动
- func GetPriceDrivenById(priceDrivenId int) (item *PriceDriven, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM yb_price_driven WHERE price_driven_id = ? LIMIT 1`
- err = o.Raw(sql, priceDrivenId).QueryRow(&item)
- return
- }
|