Explorar el Código

企业资质不能重复添加问题

baichengfei hace 5 años
padre
commit
07ce3ec69f
Se han modificado 1 ficheros con 22 adiciones y 11 borrados
  1. 22 11
      src/dashoo.cn/backend/api/controllers/oilsupplier/supplierfile.go

+ 22 - 11
src/dashoo.cn/backend/api/controllers/oilsupplier/supplierfile.go

@@ -188,20 +188,31 @@ func (this *SupplierfileController) AddSubfile() {
 	var list []supplierfile.OilSupplierFile
 	where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
 	svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
-	hasField := ""
+	//hasField := ""
+	var errinfo ErrorDataInfo
 	for i := 0; i < len(list); i++ {
-		hasField += list[i].NeedFileType + ","
+		//hasField += list[i].NeedFileType + ","
+		if list[i].NeedFileType == model.NeedFileType && list[i].SupplierTypeCode == model.SupplierTypeCode {
+			//已存在,不能重复添加
+			errinfo.Message = "操作失败!不能重复添加"
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
+		}
 	}
 
-	var errinfo ErrorDataInfo
-	if strings.Contains(hasField, model.NeedFileType+",") {
-		//已存在,不能重复添加
-		errinfo.Message = "操作失败!不能重复添加"
-		errinfo.Code = -1
-		this.Data["json"] = &errinfo
-		this.ServeJSON()
-		return
-	}
+
+	//if strings.Contains(hasField, model.NeedFileType+",") {
+	//	if model.SupplierTypeCode != "000" {
+	//			//已存在,不能重复添加
+	//			errinfo.Message = "操作失败!不能重复添加"
+	//			errinfo.Code = -1
+	//			this.Data["json"] = &errinfo
+	//			this.ServeJSON()
+	//			return
+	//	}
+	//}
 
 	_, err := svc.InsertEntityBytbl(OilSupplierFileName, &model)
 	if err == nil {