caipin 1 year ago
parent
commit
8e1766378c
3 changed files with 16 additions and 10 deletions
  1. 10 4
      dao/project_dao.go
  2. 1 1
      web/backstage/project_bs.go
  3. 5 5
      web/viewmodels/project.go

+ 10 - 4
dao/project_dao.go

@@ -72,11 +72,16 @@ func (d *ProjectDao) GetPageBsByCategory(pageData viewmodels.ProjectPage, catego
 	sql := ""
 	var args = make([]interface{}, 0)
 
-	if category != "" {
+	if len(pageData.InsideCategoryId) > 0 {
 		sql += "inside_category = ?"
-		args = append(args, category)
+		args = append(args, pageData.InsideCategoryId[0])
 	}
 
+	// if category != "" {
+	// 	sql += "inside_category = ?"
+
+	// }
+
 	if pageData.Search != "" {
 		args = append(args, "%"+pageData.Search+"%")
 		args = append(args, "%"+pageData.Search+"%")
@@ -169,8 +174,9 @@ func (d *ProjectDao) GetPageBs(pageData viewmodels.ProjectPage) (data []models.C
 
 	// 多余判断
 	InsideCategoryId := ""
-	if pageData.InsideCategoryId != "" {
-		InsideCategoryId = pageData.InsideCategoryId
+
+	if len(pageData.InsideCategoryId) > 0 {
+		InsideCategoryId = pageData.InsideCategoryId[0]
 	}
 
 	if InsideCategoryId != "" && pageData.Search != "" {

+ 1 - 1
web/backstage/project_bs.go

@@ -52,7 +52,7 @@ func (c *ProjectBs) PostList() {
 	}
 
 	staffName, err := utils.GetBackstageKey(c.Ctx, "StaffName")
-	category, err := utils.GetBackstageKey(c.Ctx, "insideCategoryId")
+	category, err := utils.GetBackstageKey(c.Ctx, "Category")
 	if err != nil {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		return

+ 5 - 5
web/viewmodels/project.go

@@ -44,11 +44,11 @@ type ProjectInfo struct {
 }
 
 type ProjectPage struct {
-	Page             int    `form:"page" json:"page"`
-	Size             int    `form:"size" json:"size"`
-	PageSize         int    `form:"pageSize" json:"pageSize"`
-	InsideCategoryId string `form:"category" json:"category"`
-	Search           string `form:"search" json:"search"`
+	Page             int      `form:"page" json:"page"`
+	Size             int      `form:"size" json:"size"`
+	PageSize         int      `form:"pageSize" json:"pageSize"`
+	InsideCategoryId []string `form:"category" json:"category"`
+	Search           string   `form:"search" json:"search"`
 }
 
 func (l ProjectPage) ValidatePage() error {