Эх сурвалжийг харах

fix:修复企业列表sql

zhangxinlei1996 3 жил өмнө
parent
commit
b8d69de5fa
1 өөрчлөгдсөн 17 нэмэгдсэн , 2 устгасан
  1. 17 2
      entity/ent.go

+ 17 - 2
entity/ent.go

@@ -355,6 +355,14 @@ type List struct {
 func (this *List) List() (*[]map[string]interface{}, int64) {
 	selectSql, countSql := this.GetSql()
 	r := this.Mysql.SelectBySql(selectSql)
+	if r != nil {
+		for k, v := range *r {
+			authStatus := common.Int64All(v["authStatus"])
+			if authStatus == -2 {
+				(*r)[k]["authStatus"] = 0
+			}
+		}
+	}
 	count := this.Mysql.CountBySql(countSql)
 	return r, count
 }
@@ -368,9 +376,12 @@ func (this *List) GetSql() (selectSql, selectCountSql string) {
 		sql += " name like " + "'%" + this.Name + "%' and"
 	}
 	if this.AuthStatus != "" { //z1 已认证
+		if this.AuthStatus == "0" { //前端传0 则是已到期 库中为-2
+			this.AuthStatus = "-2"
+		}
 		sql += " auth_status =" + this.AuthStatus + " and"
 	} else {
-		sql += " auth_status is not null and auth_status !=0 and auth_status !=-1 and"
+		sql += " (auth_status =1 or auth_status=-2 ) and"
 	}
 	if this.CreditCode != "" {
 		sql += " code like " + "'%" + this.CreditCode + "%' and"
@@ -394,7 +405,11 @@ func (this *List) GetSql() (selectSql, selectCountSql string) {
 		sql += `  auth_endTime < '` + e_endtime + `' and`
 	}
 	if this.FrozenStatus != "" {
-		sql += " frozen_status =" + this.FrozenStatus + " and"
+		if this.FrozenStatus == "0" {
+			sql += " (frozen_status =" + this.FrozenStatus + " or frozen_status is null) and"
+		} else {
+			sql += " frozen_status =" + this.FrozenStatus + " and"
+		}
 	}
 	if this.RegPhone != "" {
 		sql += " phone like " + "'%" + this.RegPhone + "%' and"