Browse Source

后:供方信息查询-高级查询-准入范围查询bug

wd 4 years ago
parent
commit
1776dfa560

+ 2 - 2
src/dashoo.cn/backend/api/business/oilsupplier/selectbusiness/selectservice.go

@@ -57,7 +57,7 @@ func (s *SelectService) GetMyPagingEntitiesWithOrderBytbl(supplierTableName, sup
 
 	sql += `where ` + where
 
-	if CerSubName != "" && Ids != "" {
+	if CerSubName != "" {
 		sql += " and b.Id in (" + Ids + ")"
 	}
 
@@ -127,7 +127,7 @@ func (s *SelectService) GetMyPagingEntitiesWithOrderBytblForExport(supplierTable
 
 	sql += `where ` + where
 
-	if CerSubName != "" && Ids != "" {
+	if CerSubName != "" {
 		sql += " and b.Id in (" + Ids + ")"
 	}
 

+ 3 - 3
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplierService.go

@@ -463,11 +463,11 @@ func (s *OilSupplierService) GetProcessInfoWithOrderBytbl(supplierTableName, sup
 	return total
 }
 
-func (s *OilSupplierService) GetCertIds(entitiesPtr interface{}, where string) {
+func (s *OilSupplierService) GetCertIds(where string) (Ids string) {
 
 	sql := "SELECT GROUP_CONCAT(DISTINCT SupplierCertId) as Ids from OilSupplierCertSub where " + where + " ORDER BY SupplierCertId"
-
-	s.DBE.SQL(sql).Get(entitiesPtr)
+	s.DBE.SQL(sql).Get(&Ids)
+	return Ids
 }
 
 func (s *OilSupplierService) ConverseSupplierTypeToInt(typeCode string) (typeInt int) {

+ 8 - 20
src/dashoo.cn/backend/api/controllers/oilsupplier/select.go

@@ -250,15 +250,10 @@ func (this *SelectController) GetTList() {
 	//}
 
 	having := ""
+	model.CerSubName = strings.ReplaceAll(model.CerSubName, ",", ",")
 	CerSubName := strings.Split(model.CerSubName, ",")
-	comma := strings.Contains(model.CerSubName, ",")
 
-	if comma {
-		CerSubName = strings.Split(model.CerSubName, ",")
-	} else {
-		CerSubName = strings.Split(model.CerSubName, ",")
-	}
-	var Ids supplier.OilCertIds
+	Ids := ""
 	//准入范围
 	if model.CerSubName != "" {
 		svc := supplier.GetOilSupplierService(utils.DBE)
@@ -271,7 +266,7 @@ func (this *SelectController) GetTList() {
 			}
 		}
 		where1 += ") "
-		svc.GetCertIds(&Ids, where1)
+		Ids = svc.GetCertIds(where1)
 	}
 	//资质
 	if model.NeedFileType != "" {
@@ -282,7 +277,7 @@ func (this *SelectController) GetTList() {
 	var list []supplier.OilSupplierSelect
 
 	total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilInfoChangeName, OilCorporateInfoName, OilSupplierCertSubName,
-		OilSupplierFileName, page.CurrentPage, page.Size, orderby, asc, &list, where, having, model.CerSubName, Ids.Ids, model.NeedFileType)
+		OilSupplierFileName, page.CurrentPage, page.Size, orderby, asc, &list, where, having, model.CerSubName, Ids, model.NeedFileType)
 
 	var datainfo DataInfo
 	datainfo.Items = list
@@ -328,7 +323,7 @@ func (this *SelectController) ExportCompanyList() {
 	}
 
 	having := ""
-	var Ids supplier.OilCertIds
+	Ids := ""
 	if selectedCertIdList != "" {
 		where = where + " and b.Id in (" + selectedCertIdList + ") "
 	} else {
@@ -469,15 +464,8 @@ func (this *SelectController) ExportCompanyList() {
 				where = where + " and b.InStyle ='" + model.InStyle + "'"
 			}
 		}
-
+		model.CerSubName = strings.ReplaceAll(model.CerSubName, ",", ",")
 		CerSubName := strings.Split(model.CerSubName, ",")
-		comma := strings.Contains(model.CerSubName, ",")
-
-		if comma {
-			CerSubName = strings.Split(model.CerSubName, ",")
-		} else {
-			CerSubName = strings.Split(model.CerSubName, ",")
-		}
 
 		//准入范围
 		if model.CerSubName != "" {
@@ -491,7 +479,7 @@ func (this *SelectController) ExportCompanyList() {
 				}
 			}
 			where1 += ") "
-			svc.GetCertIds(&Ids, where1)
+			Ids = svc.GetCertIds(where1)
 		}
 		//资质
 		if model.NeedFileType != "" {
@@ -504,7 +492,7 @@ func (this *SelectController) ExportCompanyList() {
 	var list []supplier.OilSupplierSelect
 
 	total := svc.GetMyPagingEntitiesWithOrderBytblForExport(OilSupplierName, OilSupplierCertName, OilInfoChangeName, OilCorporateInfoName, OilSupplierCertSubName,
-		OilSupplierFileName, page.CurrentPage, page.Size, orderby, asc, &list, where, having, model.CerSubName, Ids.Ids, model.NeedFileType)
+		OilSupplierFileName, page.CurrentPage, page.Size, orderby, asc, &list, where, having, model.CerSubName, Ids, model.NeedFileType)
 	log.Print("共导出供方信息:", total)
 	// 获取到所有符合条件的供方信息列表 ↑
 

+ 6 - 6
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -1183,14 +1183,14 @@ func (this *OilSupplierController) GetJoinStoreEntityList() {
 
 	svc := supplier.GetOilSupplierService(utils.DBE)
 	var list []supplier.OilSupplierView
-	var Ids supplier.OilCertIds
+	Ids := ""
 
 	if Code != "" {
 		where1 := " SupplierTypeCode = '" + SupplierTypeCode + "' and Code like '" + Code + "%'"
-		svc.GetCertIds(&Ids, where1)
+		Ids = svc.GetCertIds(where1)
 	}
 
-	total := svc.GetMyPagingEntitiesWithOrderBytbl2(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where, Code, Ids.Ids)
+	total := svc.GetMyPagingEntitiesWithOrderBytbl2(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where, Code, Ids)
 
 	var datainfo DataInfo
 	datainfo.Items = list
@@ -1360,14 +1360,14 @@ func (this *OilSupplierController) ExportStoreList() {
 
 	svc := supplier.GetOilSupplierService(utils.DBE)
 	var list []supplier.OilSupplierView
-	var Ids supplier.OilCertIds
+	Ids := ""
 
 	if Code != "" {
 		where1 := " SupplierTypeCode = '" + SupplierTypeCode + "' and Code like '" + Code + "%'"
-		svc.GetCertIds(&Ids, where1)
+		Ids = svc.GetCertIds(where1)
 	}
 
-	svc.GetMyPagingEntitiesWithOrderBytbl2(OilSupplierName, OilSupplierCertName, 1, 5000, orderby, asc, &list, where, Code, Ids.Ids)
+	svc.GetMyPagingEntitiesWithOrderBytbl2(OilSupplierName, OilSupplierCertName, 1, 5000, orderby, asc, &list, where, Code, Ids)
 
 	fileTitle := "已入库"
 	showColumnArr := "序号,准入标识,准入证编号,准入类别,企业名称,管理单位,有效期,工商注册号,省市县,单位地址,注册资本,币种,联系人姓名,公司类型,成立时间,开户银行,银行账号,电子邮箱,银行信用等级,移动电话,固定电话,传真,公司电话,备注"