|
@@ -1,60 +1,111 @@
|
|
|
package ppt_english
|
|
|
|
|
|
import (
|
|
|
+ "eta_gn/eta_api/global"
|
|
|
+ "eta_gn/eta_api/utils"
|
|
|
+ "fmt"
|
|
|
"time"
|
|
|
|
|
|
- "github.com/beego/beego/v2/client/orm"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
)
|
|
|
|
|
|
// PptEnglish 表
|
|
|
+//type PptEnglish struct {
|
|
|
+// PptId int `orm:"column(ppt_id);pk;auto" description:"ppt的Id"`
|
|
|
+// TemplateType int `description:"模版类型"`
|
|
|
+// BackgroundImg string `description:"背景图片"`
|
|
|
+// Title string `description:"标题"`
|
|
|
+// ReportType string `description:"报告类型"`
|
|
|
+// PptDate string `description:"选择日期"`
|
|
|
+// Content string `description:"ppt内容"`
|
|
|
+// PptxUrl string `description:"pptx下载地址"`
|
|
|
+// CreateTime time.Time `description:"创建时间"`
|
|
|
+// ModifyTime time.Time `description:"修改时间"`
|
|
|
+// AdminId int `description:"系统用户id"`
|
|
|
+// AdminRealName string `description:"系统用户名称"`
|
|
|
+// ReportId int `description:"关联的报告ID"`
|
|
|
+// ReportCode string `description:"关联的报告code"`
|
|
|
+// IsShare int8 `description:"是否分享,0:不分享,1:分享"`
|
|
|
+// PublishTime time.Time `description:"发布时间"`
|
|
|
+// CoverContent string `description:"PPT内容-JSON"`
|
|
|
+// PptPage int `description:"PPT页数"`
|
|
|
+// TitleSetting string `description:"PPT标题设置"`
|
|
|
+//}
|
|
|
+
|
|
|
type PptEnglish struct {
|
|
|
- PptId int `orm:"column(ppt_id);pk;auto" description:"ppt的Id"`
|
|
|
- TemplateType int `description:"模版类型"`
|
|
|
- BackgroundImg string `description:"背景图片"`
|
|
|
- Title string `description:"标题"`
|
|
|
- ReportType string `description:"报告类型"`
|
|
|
- PptDate string `description:"选择日期"`
|
|
|
- Content string `description:"ppt内容"`
|
|
|
- PptxUrl string `description:"pptx下载地址"`
|
|
|
- CreateTime time.Time `description:"创建时间"`
|
|
|
- ModifyTime time.Time `description:"修改时间"`
|
|
|
- AdminId int `description:"系统用户id"`
|
|
|
- AdminRealName string `description:"系统用户名称"`
|
|
|
- ReportId int `description:"关联的报告ID"`
|
|
|
- ReportCode string `description:"关联的报告code"`
|
|
|
- IsShare int8 `description:"是否分享,0:不分享,1:分享"`
|
|
|
- PublishTime time.Time `description:"发布时间"`
|
|
|
- CoverContent string `description:"PPT内容-JSON"`
|
|
|
- PptPage int `description:"PPT页数"`
|
|
|
- TitleSetting string `description:"PPT标题设置"`
|
|
|
-}
|
|
|
+ PptId int `gorm:"primaryKey;column:ppt_id;type:int(11) unsigned;not null"`
|
|
|
+ TemplateType int `gorm:"column:template_type;type:int(9) unsigned;default:1"` // 模板类型
|
|
|
+ BackgroundImg string `gorm:"column:background_img;type:varchar(255);default:''"` // 背景图
|
|
|
+ Title string `gorm:"index:idx_title;column:title;type:varchar(255);default:''"` // 标题
|
|
|
+ ReportType string `gorm:"column:report_type;type:varchar(50);default:''"` // 报告类型
|
|
|
+ PptDate string `gorm:"column:ppt_date;type:varchar(20);default:''"` // 选择日期
|
|
|
+ PptUrl string `gorm:"column:ppt_url;type:varchar(255);default:''"` // ppt地址
|
|
|
+ PptxUrl string `gorm:"column:pptx_url;type:varchar(255);default:''"` // pptx地址
|
|
|
+ Content string `gorm:"column:content;type:mediumtext"` // ppt内容
|
|
|
+ CreateTime time.Time `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP"` // 创建时间
|
|
|
+ ModifyTime time.Time `gorm:"column:modify_time;type:datetime;default:CURRENT_TIMESTAMP"` // 修改时间
|
|
|
+ AdminId int `gorm:"column:admin_id;type:int(11) unsigned;default:0"` // 系统用户id
|
|
|
+ AdminRealName string `gorm:"index:idx_admin_real_name;column:admin_real_name;type:varchar(100);default:''"` // 系统用户名称
|
|
|
+ PptVersion uint8 `gorm:"column:ppt_version;type:tinyint(9) unsigned;default:2"` // 是否ppt的旧版本;1:旧的,2:新的
|
|
|
+ ReportId int `gorm:"column:report_id;type:int(10) unsigned;not null;default:0"` // 关联的报告ID
|
|
|
+ ReportCode string `gorm:"column:report_code;type:varchar(255);not null;default:''"` // 关联的报告code
|
|
|
+ IsShare int8 `gorm:"column:is_share;type:tinyint(9) unsigned;default:0"` // 是否分享,0:不分享,1:分享
|
|
|
+ PublishTime time.Time `gorm:"column:publish_time;type:datetime"` // 发布时间
|
|
|
+ CoverContent string `gorm:"column:cover_content;type:text"` // 封面内容-JSON
|
|
|
+ PptPage int `gorm:"column:ppt_page;type:int(10)"` // PPT总页数
|
|
|
+ TitleSetting string `gorm:"column:title_setting;type:varchar(255);default:''"` // 标题设置
|
|
|
+}
|
|
|
+
|
|
|
+//type PptEnglishItem struct {
|
|
|
+// PptId int `orm:"column(ppt_id);pk" description:"ppt的Id"`
|
|
|
+// TemplateType int `description:"模版类型"`
|
|
|
+// BackgroundImg string `description:"背景图片"`
|
|
|
+// Title string `description:"标题"`
|
|
|
+// ReportType string `description:"报告类型"`
|
|
|
+// PptDate string `description:"选择日期"`
|
|
|
+// Content string `description:"ppt内容"`
|
|
|
+// PptxUrl string `description:"pptx下载地址"`
|
|
|
+// CreateTime time.Time `description:"创建时间"`
|
|
|
+// ModifyTime time.Time `description:"修改时间"`
|
|
|
+// AdminId int `description:"系统用户id"`
|
|
|
+// AdminRealName string `description:"系统用户名称"`
|
|
|
+// IsAuth bool `description:"true:有操作权限,false:无操作权限"`
|
|
|
+// ReportId int `description:"报告ID"`
|
|
|
+// ReportCode string `description:"关联的报告code"`
|
|
|
+// IsShare int8 `description:"是否分享,0:不分享,1:分享"`
|
|
|
+// PublishTime time.Time `description:"发布时间"`
|
|
|
+// CoverContent string `description:"PPT内容-JSON"`
|
|
|
+// PptPage int `description:"PPT页数"`
|
|
|
+// TitleSetting string `description:"PPT标题设置"`
|
|
|
+//}
|
|
|
|
|
|
type PptEnglishItem struct {
|
|
|
- PptId int `orm:"column(ppt_id);pk" gorm:"primaryKey" description:"ppt的Id"`
|
|
|
- TemplateType int `description:"模版类型"`
|
|
|
- BackgroundImg string `description:"背景图片"`
|
|
|
- Title string `description:"标题"`
|
|
|
- ReportType string `description:"报告类型"`
|
|
|
- PptDate string `description:"选择日期"`
|
|
|
- Content string `description:"ppt内容"`
|
|
|
- PptxUrl string `description:"pptx下载地址"`
|
|
|
- CreateTime time.Time `description:"创建时间"`
|
|
|
- ModifyTime time.Time `description:"修改时间"`
|
|
|
- AdminId int `description:"系统用户id"`
|
|
|
- AdminRealName string `description:"系统用户名称"`
|
|
|
- IsAuth bool `description:"true:有操作权限,false:无操作权限"`
|
|
|
- ReportId int `description:"报告ID"`
|
|
|
- ReportCode string `description:"关联的报告code"`
|
|
|
- IsShare int8 `description:"是否分享,0:不分享,1:分享"`
|
|
|
- PublishTime time.Time `description:"发布时间"`
|
|
|
- CoverContent string `description:"PPT内容-JSON"`
|
|
|
- PptPage int `description:"PPT页数"`
|
|
|
- TitleSetting string `description:"PPT标题设置"`
|
|
|
+ PptId int `gorm:"primaryKey;column:ppt_id;type:int(11) unsigned;not null"`
|
|
|
+ TemplateType int `gorm:"column:template_type;type:int(9) unsigned;default:1"` // 模板类型
|
|
|
+ BackgroundImg string `gorm:"column:background_img;type:varchar(255);default:''"` // 背景图
|
|
|
+ Title string `gorm:"index:idx_title;column:title;type:varchar(255);default:''"` // 标题
|
|
|
+ ReportType string `gorm:"column:report_type;type:varchar(50);default:''"` // 报告类型
|
|
|
+ PptDate string `gorm:"column:ppt_date;type:varchar(20);default:''"` // 选择日期
|
|
|
+ PptUrl string `gorm:"column:ppt_url;type:varchar(255);default:''"` // ppt地址
|
|
|
+ PptxUrl string `gorm:"column:pptx_url;type:varchar(255);default:''"` // pptx地址
|
|
|
+ Content string `gorm:"column:content;type:mediumtext"` // ppt内容
|
|
|
+ CreateTime time.Time `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP"` // 创建时间
|
|
|
+ ModifyTime time.Time `gorm:"column:modify_time;type:datetime;default:CURRENT_TIMESTAMP"` // 修改时间
|
|
|
+ AdminId int `gorm:"column:admin_id;type:int(11) unsigned;default:0"` // 系统用户id
|
|
|
+ AdminRealName string `gorm:"index:idx_admin_real_name;column:admin_real_name;type:varchar(100);default:''"` // 系统用户名称
|
|
|
+ PptVersion uint8 `gorm:"column:ppt_version;type:tinyint(9) unsigned;default:2"` // 是否ppt的旧版本;1:旧的,2:新的
|
|
|
+ ReportId int `gorm:"column:report_id;type:int(10) unsigned;not null;default:0"` // 关联的报告ID
|
|
|
+ ReportCode string `gorm:"column:report_code;type:varchar(255);not null;default:''"` // 关联的报告code
|
|
|
+ IsShare int8 `gorm:"column:is_share;type:tinyint(9) unsigned;default:0"` // 是否分享,0:不分享,1:分享
|
|
|
+ PublishTime time.Time `gorm:"column:publish_time;type:datetime"` // 发布时间
|
|
|
+ CoverContent string `gorm:"column:cover_content;type:text"` // 封面内容-JSON
|
|
|
+ PptPage int `gorm:"column:ppt_page;type:int(10)"` // PPT总页数
|
|
|
+ TitleSetting string `gorm:"column:title_setting;type:varchar(255);default:''"` // 标题设置
|
|
|
+ IsAuth bool `gorm:"-" description:"true:有操作权限,false:无操作权限"`
|
|
|
}
|
|
|
|
|
|
func GetPptEnglishList(condition string, pars []interface{}, startSize, pageSize int) (items []*PptEnglishItem, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM ppt_english WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
@@ -62,12 +113,13 @@ func GetPptEnglishList(condition string, pars []interface{}, startSize, pageSize
|
|
|
//
|
|
|
sql += `ORDER BY modify_time DESC LIMIT ?,?`
|
|
|
//sql += `ORDER BY create_time DESC LIMIT ?,?`
|
|
|
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+ //_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, pars, startSize, pageSize).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func GetPptEnglishByCondition(condition string, pars []interface{}) (items []*PptEnglish, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM ppt_english WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
@@ -75,17 +127,19 @@ func GetPptEnglishByCondition(condition string, pars []interface{}) (items []*Pp
|
|
|
//
|
|
|
sql += `ORDER BY modify_time DESC`
|
|
|
//sql += `ORDER BY create_time DESC LIMIT ?,?`
|
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ //_, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, pars).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func GetPptEnglishListCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT COUNT(1) AS count FROM ppt_english WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
|
}
|
|
|
- err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
+ //err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, pars).Scan(&count).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -96,16 +150,19 @@ type PptEnglishListResp struct {
|
|
|
|
|
|
// AddPptEnglish 新增PPT
|
|
|
func AddPptEnglish(item *PptEnglish) (lastId int64, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- lastId, err = o.Insert(item)
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //lastId, err = o.Insert(item)
|
|
|
+ err = global.DmSQL["rddp"].Create(item).Error
|
|
|
+ lastId = int64(item.PptId)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// DeletePptEnglish 删除ppt
|
|
|
func DeletePptEnglish(pptId int) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `DELETE FROM ppt_english WHERE ppt_id=? `
|
|
|
- _, err = o.Raw(sql, pptId).Exec()
|
|
|
+ //_, err = o.Raw(sql, pptId).Exec()
|
|
|
+ err = global.DmSQL["rddp"].Exec(sql, pptId).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -152,18 +209,20 @@ type EditPptEnglishReq struct {
|
|
|
|
|
|
// Update 更新ppt基础信息
|
|
|
func (item *PptEnglish) Update(cols []string) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- _, err = o.Update(item, cols...)
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //_, err = o.Update(item, cols...)
|
|
|
+ err = global.DmSQL["rddp"].Select(cols).Updates(item).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// EditPptEnglish 编辑ppt
|
|
|
-func EditPptEnglish(item *PptEnglish) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `UPDATE ppt_english SET title = ?,ppt_date= ?, report_type=?,modify_time=NOW() WHERE ppt_id = ? `
|
|
|
- _, err = o.Raw(sql, item.Title, item.PptDate, item.ReportType, item.PptId).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
+//func EditPptEnglish(item *PptEnglish) (err error) {
|
|
|
+// //o := orm.NewOrmUsingDB("rddp")
|
|
|
+// sql := `UPDATE ppt_english SET title = ?,ppt_date= ?, report_type=?,modify_time=NOW() WHERE ppt_id = ? `
|
|
|
+// //_, err = o.Raw(sql, item.Title, item.PptDate, item.ReportType, item.PptId).Exec()
|
|
|
+// err = global.DmSQL["rddp"].Exec(sql, item.Title, item.PptDate, item.ReportType, item.PptId).Error
|
|
|
+// return
|
|
|
+//}
|
|
|
|
|
|
type DeletePptEnglishReq struct {
|
|
|
PptId int `description:"PptId" `
|
|
@@ -176,29 +235,35 @@ type SavePptEnglishPathReq struct {
|
|
|
}
|
|
|
|
|
|
func GetPptEnglishById(pptId int) (item *PptEnglish, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM ppt_english WHERE 1=1 AND ppt_id=? `
|
|
|
- err = o.Raw(sql, pptId).QueryRow(&item)
|
|
|
+ //err = o.Raw(sql, pptId).QueryRow(&item)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, pptId).First(&item).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func GetPptEnglishByIds(pptIds []int) (list []*PptEnglish, err error) {
|
|
|
- _, err = orm.NewOrmUsingDB("rddp").
|
|
|
- QueryTable("ppt_english").
|
|
|
- Filter("ppt_id__in", pptIds).
|
|
|
- All(&list)
|
|
|
+ //_, err = orm.NewOrmUsingDB("rddp").
|
|
|
+ // QueryTable("ppt_english").
|
|
|
+ // Filter("ppt_id__in", pptIds).
|
|
|
+ // All(&list)
|
|
|
+ if len(pptIds) == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sql := fmt.Sprintf(`SELECT * FROM ppt_english WHERE ppt_id IN (%s)`, utils.GetOrmInReplace(len(pptIds)))
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, pptIds).Find(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetPptEnglishByTitle(title string) (item *PptEnglish, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT * FROM ppt_english WHERE 1=1 AND title=? `
|
|
|
- err = o.Raw(sql, title).QueryRow(&item)
|
|
|
- return
|
|
|
-}
|
|
|
+//func GetPptEnglishByTitle(title string) (item *PptEnglish, err error) {
|
|
|
+// o := orm.NewOrmUsingDB("rddp")
|
|
|
+// sql := `SELECT * FROM ppt_english WHERE 1=1 AND title=? `
|
|
|
+// err = o.Raw(sql, title).QueryRow(&item)
|
|
|
+// return
|
|
|
+//}
|
|
|
|
|
|
type PptPages struct {
|
|
|
- PptPagesId int `orm:"column(ppt_pages_id);pk" gorm:"primaryKey" description:"报告章节Id"`
|
|
|
+ PptPagesId int `orm:"column(ppt_pages_id);pk" description:"报告章节Id"`
|
|
|
PptId int64 `description:"ppt_id"`
|
|
|
Title string `description:"标题"`
|
|
|
ImgUrl string `description:"图片路径"`
|
|
@@ -225,47 +290,75 @@ type PptEnglishPublishReq struct {
|
|
|
// EditPptEnglishPath 编辑Ppt的下载地址
|
|
|
func EditPptEnglishPath(pptId int, pptxPath string) (err error) {
|
|
|
sql := `UPDATE ppt_english SET pptx_url=?,modify_time=NOW(),publish_time=NOW() WHERE ppt_id=? `
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- _, err = o.Raw(sql, pptxPath, pptId).Exec()
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //_, err = o.Raw(sql, pptxPath, pptId).Exec()
|
|
|
+ err = global.DmSQL["rddp"].Exec(sql, pptxPath, pptId).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// AddPptEnglishPublishRecord 发布记录表
|
|
|
+// PptEnglishPublishRecord 发布记录表
|
|
|
+//type PptEnglishPublishRecord struct {
|
|
|
+// Id int `orm:"column(id);pk"`
|
|
|
+// PptId int
|
|
|
+// PptUrl string
|
|
|
+// CreateTime time.Time
|
|
|
+//}
|
|
|
+
|
|
|
type PptEnglishPublishRecord struct {
|
|
|
- Id int `orm:"column(id);pk" gorm:"primaryKey" `
|
|
|
- PptId int
|
|
|
- PptUrl string
|
|
|
- CreateTime time.Time
|
|
|
+ Id int `gorm:"primaryKey;column:id;type:int(11);not null"`
|
|
|
+ PptId int `gorm:"column:ppt_id;type:int(11)"` // 英文ppt id
|
|
|
+ PptUrl string `gorm:"column:ppt_url;type:varchar(255)"` // Ppt下载地址
|
|
|
+ CreateTime time.Time `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP"` // 创建时间
|
|
|
}
|
|
|
|
|
|
// AddPptEnglishPublishRecord 添加发布记录,主要是记录每次发布的时候,当前的ppt
|
|
|
func AddPptEnglishPublishRecord(item *PptEnglishPublishRecord) (lastId int64, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- lastId, err = o.Insert(item)
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //lastId, err = o.Insert(item)
|
|
|
+ err = global.DmSQL["rddp"].Create(item).Error
|
|
|
+ lastId = int64(item.Id)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// PptEnglishSaveLog ppt记录表
|
|
|
+//type PptEnglishSaveLog struct {
|
|
|
+// Id int `orm:"column(id);pk" description:"自增Id"`
|
|
|
+// PptId int `orm:"column(ppt_id)" description:"ppt的Id"`
|
|
|
+// TemplateType int `description:"模版类型"`
|
|
|
+// BackgroundImg string `description:"背景图片"`
|
|
|
+// Title string `description:"标题"`
|
|
|
+// ReportType string `description:"报告类型"`
|
|
|
+// PptDate string `description:"选择日期"`
|
|
|
+// Content string `description:"ppt内容"`
|
|
|
+// AdminId int `description:"系统用户id"`
|
|
|
+// AdminRealName string `description:"系统用户名称"`
|
|
|
+// CreateTime time.Time `description:"创建时间"`
|
|
|
+// CoverContent string `description:"PPT内容-JSON"`
|
|
|
+// TitleSetting string `description:"PPT标题设置"`
|
|
|
+//}
|
|
|
+
|
|
|
type PptEnglishSaveLog struct {
|
|
|
- Id int `orm:"column(id);pk" gorm:"primaryKey" description:"自增Id"`
|
|
|
- PptId int `orm:"column(ppt_id)" description:"ppt的Id"`
|
|
|
- TemplateType int `description:"模版类型"`
|
|
|
- BackgroundImg string `description:"背景图片"`
|
|
|
- Title string `description:"标题"`
|
|
|
- ReportType string `description:"报告类型"`
|
|
|
- PptDate string `description:"选择日期"`
|
|
|
- Content string `description:"ppt内容"`
|
|
|
- AdminId int `description:"系统用户id"`
|
|
|
- AdminRealName string `description:"系统用户名称"`
|
|
|
- CreateTime time.Time `description:"创建时间"`
|
|
|
- CoverContent string `description:"PPT内容-JSON"`
|
|
|
- TitleSetting string `description:"PPT标题设置"`
|
|
|
+ Id int `gorm:"primaryKey;column:id;type:int(11);not null"` // 主键Id
|
|
|
+ PptId int `gorm:"index:idx_ppt_id;column:ppt_id;type:int(11);not null"` // ppt Id
|
|
|
+ TemplateType int `gorm:"column:template_type;type:int(9) unsigned;not null;default:0"` // 模板类型
|
|
|
+ BackgroundImg string `gorm:"column:background_img;type:varchar(255);not null;default:''"` // 背景图
|
|
|
+ Title string `gorm:"column:title;type:varchar(255);not null;default:''"` // 标题
|
|
|
+ ReportType string `gorm:"column:report_type;type:varchar(50);not null;default:''"` // 报告类型
|
|
|
+ PptDate string `gorm:"column:ppt_date;type:varchar(20);not null;default:''"` // 选择日期
|
|
|
+ Content string `gorm:"column:content;type:mediumtext"` // ppt内容
|
|
|
+ AdminId int `gorm:"column:admin_id;type:int(9) unsigned;default:0"` // 操作人id
|
|
|
+ AdminRealName string `gorm:"column:admin_real_name;type:varchar(64);default:''"` // 操作人姓名
|
|
|
+ CreateTime time.Time `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP"` // 创建时间
|
|
|
+ CoverContent string `gorm:"column:cover_content;type:text"` // 封面内容-JSON
|
|
|
+ TitleSetting string `gorm:"column:title_setting;type:varchar(255);default:''"` // 标题设置
|
|
|
}
|
|
|
|
|
|
// AddPptEnglishSaveLog 新增PPT日志
|
|
|
func AddPptEnglishSaveLog(item *PptEnglishSaveLog) (lastId int64, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- lastId, err = o.Insert(item)
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //lastId, err = o.Insert(item)
|
|
|
+ err = global.DmSQL["rddp"].Create(item).Error
|
|
|
+ lastId = int64(item.Id)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -282,16 +375,18 @@ type PPT2ReportReq struct {
|
|
|
|
|
|
// AddPptEnglishMulti 批量新增ppt
|
|
|
func AddPptEnglishMulti(list []*PptEnglish) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- _, err = o.InsertMulti(1, list)
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //_, err = o.InsertMulti(1, list)
|
|
|
+ err = global.DmSQL["rddp"].CreateInBatches(list, utils.MultiAddNum).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// GetAllPptTitle 获取当前目录的所有名称
|
|
|
func GetAllPptTitle() (names []string, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := "select title from ppt_english"
|
|
|
- _, err = o.Raw(sql).QueryRows(&names)
|
|
|
+ //_, err = o.Raw(sql).QueryRows(&names)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql).Scan(&names).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -303,46 +398,50 @@ type PPT2ReportResp struct {
|
|
|
|
|
|
// GetPptEnglishByReportId 通过关联的报告ID获取PPT
|
|
|
func GetPptEnglishByReportId(reportId int) (item *PptEnglish, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM ppt_english WHERE 1=1 AND report_id=? LIMIT 1`
|
|
|
- err = o.Raw(sql, reportId).QueryRow(&item)
|
|
|
+ //err = o.Raw(sql, reportId).QueryRow(&item)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, reportId).First(&item).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// GetSharePptEnglish 获取公开分享的ppt
|
|
|
func GetSharePptEnglish() (items []*PptEnglish, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM ppt_english WHERE 1=1 AND is_share = 1 ORDER BY create_time DESC `
|
|
|
- _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ //_, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// GetAllPptEnglishList 根据条件获取所有的Ppt
|
|
|
func GetAllPptEnglishList(condition string, pars []interface{}) (items []*PptEnglishItem, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM ppt_english WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
|
}
|
|
|
//
|
|
|
sql += `ORDER BY modify_time DESC `
|
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ //_, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, pars).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// GetSyncReportPptList 获取所有已经同步了报告的ppt
|
|
|
-func GetSyncReportPptList() (list []*PptEnglish, err error) {
|
|
|
- sql := `SELECT * FROM ppt_english WHERE report_id>0 `
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- _, err = o.Raw(sql).QueryRows(&list)
|
|
|
- return
|
|
|
-}
|
|
|
+//func GetSyncReportPptList() (list []*PptEnglish, err error) {
|
|
|
+// sql := `SELECT * FROM ppt_english WHERE report_id>0 `
|
|
|
+// o := orm.NewOrmUsingDB("rddp")
|
|
|
+// _, err = o.Raw(sql).QueryRows(&list)
|
|
|
+// return
|
|
|
+//}
|
|
|
|
|
|
// GetPPTTitleList 获取PPT标题列表
|
|
|
func GetPPTTitleList() (list []string, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT title FROM ppt_english`
|
|
|
- _, err = o.Raw(sql).QueryRows(&list)
|
|
|
+ //_, err = o.Raw(sql).QueryRows(&list)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql).Scan(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -356,9 +455,10 @@ type EnglishPPT2ReportReq struct {
|
|
|
}
|
|
|
|
|
|
func GetPptEnglishByTitleAndId(title string, adminId int) (item *PptEnglish, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
+ //o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM ppt_english WHERE 1=1 AND title=? AND admin_id=? `
|
|
|
- err = o.Raw(sql, title, adminId).QueryRow(&item)
|
|
|
+ //err = o.Raw(sql, title, adminId).QueryRow(&item)
|
|
|
+ err = global.DmSQL["rddp"].Raw(sql, title, adminId).First(&item).Error
|
|
|
return
|
|
|
}
|
|
|
|