|
@@ -33,6 +33,7 @@ type EtaBusinessController struct {
|
|
|
// @Param IndustryId query int false "行业ID"
|
|
|
// @Param SortParam query int false "排序字段: 1-签约时间; 2-到期时间; 3-创建时间; 4-用户上限"
|
|
|
// @Param SortType query int false "排序类型: 1-正序; 2-倒序"
|
|
|
+// @Param chartClassifyIds query string false "分类id,用逗号分隔"
|
|
|
// @Success 200 Ret=200 获取成功
|
|
|
// @router /page_list [get]
|
|
|
func (this *EtaBusinessController) PageList() {
|
|
@@ -90,7 +91,7 @@ func (this *EtaBusinessController) PageList() {
|
|
|
keyword = strings.TrimSpace(keyword)
|
|
|
if keyword != "" {
|
|
|
kw := fmt.Sprint("%", keyword, "%")
|
|
|
- cond += fmt.Sprintf(` AND (%s LIKE ? OR %s LIKE ? OR %s LIKE ?)`, eta_business.EtaBusinessColumns.BusinessName, eta_business.EtaBusinessColumns.BusinessCode, eta_business.EtaBusinessColumns.CreditCode)
|
|
|
+ cond += fmt.Sprintf(` AND (e.%s LIKE ? OR e.%s LIKE ? OR e.%s LIKE ?)`, eta_business.EtaBusinessColumns.BusinessName, eta_business.EtaBusinessColumns.BusinessCode, eta_business.EtaBusinessColumns.CreditCode)
|
|
|
pars = append(pars, kw, kw, kw)
|
|
|
}
|
|
|
|
|
@@ -115,14 +116,14 @@ func (this *EtaBusinessController) PageList() {
|
|
|
br.Msg = "获取成功"
|
|
|
return
|
|
|
}
|
|
|
- cond += fmt.Sprintf(` AND %s IN (%s)`, eta_business.EtaBusinessColumns.SellerId, utils.GetOrmInReplace(len(ids)))
|
|
|
+ cond += fmt.Sprintf(` AND e.%s IN (%s)`, eta_business.EtaBusinessColumns.SellerId, utils.GetOrmInReplace(len(ids)))
|
|
|
pars = append(pars, ids)
|
|
|
}
|
|
|
|
|
|
// 签约状态
|
|
|
signingStatus, _ := this.GetInt("SigningStatus", 0)
|
|
|
if signingStatus > 0 {
|
|
|
- cond += fmt.Sprintf(` AND %s = ?`, eta_business.EtaBusinessColumns.SigningStatus)
|
|
|
+ cond += fmt.Sprintf(` AND e.%s = ?`, eta_business.EtaBusinessColumns.SigningStatus)
|
|
|
pars = append(pars, signingStatus)
|
|
|
}
|
|
|
|
|
@@ -139,7 +140,7 @@ func (this *EtaBusinessController) PageList() {
|
|
|
br.Msg = "获取成功"
|
|
|
return
|
|
|
}
|
|
|
- cond += fmt.Sprintf(` AND %s IN (%s)`, eta_business.EtaBusinessColumns.Province, utils.GetOrmInReplace(len(provinceArr)))
|
|
|
+ cond += fmt.Sprintf(` AND e.%s IN (%s)`, eta_business.EtaBusinessColumns.Province, utils.GetOrmInReplace(len(provinceArr)))
|
|
|
pars = append(pars, provinceArr)
|
|
|
}
|
|
|
city := this.GetString("City", "")
|
|
@@ -154,14 +155,14 @@ func (this *EtaBusinessController) PageList() {
|
|
|
br.Msg = "获取成功"
|
|
|
return
|
|
|
}
|
|
|
- cond += fmt.Sprintf(` AND %s IN (%s)`, eta_business.EtaBusinessColumns.City, utils.GetOrmInReplace(len(cityArr)))
|
|
|
+ cond += fmt.Sprintf(` AND e.%s IN (%s)`, eta_business.EtaBusinessColumns.City, utils.GetOrmInReplace(len(cityArr)))
|
|
|
pars = append(pars, cityArr)
|
|
|
}
|
|
|
|
|
|
// 行业
|
|
|
industryId, _ := this.GetInt("IndustryId", 0)
|
|
|
if industryId > 0 {
|
|
|
- cond += fmt.Sprintf(` AND %s = ?`, eta_business.EtaBusinessColumns.IndustryId)
|
|
|
+ cond += fmt.Sprintf(` AND e.%s = ?`, eta_business.EtaBusinessColumns.IndustryId)
|
|
|
pars = append(pars, industryId)
|
|
|
}
|
|
|
|
|
@@ -169,9 +170,20 @@ func (this *EtaBusinessController) PageList() {
|
|
|
nation := this.GetString("Nation", "")
|
|
|
nation = strings.TrimSpace(nation)
|
|
|
if nation != "" {
|
|
|
- cond += ` AND nation = ? `
|
|
|
+ cond += ` AND e.nation = ? `
|
|
|
pars = append(pars, nation)
|
|
|
}
|
|
|
+
|
|
|
+ // 分类id
|
|
|
+ chartClassifyIds := this.GetString("ChartClassifyIds", "")
|
|
|
+ chartClassifyIds = strings.TrimSpace(chartClassifyIds)
|
|
|
+ if chartClassifyIds != "" {
|
|
|
+ chartClassifyIdsArr := strings.Split(chartClassifyIds, ",")
|
|
|
+ if len(chartClassifyIdsArr) > 0 {
|
|
|
+ cond += fmt.Sprintf(` AND p.chart_classify_id IN (%s)`, utils.GetOrmInReplace(len(chartClassifyIdsArr)))
|
|
|
+ pars = append(pars, chartClassifyIdsArr)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
order := ``
|
|
@@ -200,13 +212,13 @@ func (this *EtaBusinessController) PageList() {
|
|
|
|
|
|
// 获取列表
|
|
|
businessOb := new(eta_business.EtaBusiness)
|
|
|
- total, e := businessOb.GetCountByCondition(cond, pars)
|
|
|
+ total, e := businessOb.GetWithChartClassifyCountByCondition(cond, pars)
|
|
|
if e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取商家总数失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- list, e := businessOb.GetPageItemsByCondition(cond, pars, []string{}, order, startSize, pageSize)
|
|
|
+ list, e := businessOb.GetPageItemsWithChartClassifyByCondition(cond, pars, []string{}, order, startSize, pageSize)
|
|
|
if e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取商家列表失败, Err: " + e.Error()
|