Browse Source

fix_搜索框

Ethan 1 month ago
parent
commit
7458957d6a

+ 6 - 15
app/dao/local_life_dao.go

@@ -108,11 +108,8 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 	if param.ContentType != 0 {
 		query = query.Where("content_type = ?", param.ContentType)
 	}
-	if param.LocalId != "" {
-		query = query.Where("local_id = ?", param.LocalId)
-	}
-	if param.LocalName != "" {
-		query = query.Where("local_name LIKE ?", "%"+param.LocalName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
 	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, task_form, content_type, need_review, need_quality, need_calculate, store_id, team_buying_id, tools")
@@ -235,11 +232,8 @@ func (d LocalLifeDao) GetLocalStoreExplorePreviews(param *vo.LocalSearchParam) (
 	if param.LocalPlatform != 0 {
 		query = query.Where("local_platform = ?", param.LocalPlatform)
 	}
-	if param.LocalId != "" {
-		query = query.Where("local_id = ?", param.LocalId)
-	}
-	if param.LocalName != "" {
-		query = query.Where("local_name LIKE ?", "%"+param.LocalName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query = query.Where("task_status = ? AND task_form = ?", 8, 1)
 	query.Count(&total)
@@ -292,11 +286,8 @@ func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReB
 	if param.LocalStatus != 0 {
 		query = query.Where("task_status = ?", param.LocalStatus)
 	}
-	if param.LocalId != "" {
-		query = query.Where("local_id = ?", param.LocalId)
-	}
-	if param.LocalName != "" {
-		query = query.Where("local_name LIKE ?", "%"+param.LocalName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
 	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, task_form, content_type, store_id, team_buying_id, settlement_amount")

+ 4 - 10
app/dao/project_dao.go

@@ -108,11 +108,8 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 	if param.ContentType != 0 {
 		query = query.Where("content_type = ?", param.ContentType)
 	}
-	if param.ProjectId != "" {
-		query = query.Where("project_id = ?", param.ProjectId)
-	}
-	if param.ProjectName != "" {
-		query = query.Where("project_name LIKE ?", "%"+param.ProjectName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or project_id = ? or project_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
 	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, project_form, content_type, need_review, need_quality, need_calculate, before_delivery_num, delivery_num, after_delivery_num, product_id, tools")
@@ -364,11 +361,8 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
 	if param.ProjectStatus != 0 {
 		query = query.Where("project_status = ?", param.ProjectStatus)
 	}
-	if param.ProjectId != "" {
-		query = query.Where("project_id = ?", param.ProjectId)
-	}
-	if param.ProjectName != "" {
-		query = query.Where("project_name LIKE ?", "%"+param.ProjectName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or project_id = ? or project_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
 	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, project_form, content_type, product_id, settlement_amount")

+ 4 - 10
app/dao/selection_info_dao.go

@@ -97,11 +97,8 @@ func (d SelectionInfoDAO) GetSelectionPreviews(param *vo.SelectionSearchParam) (
 	} else if param.RewardFlag == 2 {
 		query = query.Where("task_mode = ?", 2)
 	}
-	if param.SelectionId != "" {
-		query = query.Where("selection_id = ?", param.SelectionId)
-	}
-	if param.SelectionName != "" {
-		query = query.Where("selection_name LIKE ?", "%"+param.SelectionName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or selection_id = ? or selection_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
 	query = query.Select("enterprise_id, sub_account_id, selection_id, platform, selection_status, created_at, task_ddl, sample_num, enroll_num, choose_num, product_id, estimated_cost")
@@ -251,11 +248,8 @@ func (d SelectionInfoDAO) GetBillSelectionPreviews(param *vo.SelectionSearchPara
 	if param.SelectionStatus != 0 {
 		query = query.Where("selection_status = ?", param.SelectionStatus)
 	}
-	if param.SelectionId != "" {
-		query = query.Where("selection_id = ?", param.SelectionId)
-	}
-	if param.SelectionName != "" {
-		query = query.Where("selection_name LIKE ?", "%"+param.SelectionName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or selection_id = ? or selection_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
 	query = query.Select("enterprise_id, sub_account_id, selection_id, platform, selection_status, created_at, task_ddl, product_id, settlement_amount")

+ 2 - 3
app/vo/local_search_param.go

@@ -12,7 +12,6 @@ type LocalSearchParam struct {
 	ContentType   int64  `json:"content_type"` // 内容形式, 1图文 2视频
 	Order         int64  `json:"order"`        // 排序 0降序 1升序(默认0)
 
-	LocalId   string `json:"local_id"`   // 任务ID
-	LocalName string `json:"local_name"` // 任务标题
-	//CreatorName string `json:"creator_name"` // 创建者
+	LocalId string `json:"local_id"` // 任务ID
+	Others  string `json:"others"`   // 任务标题/任务ID/创建者
 }

+ 2 - 3
app/vo/project_search_param.go

@@ -12,7 +12,6 @@ type ProjectSearchParam struct {
 	ContentType     int64  `json:"content_type"`   // 内容形式, 1图文 2视频
 	Order           int64  `json:"order"`          // 排序 0降序 1升序(默认0)
 
-	ProjectId   string `json:"project_id"`   // 任务ID
-	ProjectName string `json:"project_name"` // 任务标题
-	//CreatorName string `json:"creator_name"` // 创建者
+	ProjectId string `json:"project_id"` // 任务ID
+	Others    string `json:"others"`     // 任务标题/任务ID/创建者
 }

+ 2 - 3
app/vo/selection_search_param.go

@@ -11,7 +11,6 @@ type SelectionSearchParam struct {
 	RewardFlag        int64  `json:"reward_flag"`        // 悬赏策略 0全部 1有 2无
 	Order             int64  `json:"order"`              // 排序 0降序 1升序(默认0)
 
-	SelectionId   string `json:"selection_id"`   // 任务ID
-	SelectionName string `json:"selection_name"` // 任务标题
-	//CreatorName   string `json:"creator_name"`   // 创建者
+	SelectionId string `json:"selection_id"` // 任务ID
+	Others      string `json:"others"`       // 任务标题/任务ID/创建者
 }