Browse Source

fix:继承报告时,选择报告权限支持传入报告状态

Roc 3 months ago
parent
commit
665da762de
2 changed files with 9 additions and 1 deletions
  1. 8 0
      controllers/report_v2.go
  2. 1 1
      models/report_v2.go

+ 8 - 0
controllers/report_v2.go

@@ -820,6 +820,7 @@ func (this *ReportController) SaveReportContent() {
 // @Param   ClassifyIdFirst   query   int  true       "一级分类id"
 // @Param   ClassifyIdSecond   query   int  true       "二级分类id"
 // @Param   ClassifyIdThird   query   int  true       "三级分类id"
+// @Param   State   query   string  true       "报告状态,多状态用英文,隔开"
 // @Success 200 {object} models.ReportListResp
 // @router /list/authorized [get]
 func (this *ReportController) AuthorizedListReport() {
@@ -834,6 +835,7 @@ func (this *ReportController) AuthorizedListReport() {
 	classifyIdFirst, _ := this.GetInt("ClassifyIdFirst", 0)
 	classifyIdSecond, _ := this.GetInt("ClassifyIdSecond", 0)
 	classifyIdThird, _ := this.GetInt("ClassifyIdThird", 0)
+	stateStr := this.GetString("State")
 
 	var startSize int
 	if pageSize <= 0 {
@@ -894,6 +896,12 @@ 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
 

+ 1 - 1
models/report_v2.go

@@ -369,7 +369,7 @@ func GetReportListCountByAuthorized(condition string, pars []interface{}) (count
 func GetReportListByAuthorized(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
 	o := orm.NewOrmUsingDB("rddp")
 
-	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 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,state,author,report_layout,collaborate_type,is_public_publish,abstract,has_chapter,publish_time FROM report as a WHERE 1=1  `
 	if condition != "" {
 		sql += condition
 	}