123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package excel
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type ReferencedExcelConfig struct {
- ReferencedExcelConfigId int `orm:"column(referenced_excel_config_id);pk;auto" ` // excel表格配置id
- UniqueCode string // 表格唯一编码
- ReferencedId int // 被引用的id,报告就是报告id,pptId
- FromScene int // 引用类型 1智能研报 2研报列表 3英文研报 4PPT 5英文ppt
- Uuid string // 引用唯一标识
- WidthList string // 宽度数组
- HeightList string // 高度数组
- OpUserId int // 当前编辑操作的用户id
- OpUserName string // 当前编辑的用户名称(冗余字段,避免查表)
- CreateTime time.Time // 创建时间
- Content string // 内容
- ModifyTime time.Time // 修改时间
- }
- type ExcelReferencesReq struct {
- UniqueCode string `description:"表格唯一编码"`
- ReferencedId int `description:"被引用的ID"`
- FromScene int `description:"引用类型 1智能研报 2研报列表 3英文研报 4PPT 5英文PPT"`
- Uuid string `description:"引用唯一标识"`
- WidthList string `description:"宽度数组"`
- HeightList string `description:"高度数组"`
- }
- // add
- func AddReferencedExcelConfig(items []*ReferencedExcelConfig) (err error) {
- o := orm.NewOrmUsingDB("data")
- _, err = o.InsertMulti(len(items), items)
- return
- }
- // getByCode
- func GetReferencedExcelConfig(referencedId, fromScene int, uniqueCode, uuid string) (item ReferencedExcelConfig, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT * FROM referenced_excel_config WHERE referenced_id = ? AND from_scene = ? AND unique_code = ? AND uuid= ? `
- err = o.Raw(sql, referencedId, fromScene, uniqueCode, uuid).QueryRow(&item)
- return
- }
- // update
- func UpdateReferencedExcelConfig(item *ReferencedExcelConfig) (err error) {
- o := orm.NewOrmUsingDB("data")
- _, err = o.Update(item, "WidthList", "HeightList", "OpUserId", "OpUserName", "ModifyTime")
- return
- }
- // delete
- func DeleteReferencedExcelConfig(uniqueCode string) (err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `DELETE FROM referenced_excel_config WHERE unique_code=? `
- _, err = o.Raw(sql, uniqueCode).Exec()
- return
- }
|