|
@@ -283,37 +283,6 @@ func GetReportListCount(condition string, pars []interface{}) (count int, err er
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-func GetReportList(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
-
|
|
|
|
- sql := `SELECT *,
|
|
|
|
- (SELECT COUNT(1) FROM report_view_record AS rvr WHERE rvr.report_id=report.id) AS pv,
|
|
|
|
- (SELECT COUNT(DISTINCT user_id) FROM report_view_record AS rvr WHERE rvr.report_id=report.id) AS uv
|
|
|
|
- FROM report WHERE 1=1 `
|
|
|
|
- if condition != "" {
|
|
|
|
- sql += condition
|
|
|
|
- }
|
|
|
|
- // 排序:1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过
|
|
|
|
- sql += `ORDER BY FIELD(state,3,1,4,5,6,2), modify_time DESC LIMIT ?,?`
|
|
|
|
- //_, err = o.Raw(sql, pars...).QueryRows(&items)
|
|
|
|
- pars = append(pars, startSize)
|
|
|
|
- pars = append(pars, pageSize)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// PublishReport 发布报告
|
|
|
|
-func PublishReport(reportIds []int) (err error) {
|
|
|
|
- if len(reportIds) == 0 {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `UPDATE report SET state=2,publish_time=now(),modify_time=NOW() WHERE id IN (` + utils.GetOrmInReplace(len(reportIds)) + `)`
|
|
|
|
- //_, err = o.Raw(sql).Exec()
|
|
|
|
- err = global.DmSQL["rddp"].Exec(sql, reportIds).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// PublishCancelReport 取消发布报告
|
|
// PublishCancelReport 取消发布报告
|
|
func PublishCancelReport(reportId, state int, publishTimeNullFlag bool, lastModifyAdminId int, lastModifyAdminName string) (err error) {
|
|
func PublishCancelReport(reportId, state int, publishTimeNullFlag bool, lastModifyAdminId int, lastModifyAdminName string) (err error) {
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
@@ -400,14 +369,6 @@ func GetReportById(reportId int) (item *ReportDetail, err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-func GetReportByIds(reportIds string) (list []*ReportDetail, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `SELECT * FROM report WHERE id in ` + reportIds
|
|
|
|
- //_, err = o.Raw(sql).QueryRows(&list)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql).Find(&list).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// GetSimpleReportByIds 根据报告ID查询报告基本信息
|
|
// GetSimpleReportByIds 根据报告ID查询报告基本信息
|
|
func GetSimpleReportByIds(reportIds []int) (list []*Report, err error) {
|
|
func GetSimpleReportByIds(reportIds []int) (list []*Report, err error) {
|
|
if len(reportIds) == 0 {
|
|
if len(reportIds) == 0 {
|
|
@@ -457,45 +418,6 @@ func GetReportStage(classifyIdFirst, classifyIdSecond, classifyIdThird int) (cou
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// GetReportStageEdit
|
|
|
|
-// @Description: 获取报告的最大期数(每一年的最大期数)
|
|
|
|
-// @author: Roc
|
|
|
|
-// @datetime 2024-06-04 13:50:34
|
|
|
|
-// @param classifyIdFirst int
|
|
|
|
-// @param classifyIdSecond int
|
|
|
|
-// @param classifyIdThird int
|
|
|
|
-// @param reportId int
|
|
|
|
-// @return count int
|
|
|
|
-// @return err error
|
|
|
|
-func GetReportStageEdit(classifyIdFirst, classifyIdSecond, classifyIdThird, reportId int) (count int, err error) {
|
|
|
|
- classifyId := classifyIdThird
|
|
|
|
- if classifyId <= 0 {
|
|
|
|
- classifyId = classifyIdSecond
|
|
|
|
- }
|
|
|
|
- if classifyId <= 0 {
|
|
|
|
- classifyId = classifyIdFirst
|
|
|
|
- }
|
|
|
|
- if classifyId <= 0 {
|
|
|
|
- err = errors.New("错误的分类id")
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- yearStart := time.Date(time.Now().Local().Year(), 1, 1, 0, 0, 0, 0, time.Local)
|
|
|
|
-
|
|
|
|
- sql := `SELECT MAX(stage) AS max_stage FROM report WHERE create_time > ? AND id<>? `
|
|
|
|
- if classifyIdThird > 0 {
|
|
|
|
- sql += " AND classify_id_third = ? "
|
|
|
|
- } else if classifyIdSecond > 0 {
|
|
|
|
- sql += " AND classify_id_second = ? "
|
|
|
|
- } else {
|
|
|
|
- sql = " AND classify_id_first = ? "
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- //o.Raw(sql, yearStart, reportId, classifyId).QueryRow(&count)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, yearStart, reportId, classifyId).Scan(&count).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
type PublishReq struct {
|
|
type PublishReq struct {
|
|
ReportIds string `description:"报告id,多个用英文逗号隔开"`
|
|
ReportIds string `description:"报告id,多个用英文逗号隔开"`
|
|
ReportUrl string `description:"报告Url"`
|
|
ReportUrl string `description:"报告Url"`
|
|
@@ -746,14 +668,6 @@ type SaveReportContent struct {
|
|
EndResourceId int `description:"版尾资源ID"`
|
|
EndResourceId int `description:"版尾资源ID"`
|
|
}
|
|
}
|
|
|
|
|
|
-func EditReportContent(reportId int, content, contentSub string) (err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := ` UPDATE report SET content=?,content_sub=?,modify_time=NOW() WHERE id=? `
|
|
|
|
- //_, err = o.Raw(sql, content, contentSub, reportId).Exec()
|
|
|
|
- err = global.DmSQL["rddp"].Exec(sql, content, contentSub, reportId).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
func AddReportSaveLog(reportId, adminId int, content, contentSub, contentStruct, canvasColor, adminName string, headResourceId, endResourceId int) (err error) {
|
|
func AddReportSaveLog(reportId, adminId int, content, contentSub, contentStruct, canvasColor, adminName string, headResourceId, endResourceId int) (err error) {
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
sql := ` INSERT INTO report_save_log(report_id, content,content_sub,content_struct,canvas_color,head_resource_id,end_resource_id,admin_id,admin_name) VALUES (?,?,?,?,?,?,?,?,?) `
|
|
sql := ` INSERT INTO report_save_log(report_id, content,content_sub,content_struct,canvas_color,head_resource_id,end_resource_id,admin_id,admin_name) VALUES (?,?,?,?,?,?,?,?,?) `
|
|
@@ -828,15 +742,6 @@ type SaveDayWeekReportReq struct {
|
|
CreateTime string `description:"创建时间"`
|
|
CreateTime string `description:"创建时间"`
|
|
}
|
|
}
|
|
|
|
|
|
-// GetDayWeekReportStage 获取晨报周报期数
|
|
|
|
-func GetDayWeekReportStage(classifyIdFirst int, yearStart time.Time) (count int, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := " SELECT MAX(stage) AS max_stage FROM report WHERE classify_id_first = ? AND create_time > ? "
|
|
|
|
- //o.Raw(sql, classifyIdFirst, yearStart).QueryRow(&count)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, classifyIdFirst, yearStart).Scan(&count).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// GetReportByReportId 主键获取报告
|
|
// GetReportByReportId 主键获取报告
|
|
func GetReportByReportId(reportId int) (item *Report, err error) {
|
|
func GetReportByReportId(reportId int) (item *Report, err error) {
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
@@ -846,15 +751,6 @@ func GetReportByReportId(reportId int) (item *Report, err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// GetReportByOldReportId 根据老报告id主键获取报告
|
|
|
|
-func GetReportByOldReportId(reportId int) (item *Report, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `SELECT * FROM report WHERE old_report_id = ?`
|
|
|
|
- //err = o.Raw(sql, reportId).QueryRow(&item)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, reportId).First(&item).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// DeleteDayWeekReportAndChapter 删除晨周报及章节
|
|
// DeleteDayWeekReportAndChapter 删除晨周报及章节
|
|
func DeleteDayWeekReportAndChapter(reportId int) (err error) {
|
|
func DeleteDayWeekReportAndChapter(reportId int) (err error) {
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
@@ -916,27 +812,6 @@ type ReportDetailViewPermission struct {
|
|
PermissionName string
|
|
PermissionName string
|
|
}
|
|
}
|
|
|
|
|
|
-func GetUnPublishDayReport(startTime time.Time, endTime time.Time) (item *Report, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := ` SELECT
|
|
|
|
- *
|
|
|
|
- FROM
|
|
|
|
- report AS a
|
|
|
|
- WHERE
|
|
|
|
- a.has_chapter = 1
|
|
|
|
- AND a.chapter_type = "day"
|
|
|
|
- AND a.state = 1
|
|
|
|
- AND (
|
|
|
|
- a.create_time BETWEEN ? AND ?
|
|
|
|
- )
|
|
|
|
- ORDER BY
|
|
|
|
- a.create_time DESC
|
|
|
|
- LIMIT 1 `
|
|
|
|
- //err = o.Raw(sql, startTime, endTime).QueryRow(&item)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, startTime, endTime).First(&item).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
type ElasticReportDetail struct {
|
|
type ElasticReportDetail struct {
|
|
gorm.Model
|
|
gorm.Model
|
|
ReportId int `gorm:"column:report_id;index" description:"报告ID"`
|
|
ReportId int `gorm:"column:report_id;index" description:"报告ID"`
|
|
@@ -957,24 +832,6 @@ type ElasticReportDetail struct {
|
|
StageStr string `gorm:"column:stage_str" description:"报告期数"`
|
|
StageStr string `gorm:"column:stage_str" description:"报告期数"`
|
|
}
|
|
}
|
|
|
|
|
|
-// GetLastPublishedDayWeekReport 获取上一篇已发布的晨周报
|
|
|
|
-func GetLastPublishDayWeekReport(chapterType string) (item *Report, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := ` SELECT * FROM report WHERE has_chapter = 1 AND chapter_type = ? AND state = 2 ORDER BY publish_time DESC LIMIT 1 `
|
|
|
|
- //err = o.Raw(sql, chapterType).QueryRow(&item)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, chapterType).First(&item).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// GetNewReportExist
|
|
|
|
-func GetNewReportExist(oldReportId int) (item *Report, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := ` SELECT id FROM report WHERE old_report_id = ? LIMIT 1 `
|
|
|
|
- //err = o.Raw(sql, oldReportId).QueryRow(&item)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, oldReportId).First(&item).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// PublishReportAndChapter 发布报告及章节
|
|
// PublishReportAndChapter 发布报告及章节
|
|
func PublishReportAndChapter(reportInfo *Report, isPublishReport bool, cols []string) (err error) {
|
|
func PublishReportAndChapter(reportInfo *Report, isPublishReport bool, cols []string) (err error) {
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
@@ -1014,16 +871,6 @@ func PublishReportAndChapter(reportInfo *Report, isPublishReport bool, cols []st
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-func GetSyncEmptyVideoReport() (list []*Report, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := ` SELECT id FROM report WHERE old_report_id > 0 AND state = 2 AND chapter_type = "" AND (video_size = "" OR video_play_seconds = "")
|
|
|
|
-UNION ALL
|
|
|
|
-SELECT DISTINCT report_id FROM report_chapter WHERE publish_state = 2 AND (video_size = "" OR video_play_seconds = "") `
|
|
|
|
- //_, err = o.Raw(sql).QueryRows(&list)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql).Find(&list).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// PublishReportById 发布报告
|
|
// PublishReportById 发布报告
|
|
func PublishReportById(reportId int, publishTime time.Time, lastModifyAdminId int, lastModifyAdminName string) (err error) {
|
|
func PublishReportById(reportId int, publishTime time.Time, lastModifyAdminId int, lastModifyAdminName string) (err error) {
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
@@ -1042,84 +889,6 @@ func ResetReportById(reportId, state int, lastModifyAdminId int, lastModifyAdmin
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// GetCommentReportByReportId 查询有留言的报告列表
|
|
|
|
-func GetCommentReportByReportId(condition string, pars []interface{}, startSize, pageSize int) (list []*Report, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `SELECT
|
|
|
|
- id,
|
|
|
|
- create_time,
|
|
|
|
- title,
|
|
|
|
- classify_name_first,
|
|
|
|
- classify_id_first,
|
|
|
|
- classify_name_second,
|
|
|
|
- classify_id_second,
|
|
|
|
- state,
|
|
|
|
-IF
|
|
|
|
- ( publish_time, publish_time, create_time ) AS publish_time
|
|
|
|
-FROM
|
|
|
|
- report
|
|
|
|
-WHERE
|
|
|
|
- 1=1
|
|
|
|
- `
|
|
|
|
- if condition != "" {
|
|
|
|
- sql += condition
|
|
|
|
- }
|
|
|
|
- sql += ` ORDER BY publish_time DESC , title ASC LIMIT ?,?`
|
|
|
|
- //_, err = o.Raw(sql, pars...).QueryRows(&list)
|
|
|
|
- pars = append(pars, startSize)
|
|
|
|
- pars = append(pars, pageSize)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&list).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// GetCommentReportByReportIdOrderBy 查询有留言的报告列表(指定排序)
|
|
|
|
-func GetCommentReportByReportIdOrderBy(condition string, pars []interface{}, startSize, pageSize int, orderBy string) (list []*Report, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `SELECT
|
|
|
|
- id,
|
|
|
|
- create_time,
|
|
|
|
- title,
|
|
|
|
- classify_name_first,
|
|
|
|
- classify_id_first,
|
|
|
|
- classify_name_second,
|
|
|
|
- classify_id_second,
|
|
|
|
- state,
|
|
|
|
-IF
|
|
|
|
- ( publish_time, publish_time, create_time ) AS publish_time
|
|
|
|
-FROM
|
|
|
|
- report
|
|
|
|
-WHERE
|
|
|
|
- 1=1
|
|
|
|
- `
|
|
|
|
- if condition != "" {
|
|
|
|
- sql += condition
|
|
|
|
- }
|
|
|
|
- if orderBy == `` {
|
|
|
|
- sql += ` ORDER BY publish_time DESC , title ASC `
|
|
|
|
- } else {
|
|
|
|
- sql += orderBy
|
|
|
|
- }
|
|
|
|
- sql += ` LIMIT ?,? `
|
|
|
|
- //_, err = o.Raw(sql, pars...).QueryRows(&list)
|
|
|
|
- pars = append(pars, startSize)
|
|
|
|
- pars = append(pars, pageSize)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&list).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// GetCommentReportTotalByReportId 查询有留言的报告列表总数
|
|
|
|
-func GetCommentReportTotalByReportId(condition string, pars []interface{}) (total int64, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `SELECT count(*)
|
|
|
|
- FROM report WHERE 1=1`
|
|
|
|
- if condition != "" {
|
|
|
|
- sql += condition
|
|
|
|
- }
|
|
|
|
- //err = o.Raw(sql, pars).QueryRow(&total)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&total).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// 点赞相关的报告列表
|
|
// 点赞相关的报告列表
|
|
type LikeReportItem struct {
|
|
type LikeReportItem struct {
|
|
gorm.Model
|
|
gorm.Model
|
|
@@ -1135,116 +904,6 @@ type LikeReportItem struct {
|
|
Title string `gorm:"column:title" description:"标题"`
|
|
Title string `gorm:"column:title" description:"标题"`
|
|
}
|
|
}
|
|
|
|
|
|
-// GetLikeReportByReportIdReportChapterId 获取有被点赞的报告列表
|
|
|
|
-func GetLikeReportByReportIdReportChapterId(reportIds string, chapterIds string, orderStr string, startSize, pageSize int) (list []*LikeReportItem, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `( SELECT
|
|
|
|
-id AS report_id,
|
|
|
|
-0 AS report_chapter_id,
|
|
|
|
-classify_id_first,
|
|
|
|
-classify_id_second,
|
|
|
|
-classify_name_first,
|
|
|
|
-classify_name_second,
|
|
|
|
-0 as report_chapter_type_id,
|
|
|
|
-"" as report_chapter_type_name,
|
|
|
|
-publish_time,
|
|
|
|
-title
|
|
|
|
-FROM
|
|
|
|
- report
|
|
|
|
-WHERE
|
|
|
|
- classify_name_first != "晨报"
|
|
|
|
- AND classify_name_first != "周报"
|
|
|
|
- AND id in (` + reportIds + `)
|
|
|
|
- )
|
|
|
|
-UNION
|
|
|
|
-
|
|
|
|
-( SELECT
|
|
|
|
-report_id,
|
|
|
|
-report_chapter_id,
|
|
|
|
-classify_id_first,
|
|
|
|
-0 as classify_id_second,
|
|
|
|
-classify_name_first,
|
|
|
|
-null as classify_name_second,
|
|
|
|
-type_id as report_chapter_type_id,
|
|
|
|
-type_name as report_chapter_type_name,
|
|
|
|
-publish_time,
|
|
|
|
-title
|
|
|
|
-FROM
|
|
|
|
- report_chapter
|
|
|
|
-WHERE
|
|
|
|
- report_chapter_id in (` + chapterIds + `)
|
|
|
|
- )`
|
|
|
|
- if orderStr != "" {
|
|
|
|
- sql += ` ORDER BY FIELD(CONCAT(report_id, "-",report_chapter_id),` + orderStr + `)`
|
|
|
|
- } else {
|
|
|
|
- sql += ` ORDER BY publish_time DESC, report_id Desc`
|
|
|
|
- }
|
|
|
|
- sql += ` LIMIT ?,?`
|
|
|
|
- //_, err = o.Raw(sql, startSize, pageSize).QueryRows(&list)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, startSize, pageSize).Find(&list).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// GetLikeReportTotalByReportIdReportChapterId 获取有被点赞的报告列表总数
|
|
|
|
-func GetLikeReportTotalByReportIdReportChapterId(reportIds string, chapterIds string) (total int64, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `select count(*) from (( SELECT
|
|
|
|
-id AS report_id,
|
|
|
|
-0 AS report_chapter_id,
|
|
|
|
-classify_id_first,
|
|
|
|
-classify_id_second,
|
|
|
|
-classify_name_first,
|
|
|
|
-classify_name_second,
|
|
|
|
-0 as report_chapter_type_id,
|
|
|
|
-publish_time,
|
|
|
|
-title
|
|
|
|
-FROM
|
|
|
|
- report
|
|
|
|
-WHERE
|
|
|
|
- classify_name_first != "晨报"
|
|
|
|
- AND classify_name_first != "周报"
|
|
|
|
- AND id in (` + reportIds + `)
|
|
|
|
- )
|
|
|
|
-UNION
|
|
|
|
-
|
|
|
|
-( SELECT
|
|
|
|
-report_id,
|
|
|
|
-report_chapter_id,
|
|
|
|
-classify_id_first,
|
|
|
|
-0 as classify_id_second,
|
|
|
|
-classify_name_first,
|
|
|
|
-null as classify_name_second,
|
|
|
|
-type_id as report_chapter_type_id,
|
|
|
|
-publish_time,
|
|
|
|
-title
|
|
|
|
-FROM
|
|
|
|
- report_chapter
|
|
|
|
-WHERE
|
|
|
|
-report_chapter_id in (` + chapterIds + `)
|
|
|
|
- )) r`
|
|
|
|
- //err = o.Raw(sql).QueryRow(&total)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql).Scan(&total).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// GetPageReportList 分页获取报告列表
|
|
|
|
-func GetPageReportList(condition string, pars []interface{}, startSize, pageSize int) (total int, items []*ReportList, err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `SELECT * FROM report WHERE 1=1 `
|
|
|
|
- sql += condition
|
|
|
|
- sql += ` ORDER BY modify_time DESC`
|
|
|
|
- totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
|
|
|
|
- //err = o.Raw(totalSql, pars).QueryRow(&total)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(totalSql, pars...).Scan(&total).Error
|
|
|
|
- if err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- sql += ` LIMIT ?,? `
|
|
|
|
- //_, err = o.Raw(sql, pars...).QueryRows(&items)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// SunCodeReq 获取太阳码请求体
|
|
// SunCodeReq 获取太阳码请求体
|
|
type SunCodeReq struct {
|
|
type SunCodeReq struct {
|
|
CodePage string `json:"CodePage" description:"太阳码page"`
|
|
CodePage string `json:"CodePage" description:"太阳码page"`
|
|
@@ -1319,31 +978,6 @@ func UpdateReportThirdClassifyNameByClassifyId(classifyId int, classifyName stri
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// UpdateReportSecondClassifyFirstNameByClassifyId 更新报告二级分类的一级分类名称和id
|
|
|
|
-func UpdateReportSecondClassifyFirstNameByClassifyId(classifyId, newClassifyId int, classifyName string) (err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := " UPDATE report SET classify_name_first = ?, classify_id_first = ? WHERE classify_id_second = ? "
|
|
|
|
- //_, err = o.Raw(sql, classifyName, newClassifyId, classifyId).Exec()
|
|
|
|
- err = global.DmSQL["rddp"].Exec(sql, classifyName, newClassifyId, classifyId).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// GetEmptyContentSubPPTReport 获取前两章为空的PPT报告
|
|
|
|
-func GetEmptyContentSubPPTReport() (list []*Report, err error) {
|
|
|
|
- sql := `SELECT
|
|
|
|
- r.id,
|
|
|
|
- r.content,
|
|
|
|
- r.content_sub
|
|
|
|
- FROM
|
|
|
|
- report AS r
|
|
|
|
- JOIN ppt_v2 AS p ON r.id = p.report_id
|
|
|
|
- WHERE
|
|
|
|
- p.report_id > 0 AND r.content_sub = ""`
|
|
|
|
- //_, err = orm.NewOrmUsingDB("rddp").Raw(sql).QueryRows(&list)
|
|
|
|
- err = global.DmSQL["rddp"].Raw(sql).Find(&list).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// ModifyReportAuthor 更改报告作者
|
|
// ModifyReportAuthor 更改报告作者
|
|
func ModifyReportAuthor(condition string, pars []interface{}, authorName string) (count int, err error) {
|
|
func ModifyReportAuthor(condition string, pars []interface{}, authorName string) (count int, err error) {
|
|
//产品权限
|
|
//产品权限
|
|
@@ -1434,15 +1068,6 @@ func GetReportByCondition(condition string, pars []interface{}, fieldArr []strin
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// ModifyReportMsgIsSendV2 更新报告消息状态
|
|
|
|
-func ModifyReportMsgIsSendV2(reportId int) (err error) {
|
|
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- sql := `UPDATE report SET msg_is_send = 1, ths_msg_is_send = 1, msg_send_time = NOW() WHERE id = ? LIMIT 1`
|
|
|
|
- //_, err = o.Raw(sql, reportId).Exec()
|
|
|
|
- err = global.DmSQL["rddp"].Exec(sql, reportId).Error
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// SetPrePublishReportById 设置定时发布
|
|
// SetPrePublishReportById 设置定时发布
|
|
func SetPrePublishReportById(reportId int, prePublishTime string, preMsgSend int) (err error) {
|
|
func SetPrePublishReportById(reportId int, prePublishTime string, preMsgSend int) (err error) {
|
|
//o := orm.NewOrmUsingDB("rddp")
|
|
//o := orm.NewOrmUsingDB("rddp")
|