Explorar el Código

Merge branch 'feature/eta_1.3.8' into debug

hsun hace 1 año
padre
commit
8848af7d3e

+ 15 - 0
controllers/english_report_approval.go

@@ -7,6 +7,7 @@ import (
 	"eta/eta_hub/utils"
 	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"strings"
 	"time"
 )
 
@@ -20,6 +21,8 @@ type EnglishReportController struct {
 // @Description 报告列表
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   Keyword   query   string  false       "搜索关键词"
+// @Param   State   query   int  false       "状态"
 // @Success 200 {object} models.EnglishReportListResp
 // @router /list [get]
 func (this *EnglishReportController) List() {
@@ -43,6 +46,18 @@ func (this *EnglishReportController) List() {
 
 	var condition string
 	var pars []interface{}
+	keyword := this.GetString("Keyword")
+	keyword = strings.TrimSpace(keyword)
+	if keyword != "" {
+		kw := fmt.Sprint("%", keyword, "%")
+		condition += ` AND title LIKE ? `
+		pars = append(pars, kw)
+	}
+	state, _ := this.GetInt("State")
+	if state > 0 {
+		condition += ` AND state = ? `
+		pars = append(pars, state)
+	}
 
 	reportOb := new(models.EnglishReport)
 	total, e := reportOb.GetCountByCondition(condition, pars)

+ 15 - 0
controllers/report_approval.go

@@ -7,6 +7,7 @@ import (
 	"eta/eta_hub/utils"
 	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"strings"
 	"time"
 )
 
@@ -20,6 +21,8 @@ type ReportController struct {
 // @Description 获取报告列表
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   Keyword   query   string  false       "搜索关键词"
+// @Param   State   query   int  false       "状态"
 // @Success 200 {object} models.ReportListResp
 // @router /list [get]
 func (this *ReportController) List() {
@@ -42,6 +45,18 @@ func (this *ReportController) List() {
 
 	var condition string
 	var pars []interface{}
+	keyword := this.GetString("Keyword")
+	keyword = strings.TrimSpace(keyword)
+	if keyword != "" {
+		kw := fmt.Sprint("%", keyword, "%")
+		condition += ` AND title LIKE ? `
+		pars = append(pars, kw)
+	}
+	state, _ := this.GetInt("State")
+	if state > 0 {
+		condition += ` AND state = ? `
+		pars = append(pars, state)
+	}
 
 	total, err := models.GetReportListCount(condition, pars, "")
 	if err != nil {

+ 15 - 0
controllers/smart_report_approval.go

@@ -7,6 +7,7 @@ import (
 	"eta/eta_hub/utils"
 	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"strings"
 	"time"
 )
 
@@ -20,6 +21,8 @@ type SmartReportController struct {
 // @Description 报告列表
 // @Param   PageSize			query	int		true	"每页数据条数"
 // @Param   CurrentIndex		query	int		true	"当前页页码"
+// @Param   Keyword   query   string  false       "搜索关键词"
+// @Param   State   query   int  false       "状态"
 // @Success 200 {object} models.SmartReportListResp
 // @router /list [get]
 func (this *SmartReportController) List() {
@@ -42,6 +45,18 @@ func (this *SmartReportController) List() {
 
 	var condition string
 	var pars []interface{}
+	keyword := this.GetString("Keyword")
+	keyword = strings.TrimSpace(keyword)
+	if keyword != "" {
+		kw := fmt.Sprint("%", keyword, "%")
+		condition += ` AND title LIKE ? `
+		pars = append(pars, kw)
+	}
+	state, _ := this.GetInt("State")
+	if state > 0 {
+		condition += ` AND state = ? `
+		pars = append(pars, state)
+	}
 
 	resp := new(models.SmartReportListResp)
 	reportOB := new(models.SmartReport)