Browse Source

feat:优化需求295:ETA/国能系统,研报继承优化

Roc 4 months ago
parent
commit
607deff917
2 changed files with 9 additions and 7 deletions
  1. 7 5
      controllers/report_v2.go
  2. 2 2
      models/report_v2.go

+ 7 - 5
controllers/report_v2.go

@@ -846,7 +846,7 @@ func (this *ReportController) AuthorizedListReport() {
 	classifyIdFirst, _ := this.GetInt("ClassifyIdFirst", 0)
 	classifyIdSecond, _ := this.GetInt("ClassifyIdSecond", 0)
 	classifyIdThird, _ := this.GetInt("ClassifyIdThird", 0)
-	state := this.GetString("State")
+	stateStr := this.GetString("State")
 
 	var startSize int
 	if pageSize <= 0 {
@@ -907,16 +907,18 @@ func (this *ReportController) AuthorizedListReport() {
 		pars = utils.GetLikeKeywordPars(pars, keyword, 1)
 	}
 
+	if stateStr != `` {
+		stateStrList := strings.Split(stateStr, ",")
+		condition += ` AND a.state in (` + utils.GetOrmInReplace(len(stateStrList)) + `) `
+		pars = append(pars, stateStrList)
+	}
+
 	var err error
 	var total int
 
 	orCondition := `AND ( (a.is_public_publish = ? AND a.state in (2,6)) or a.admin_id = ? `
 	pars = append(pars, 1, this.SysUser.AdminId)
 
-	if state != `` {
-
-	}
-
 	// 当前用户有权限的报告id列表
 	num := len(grantReportIdList)
 	if num > 0 {

+ 2 - 2
models/report_v2.go

@@ -351,12 +351,12 @@ func GetReportListCountByAuthorized(condition string, pars []interface{}) (count
 // @return items []*ReportList
 // @return err error
 func GetReportListByAuthorized(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
-	sql := `SELECT id,classify_id_first,classify_name_first,classify_id_second,classify_name_second,classify_id_third,classify_name_third,title,stage,create_time,author,report_layout,collaborate_type,is_public_publish,abstract,has_chapter,publish_time,report_create_time FROM report as a WHERE 1=1  `
+	sql := `SELECT id,classify_id_first,classify_name_first,classify_id_second,classify_name_second,classify_id_third,classify_name_third,title,stage,create_time,author,report_layout,collaborate_type,is_public_publish,abstract,has_chapter,publish_time,report_create_time,state FROM report as a WHERE 1=1  `
 	if condition != "" {
 		sql += condition
 	}
 	// 排序:1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过
-	sql += ` GROUP BY id,classify_id_first,classify_name_first,classify_id_second,classify_name_second,classify_id_third,classify_name_third,title,stage,create_time,author,report_layout,collaborate_type,is_public_publish,abstract,has_chapter,publish_time,report_create_time
+	sql += ` GROUP BY id,classify_id_first,classify_name_first,classify_id_second,classify_name_second,classify_id_third,classify_name_third,title,stage,create_time,author,report_layout,collaborate_type,is_public_publish,abstract,has_chapter,publish_time,report_create_time,state
             ORDER BY  report_create_time DESC LIMIT ?,?`
 	pars = append(pars, startSize)
 	pars = append(pars, pageSize)