|
@@ -1,11 +1,8 @@
|
|
|
package tables
|
|
|
|
|
|
import (
|
|
|
- "errors"
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
- "hongze/hongze_open_api/utils"
|
|
|
- "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -53,19 +50,6 @@ func GetEnglishReportStage(classifyIdFirst, classifyIdSecond int) (count int, er
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetEnglishReportStageEdit(classifyIdFirst, classifyIdSecond, reportId int) (count int, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ``
|
|
|
- if classifyIdSecond > 0 {
|
|
|
- sql = "SELECT MAX(stage) AS max_stage FROM english_report WHERE classify_id_second=? AND id<>? "
|
|
|
- o.Raw(sql, classifyIdSecond, reportId).QueryRow(&count)
|
|
|
- } else {
|
|
|
- sql = "SELECT MAX(stage) AS max_stage FROM english_report WHERE classify_id_first=? AND id<>? "
|
|
|
- o.Raw(sql, classifyIdFirst, reportId).QueryRow(&count)
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
func AddEnglishReport(item *EnglishReport) (lastId int64, err error) {
|
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
|
lastId, err = o.Insert(item)
|
|
@@ -152,31 +136,6 @@ type ElasticEnglishReportDetail struct {
|
|
|
Overview string `description:"英文概述部分"`
|
|
|
}
|
|
|
|
|
|
-func EditEnglishReport(item *EnglishReport, reportId int64) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `UPDATE english_report
|
|
|
- SET
|
|
|
- classify_id_first =?,
|
|
|
- classify_name_first = ?,
|
|
|
- classify_id_second = ?,
|
|
|
- classify_name_second = ?,
|
|
|
- title = ?,
|
|
|
- abstract = ?,
|
|
|
- author = ?,
|
|
|
- frequency = ?,
|
|
|
- state = ?,
|
|
|
- content = ?,
|
|
|
- content_sub = ?,
|
|
|
- stage =?,
|
|
|
- create_time = ?,
|
|
|
- modify_time = ?,
|
|
|
- overview = ?
|
|
|
- WHERE id = ? `
|
|
|
- _, err = o.Raw(sql, item.ClassifyIdFirst, item.ClassifyNameFirst, item.ClassifyIdSecond, item.ClassifyNameSecond, item.Title,
|
|
|
- item.Abstract, item.Author, item.Frequency, item.State, item.Content, item.ContentSub, item.Stage, item.CreateTime, time.Now(), item.Overview, reportId).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
type EnglishReportDetail struct {
|
|
|
Id int `orm:"column(id)" description:"报告Id"`
|
|
|
AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|
|
@@ -206,20 +165,6 @@ type EnglishReportDetail struct {
|
|
|
KeyTakeaways string `description:"关键点"`
|
|
|
}
|
|
|
|
|
|
-func GetEnglishReportById(reportId int) (item *EnglishReportDetail, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT * FROM english_report WHERE id=?`
|
|
|
- err = o.Raw(sql, reportId).QueryRow(&item)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishReportItemById(reportId int) (item *EnglishReport, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT * FROM english_report WHERE id = ? LIMIT 1`
|
|
|
- err = o.Raw(sql, reportId).QueryRow(&item)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
type EnglishReportList struct {
|
|
|
Id int `description:"报告Id"`
|
|
|
AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|
|
@@ -258,109 +203,6 @@ type EnglishReportListResp struct {
|
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
|
}
|
|
|
|
|
|
-func GetEnglishReportListCount(condition string, pars []interface{}, companyType string) (count int, err error) {
|
|
|
- //产品权限
|
|
|
- companyTypeSqlStr := ``
|
|
|
- if companyType == "ficc" {
|
|
|
- companyTypeSqlStr = " AND classify_id_first != 40 "
|
|
|
- } else if companyType == "权益" {
|
|
|
- companyTypeSqlStr = " AND classify_id_first = 40 "
|
|
|
- }
|
|
|
-
|
|
|
- oRddp := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT COUNT(1) AS count FROM english_report WHERE 1=1 ` + companyTypeSqlStr
|
|
|
- if condition != "" {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- err = oRddp.Raw(sql, pars).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishReportList(condition string, pars []interface{}, companyType string, startSize, pageSize int) (items []*EnglishReportList, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- //产品权限
|
|
|
- companyTypeSqlStr := ``
|
|
|
- if companyType == "ficc" {
|
|
|
- companyTypeSqlStr = " AND classify_id_first != 40 "
|
|
|
- } else if companyType == "权益" {
|
|
|
- companyTypeSqlStr = " AND classify_id_first = 40 "
|
|
|
- }
|
|
|
-
|
|
|
- sql := `SELECT *
|
|
|
- FROM english_report WHERE 1=1 ` + companyTypeSqlStr
|
|
|
- if condition != "" {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- sql += `ORDER BY state ASC, modify_time DESC LIMIT ?,?`
|
|
|
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishReportByCondition(condition string, pars []interface{}) (items []*EnglishReport, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT *
|
|
|
- FROM english_report WHERE 1=1 `
|
|
|
- if condition != "" {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// 发布报告
|
|
|
-func PublishEnglishReportById(reportId int) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `UPDATE english_report SET state=2,publish_time=now(),modify_time=NOW() WHERE id = ? `
|
|
|
- _, err = o.Raw(sql, reportId).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-//取消发布报告
|
|
|
-func PublishCancelEnglishReport(reportIds int) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` UPDATE english_report SET state=1,publish_time=null WHERE id =? `
|
|
|
- _, err = o.Raw(sql, reportIds).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// DeleteEnglishReportAndChapter 删除报告及章节
|
|
|
-func DeleteEnglishReportAndChapter(reportInfo *EnglishReportDetail) (err error) {
|
|
|
- reportId := reportInfo.Id
|
|
|
- if reportInfo.State == 2 {
|
|
|
- err = errors.New("报告已发布,不可删除")
|
|
|
- return
|
|
|
- }
|
|
|
- err = DeleteEnglishReport(reportId)
|
|
|
- if err != nil {
|
|
|
- err = errors.New("删除失败, Err: " + err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-//删除报告
|
|
|
-func DeleteEnglishReport(reportIds int) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` DELETE FROM english_report WHERE id =? `
|
|
|
- _, err = o.Raw(sql, reportIds).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func EditEnglishReportContent(reportId int, content, contentSub string) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` UPDATE english_report SET content=?,content_sub=?,modify_time=NOW() WHERE id=? `
|
|
|
- _, err = o.Raw(sql, content, contentSub, reportId).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func AddEnglishReportSaveLog(reportId, adminId int, content, contentSub, adminName string) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` INSERT INTO english_report_save_log(report_id, content,content_sub,admin_id,admin_name) VALUES (?,?,?,?,?) `
|
|
|
- _, err = o.Raw(sql, reportId, content, contentSub, adminId, adminName).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
type EnglishClassifyList struct {
|
|
|
Id int `orm:"column(id);pk"`
|
|
|
ClassifyName string `description:"分类名称"`
|
|
@@ -380,86 +222,6 @@ type EnglishClassifyListResp struct {
|
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
|
}
|
|
|
|
|
|
-//获取分类列表
|
|
|
-func GetEnglishClassifyList(startSize, pageSize int, keyWord string, classifyType int) (items []*EnglishClassifyList, err error) {
|
|
|
- sql := ``
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- if keyWord != "" {
|
|
|
- sql = `SELECT * FROM (
|
|
|
- SELECT * FROM english_classify
|
|
|
- WHERE parent_id=0 AND classify_name LIKE '%` + keyWord + `%' AND classify_type = ?
|
|
|
- UNION
|
|
|
- SELECT * FROM english_classify
|
|
|
- WHERE id IN(SELECT parent_id FROM english_classify
|
|
|
- WHERE parent_id>0 AND classify_name LIKE '%` + keyWord + `%') AND classify_type = ?
|
|
|
- )AS t
|
|
|
- ORDER BY sort ASC,create_time ASC
|
|
|
- LIMIT ?,? `
|
|
|
- _, err = o.Raw(sql, classifyType, classifyType, startSize, pageSize).QueryRows(&items)
|
|
|
- } else {
|
|
|
- sql = `SELECT * FROM english_classify WHERE parent_id=0 AND classify_type = ? ORDER BY sort ASC,create_time ASC LIMIT ?,? `
|
|
|
- _, err = o.Raw(sql, classifyType, startSize, pageSize).QueryRows(&items)
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishClassifyListCount(keyWord string, classifyType int) (count int, err error) {
|
|
|
- sqlCount := ``
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- if keyWord != "" {
|
|
|
- sqlCount = `SELECT COUNT(1) AS count FROM (
|
|
|
- SELECT * FROM english_classify
|
|
|
- WHERE parent_id=0 AND classify_name LIKE '%` + keyWord + `%' AND classify_type = ?
|
|
|
- UNION
|
|
|
- SELECT * FROM english_classify
|
|
|
- WHERE id IN(SELECT parent_id FROM english_classify
|
|
|
- WHERE parent_id>0 AND classify_name LIKE '%` + keyWord + `%' AND classify_type = ?)
|
|
|
- )AS t `
|
|
|
- err = o.Raw(sqlCount, classifyType, classifyType).QueryRow(&count)
|
|
|
- } else {
|
|
|
- sqlCount = `SELECT COUNT(1) AS count FROM english_classify WHERE parent_id=0 AND classify_type = ?`
|
|
|
- err = o.Raw(sqlCount, classifyType).QueryRow(&count)
|
|
|
- }
|
|
|
-
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishClassifyChild(parentId int, keyWord string, classifyType int) (items []*EnglishClassify, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ``
|
|
|
- if keyWord != "" {
|
|
|
- sql = `SELECT * FROM english_classify WHERE parent_id=? AND classify_type = ? AND classify_name LIKE '%` + keyWord + `%' ORDER BY create_time ASC `
|
|
|
- } else {
|
|
|
- sql = `SELECT * FROM english_classify WHERE parent_id=? AND classify_type = ? ORDER BY create_time ASC `
|
|
|
- }
|
|
|
- _, err = o.Raw(sql, parentId, classifyType).QueryRows(&items)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishClassifyChildByParentIds(parentIds []int, keyWord string, classifyType int) (items []*EnglishClassify, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ``
|
|
|
- if keyWord != "" {
|
|
|
- sql = `SELECT * FROM english_classify WHERE parent_id IN (` + utils.GetOrmInReplace(len(parentIds)) + `) AND classify_type = ? AND classify_name LIKE '%` + keyWord + `%' ORDER BY create_time ASC `
|
|
|
- } else {
|
|
|
- sql = `SELECT * FROM english_classify WHERE parent_id IN (` + utils.GetOrmInReplace(len(parentIds)) + `) AND classify_type = ? ORDER BY create_time ASC `
|
|
|
- }
|
|
|
- _, err = o.Raw(sql, parentIds, classifyType).QueryRows(&items)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishReportDetailByClassifyId(classifyIdFirst, classifyIdSecond int) (item *EnglishReport, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` SELECT * FROM english_report WHERE 1=1 `
|
|
|
- if classifyIdSecond > 0 {
|
|
|
- sql = sql + ` AND classify_id_second=? ORDER BY stage DESC LIMIT 1`
|
|
|
- err = o.Raw(sql, classifyIdSecond).QueryRow(&item)
|
|
|
- } else {
|
|
|
- sql = sql + ` AND classify_id_first=? ORDER BY stage DESC LIMIT 1`
|
|
|
- err = o.Raw(sql, classifyIdFirst).QueryRow(&item)
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
|
|
|
// Update 更新
|
|
|
func (item *EnglishReport) Update(cols []string) (err error) {
|
|
@@ -468,18 +230,6 @@ func (item *EnglishReport) Update(cols []string) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// ModifyEnglishReportAuthor 更改英文报告作者
|
|
|
-func ModifyEnglishReportAuthor(condition string, pars []interface{}, authorName string) (count int, err error) {
|
|
|
- //产品权限
|
|
|
- oRddp := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `UPDATE english_report set author = ? WHERE 1=1 `
|
|
|
- if condition != "" {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- err = oRddp.Raw(sql, authorName, pars).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
type EnglishClassify struct {
|
|
|
Id int `orm:"column(id);pk"`
|
|
|
ClassifyName string `description:"分类名称"`
|
|
@@ -493,25 +243,6 @@ type EnglishClassify struct {
|
|
|
ClassifyType int `description:"分类类型:0英文报告,1英文线上路演"`
|
|
|
}
|
|
|
|
|
|
-func AddEnglishClassify(item *EnglishClassify) (lastId int64, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- lastId, err = o.Insert(item)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func ModifyEnglishClassify(item *EnglishClassify) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `UPDATE english_classify
|
|
|
- SET
|
|
|
- classify_name = ?,
|
|
|
- sort = ?,
|
|
|
- parent_id = ?,
|
|
|
- modify_time = ?
|
|
|
- WHERE id = ? `
|
|
|
- _, err = o.Raw(sql, item.ClassifyName, item.Sort, item.ParentId, item.ModifyTime, item.Id).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
// UpdateClassify 更新分类
|
|
|
func (classifyInfo *EnglishClassify) UpdateEnglishClassify(cols []string) (err error) {
|
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
@@ -520,138 +251,6 @@ func (classifyInfo *EnglishClassify) UpdateEnglishClassify(cols []string) (err e
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// DeleteEnglishClassify 删除英文分类
|
|
|
-func DeleteEnglishClassify(classifyId int) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` DELETE FROM english_classify WHERE id =? `
|
|
|
- _, err = o.Raw(sql, classifyId).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishClassifyChildCounts(parentId int) (count int, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT COUNT(1) AS count FROM english_classify WHERE parent_id=? `
|
|
|
- err = o.Raw(sql, parentId).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishReportCounts(classifyId, parentId int) (count int, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ``
|
|
|
- if parentId == 0 {
|
|
|
- sql = `SELECT COUNT(1) AS count FROM english_report WHERE classify_id_first=? `
|
|
|
- } else {
|
|
|
- sql = `SELECT COUNT(1) AS count FROM english_report WHERE classify_id_second=? `
|
|
|
- }
|
|
|
- err = o.Raw(sql, classifyId).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishClassifyCountsByName(name string, parentId int, classifyType int) (count int, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT COUNT(1) AS count FROM english_classify WHERE classify_name=? AND parent_id = ? AND classify_type = ? `
|
|
|
- err = o.Raw(sql, name, parentId, classifyType).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-//获取分类列表
|
|
|
-func GetEnglishFirstClassifyList(classifyType, startSize, pageSize int) (items []*EnglishClassifyList, err error) {
|
|
|
- sql := ``
|
|
|
-
|
|
|
- sql = `SELECT * FROM english_classify WHERE parent_id=0 AND classify_type = ? ORDER BY sort ASC,create_time ASC LIMIT ?,? `
|
|
|
-
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- _, err = o.Raw(sql, classifyType, startSize, pageSize).QueryRows(&items)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishFirstClassifyListCount(classifyType int) (count int, err error) {
|
|
|
- sqlCount := ``
|
|
|
- sqlCount = `SELECT COUNT(1) AS count FROM english_classify WHERE parent_id=0 AND classify_type = ? `
|
|
|
-
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- err = o.Raw(sqlCount, classifyType).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishReportClassifyById(classifyId int) (item *EnglishClassify, err error) {
|
|
|
- sql := `SELECT * FROM english_classify WHERE id=?`
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- err = o.Raw(sql, classifyId).QueryRow(&item)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func GetEnglishReportClassifyByIds(classifyIds []int) (list []*EnglishClassify, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT * FROM english_classify WHERE id IN (` + utils.GetOrmInReplace(len(classifyIds)) + `)`
|
|
|
- _, err = o.Raw(sql, classifyIds).QueryRows(&list)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// UpdateEnglishReportSecondClassifyNameByClassifyId 更新报告分类名称字段
|
|
|
-func UpdateEnglishReportSecondClassifyNameByClassifyId(classifyId int, classifyName string) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := " UPDATE english_report SET classify_name_second = ? WHERE classify_id_second = ? "
|
|
|
- _, err = o.Raw(sql, classifyName, classifyId).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// UpdateEnglishReportFirstClassifyNameByClassifyId 更新报告分类名称字段
|
|
|
-func UpdateEnglishReportFirstClassifyNameByClassifyId(classifyId int, classifyName string) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := " UPDATE english_report SET classify_name_first = ? WHERE classify_id_first = ? "
|
|
|
- _, err = o.Raw(sql, classifyName, classifyId).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// UpdateEnglishReportFirstClassifyNameByClassifyId 更新报告分类名称字段
|
|
|
-func UpdateEnglishReportByClassifyId(classifyFirstName, classifySecondName string, firstClassifyId, secondClassifyId int, ids string) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := " UPDATE english_report SET classify_name_first = ?,classify_name_second = ?,classify_id_first=?, classify_id_second =? WHERE id IN ("+ids+") "
|
|
|
- _, err = o.Raw(sql, classifyFirstName, classifySecondName, firstClassifyId, secondClassifyId).Exec()
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// FetchEnglishReportById 主键获取英文报告
|
|
|
-func FetchEnglishReportById(reportId int) (item *EnglishReport, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT * FROM english_report WHERE id=?`
|
|
|
- err = o.Raw(sql, reportId).QueryRow(&item)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// UpdateReport 更新英文报告
|
|
|
-func (reportInfo *EnglishReport) UpdateReport(cols []string) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- _, err = o.Update(reportInfo, cols...)
|
|
|
-
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetAllEnglishClassify 获取所有英文分类
|
|
|
-func GetAllEnglishClassify(classifyType int) (list []*EnglishClassify, err error) {
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := ` SELECT * FROM english_classify where classify_type = ? `
|
|
|
- _, err = o.Raw(sql, classifyType).QueryRows(&list)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetEnglishReportByIds 根据IDs获取英文报告列表
|
|
|
-func GetEnglishReportByIds(reportIds []int, fieldArr []string) (list []*EnglishReport, err error) {
|
|
|
- listLen := len(reportIds)
|
|
|
- if listLen == 0 {
|
|
|
- return
|
|
|
- }
|
|
|
- fields := ` * `
|
|
|
- if len(fieldArr) > 0 {
|
|
|
- fields = strings.Join(fieldArr, ",")
|
|
|
- }
|
|
|
- o := orm.NewOrmUsingDB("rddp")
|
|
|
- sql := `SELECT ` + fields + ` FROM english_report WHERE id IN (` + utils.GetOrmInReplace(listLen) + `)`
|
|
|
- _, err = o.Raw(sql, reportIds).QueryRows(&list)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
// MarkEditEnReport 标记编辑英文研报的请求数据
|
|
|
type MarkEditEnReport struct {
|
|
|
ReportId int `description:"研报id"`
|
|
@@ -676,32 +275,4 @@ func GetEnglishClassifyByClassifyNameAndParentName(parentClassiyName, classifyNa
|
|
|
sql := "SELECT c1.*, c2.classify_name as parent_classify_name FROM english_classify c1 LEFT JOIN english_classify c2 on c1.parent_id = c2.id where c1.parent_id > 0 and c2.classify_name = ? and c1.classify_name= ?"
|
|
|
err = o.Raw(sql, parentClassiyName, classifyName).QueryRow(&item)
|
|
|
return
|
|
|
-}
|
|
|
-
|
|
|
-type RSClassifyList []*EnglishClassifyList
|
|
|
-
|
|
|
-func (m RSClassifyList) Len() int {
|
|
|
- return len(m)
|
|
|
-}
|
|
|
-
|
|
|
-func (m RSClassifyList) Less(i, j int) bool {
|
|
|
- return m[i].Sort < m[j].Sort
|
|
|
-}
|
|
|
-
|
|
|
-func (m RSClassifyList) Swap(i, j int) {
|
|
|
- m[i], m[j] = m[j], m[i]
|
|
|
-}
|
|
|
-
|
|
|
-type RSChildClassifyList []*EnglishClassify
|
|
|
-
|
|
|
-func (m RSChildClassifyList) Len() int {
|
|
|
- return len(m)
|
|
|
-}
|
|
|
-
|
|
|
-func (m RSChildClassifyList) Less(i, j int) bool {
|
|
|
- return m[i].Sort < m[j].Sort
|
|
|
-}
|
|
|
-
|
|
|
-func (m RSChildClassifyList) Swap(i, j int) {
|
|
|
- m[i], m[j] = m[j], m[i]
|
|
|
}
|