ziwen 1 an în urmă
părinte
comite
59099ac5bc
3 a modificat fișierele cu 0 adăugiri și 178 ștergeri
  1. 0 109
      models/report_author.go
  2. 0 43
      models/report_ppt_img.go
  3. 0 26
      models/report_view_record.go

+ 0 - 109
models/report_author.go

@@ -1,109 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-	"github.com/rdlucklib/rdluck_tools/paging"
-	"time"
-)
-
-type ReportAuthor struct {
-	Id           int       `orm:"column(id)" description:"报告作者ID"`
-	ReportAuthor string    `description:"报告作者名称"`
-	AuthorType   int       `description:"类型,1:中文;2:英文"`
-	Enable       int       `description:"是否启用,0:禁用,1:启用"`
-	IsDelete     int       `description:"是否删除,0:未删除,1:已删除"`
-	CreateTime   time.Time `description:"创建时间"`
-	ModifyTime   time.Time `description:"更新时间"`
-}
-
-// GetReportAuthorList 获取报告作者列表
-func GetReportAuthorList(condition string, pars []interface{}, startSize, pageSize int) (total int, items []*ReportAuthor, err error) {
-	o := orm.NewOrmUsingDB("rddp")
-	baseSql := `  report_author WHERE is_delete=0 `
-	if condition != "" {
-		baseSql += condition
-	}
-
-	totalSql := ` SELECT count(1) total FROM ` + baseSql
-	err = o.Raw(totalSql, pars).QueryRow(&total)
-	if err != nil {
-		return
-	}
-
-	sql := ` SELECT * FROM ` + baseSql + ` ORDER BY id desc LIMIT ?,? `
-	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-	return
-}
-
-// GetReportAuthorCount 获取报告作者列表数
-func GetReportAuthorCount(condition string, pars []interface{}) (total int, err error) {
-	o := orm.NewOrmUsingDB("rddp")
-
-	totalSql := ` SELECT count(1) total FROM report_author WHERE 1=1 `
-	if condition != "" {
-		totalSql += condition
-	}
-	err = o.Raw(totalSql, pars).QueryRow(&total)
-	return
-}
-
-type ReportAuthorResp struct {
-	List   []*ReportAuthor
-	Paging *paging.PagingItem `description:"分页数据"`
-}
-
-// AddReportAuthorReq 新增报告作者请求体
-type AddReportAuthorReq struct {
-	Id         int    `description:"作者id"`
-	AuthorType int    `description:"类型,1:中文;2:英文"`
-	Author     string `description:"报告作者名称"`
-}
-
-// GetReportAuthorById 根据作者id获取数据
-func GetReportAuthorById(authorId int) (item *ReportAuthor, err error) {
-	o := orm.NewOrmUsingDB("rddp")
-	sql := `SELECT * FROM report_author WHERE is_delete=0 AND id = ? `
-	err = o.Raw(sql, authorId).QueryRow(&item)
-	return
-}
-
-// GetReportAuthorByAuthor 根据作者名称获取数据
-func GetReportAuthorByAuthor(title string, authorType int) (item *ReportAuthor, err error) {
-	o := orm.NewOrmUsingDB("rddp")
-	sql := `SELECT * FROM report_author WHERE is_delete=0 AND report_author=? AND author_type = ? `
-	err = o.Raw(sql, title, authorType).QueryRow(&item)
-	return
-}
-
-// GetReportAuthorByAuthorAndId 根据作者名称和作者id获取数据
-func GetReportAuthorByAuthorAndId(title string, authorType, authorId int) (item *ReportAuthor, err error) {
-	o := orm.NewOrmUsingDB("rddp")
-	sql := `SELECT * FROM report_author WHERE is_delete=0 AND report_author=? AND author_type = ? AND id != ? `
-	err = o.Raw(sql, title, authorType, authorId).QueryRow(&item)
-	return
-}
-
-// AddReportAuthor 新增作者
-func AddReportAuthor(item *ReportAuthor) (lastId int64, err error) {
-	o := orm.NewOrmUsingDB("rddp")
-	lastId, err = o.Insert(item)
-	return
-}
-
-// Update 更新作者基础信息
-func (item *ReportAuthor) Update(cols []string) (err error) {
-	o := orm.NewOrmUsingDB("rddp")
-	_, err = o.Update(item, cols...)
-	return
-}
-
-// EnableReportAuthorReq 启用/禁用报告作者请求体
-type EnableReportAuthorReq struct {
-	Id         int `description:"作者id"`
-	EnableType int `description:"是否启用,0:禁用,1:启用"`
-}
-
-// DeleteReportAuthorReq 删除报告作者请求体
-type DeleteReportAuthorReq struct {
-	Id int `description:"作者id"`
-}

+ 0 - 43
models/report_ppt_img.go

@@ -1,43 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-	"time"
-)
-
-// ReportPptImg Ppt转报告的图片记录表
-type ReportPptImg struct {
-	ReportPptImgId  int       `orm:"column(report_ppt_img_id);pk;auto" description:"自增id"`
-	PptId           int       `description:"ppt的id"`
-	ReportId        int       `description:"关联的报告ID"`
-	ReportChapterId int       `description:"关联的报告章节ID"`
-	ImgUrl          string    `description:"ppt图片地址"`
-	CreateTime      time.Time `description:"创建时间"`
-}
-
-// AddAndEditMultiReportPptImg 批量添加Ppt转报告的图片记录
-func AddAndEditMultiReportPptImg(pptId int, reportPptImgList []*ReportPptImg) (err error) {
-	if len(reportPptImgList) < 0 {
-		return
-	}
-	o := orm.NewOrmUsingDB("rddp")
-
-	to, err := o.Begin()
-	if err != nil {
-		return
-	}
-	defer func() {
-		if err != nil {
-			_ = to.Rollback()
-		} else {
-			_ = to.Commit()
-		}
-	}()
-	sql := ` DELETE FROM report_ppt_img WHERE ppt_id = ?`
-	_, err = to.Raw(sql, pptId).Exec()
-	if err != nil {
-		return
-	}
-	_, err = to.InsertMulti(len(reportPptImgList), reportPptImgList)
-	return
-}

+ 0 - 26
models/report_view_record.go

@@ -1,26 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-	"time"
-)
-
-type ReportViewRecord struct {
-	Id          int       `orm:"column(id);pk"`
-	UserId      int       `description:"用户id"`
-	ReportId    int       `description:"报告id"`
-	Mobile      string    `description:"手机号"`
-	Email       string    `description:"邮箱"`
-	RealName    string    `description:"用户实际姓名"`
-	CompanyName string    `description:"公司名称"`
-	CreateTime  time.Time `description:"创建时间"`
-}
-
-//获取需要修复的数据列表
-func GetViewListByReportId(reportId int) (total int64, list []*ReportViewRecord, err error) {
-	o := orm.NewOrmUsingDB("rddp")
-	sql := `select * from report_view_record where report_id = ? order by id desc `
-
-	total, err = o.Raw(sql, reportId).QueryRows(&list)
-	return
-}