lining 6 tahun lalu
induk
melakukan
7bb21d79bc

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

@@ -191,15 +191,23 @@ LEFT JOIN (SELECT  b.Month,a.CatalogSpe from (select extract(month from CreateOn
 
 func (s *SelectService) GetInfoByCompId(where string,entitiesPtr interface{}) (total int64) {
 	var sql string
-	sql = `SELECT a.*,b.Name,b.Code from OilSupplier a LEFT JOIN OilSupplierCertSub b ON a.Id = b.SupplierId `+ where
+	sql = `SELECT a.* from OilSupplier a `+ where
 
 	var totalResult TotalResult
 	session := s.DBE.NewSession()
 	session.Begin()
-	session.SQL(sql).Find(entitiesPtr)
+	session.SQL(sql).Get(entitiesPtr)
 	//session.SQL(sqlCount).Get(&totalResult)
 	session.Commit()
 	total = totalResult.Total
 
 	return total
 }
+
+func (s *SelectService) Getoilsuppliercertsub( tableName, where string, entitiesPtr interface{}) error {
+	var sql string
+	sql = `SELECT a.* from `+ tableName +` a `+ where
+
+	err := s.DBE.SQL(sql).Find(entitiesPtr)
+	return err
+}

+ 17 - 12
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplier.go

@@ -209,7 +209,7 @@ type OilSupplierView struct {
 }
 
 type OilSupplierSelect struct {
-	Id               int       //Oilsupplier表id
+	Id               int //Oilsupplier表id
 	CertId           int
 	AccessCardNo     string    //准入证号
 	SupplierName     string    //企业名称
@@ -345,7 +345,7 @@ type InterfaceData struct {
 	ExpireAllFile string
 }
 
-type OilSupplierAndApply struct {
+type SupplierInfoInte struct {
 	Id                  int       `xorm:"not null pk autoincr INT(10)"`
 	SupplierName        string    `xorm:"comment('企业名称') VARCHAR(255)"`
 	OilCertificateNo    string    `xorm:"comment('中石油供应商证书号') VARCHAR(50)"`
@@ -410,15 +410,20 @@ type OilSupplierAndApply struct {
 	JSAccessCardNo      string    `xorm:"comment('准入证编码--基建') VARCHAR(20)"`
 	JFAccessCardNo      string    `xorm:"comment('准入证编码--技术服务类') VARCHAR(20)"`
 	Remark              string    `xorm:"comment('备注') VARCHAR(500)"`
-	IsDelete            int       `xorm:"default 0 comment('删除状态,0正常,1已删除') INT(10)"`
-	CreateOn            time.Time `xorm:"DATETIME"`
-	CreateUserId        int       `xorm:"INT(10)"`
-	CreateBy            string    `xorm:"VARCHAR(50)"`
-	ModifiedOn          time.Time `xorm:"DATETIME"`
-	ModifiedUserId      int       `xorm:"INT(10)"`
-	ModifiedBy          string    `xorm:"VARCHAR(50)"`
 	PACNumber           string    `xorm:"comment('中石油准入证编号') VARCHAR(50)"`
 	SupplierCertificate string    `xorm:"comment('中石油物资供应商证书') VARCHAR(200)"`
-	Name                string    `xorm:"comment('准入范围') VARCHAR(500)"`
-	Code                string    `xorm:"comment('准入范围编号') VARCHAR(15)"`
-}
+}
+
+type OilSupplierCertSubInte struct {
+	SupplierTypeCode string `xorm:"not null default '' comment('准入类别代码') VARCHAR(5)"`
+	Code             string `xorm:"not null default '' comment('分类编码') VARCHAR(8)"`
+	Name             string `xorm:"not null default '' comment('分类名称') VARCHAR(50)"`
+	Remark           string `xorm:"comment('备注') VARCHAR(500)"`
+}
+
+type OilSupplierInte struct {
+	SupplierInfo SupplierInfoInte
+	WZsub        []OilSupplierCertSubInte // 物资类
+	JFsub        []OilSupplierCertSubInte // 技术服务类
+	JSsub        []OilSupplierCertSubInte // 基建类
+}

+ 21 - 12
src/dashoo.cn/backend/api/controllers/oilsupplier/select.go

@@ -250,23 +250,32 @@ func (this *SelectController) GetTList() {
 // @Success 200 {object}
 // @router /getbaseinfo [post]
 func (this *SelectController) GetBaseInfo() {
-	where := " where 1 = 1 AND a.SupplierName in ( "
 	Spesearch := this.GetString("Spesearch")
-	if Spesearch != "" {
-		spe := strings.Split(Spesearch, ",")
-		for _, c := range spe {
-			where = where +"'" + c + "'" +","
-		}
-		where = strings.Trim(where, ",")
-		where = where + " )"
-	}
+	spesearchs := strings.Split(Spesearch, ",")
 
 	svc := selectbusiness.GetSelectService(utils.DBE)
-	var list []supplier.OilSupplierAndApply
+	var infoIntelist []supplier.OilSupplierInte
+
+	for _,item := range spesearchs {
+		//var supplierinfo supplier.SupplierInfoInte
+		var infoInte supplier.OilSupplierInte
+		where := " where 1 = 1 AND a.SupplierName = '" + item + "'"
+		svc.GetInfoByCompId(where,&infoInte.SupplierInfo)
+
+		//var suplliersup []supplier.OilSupplierCertSubInte
+		where = "where SupplierId=" + strconv.Itoa(infoInte.SupplierInfo.Id) + " and SupplierTypeCode='01'"
+		svc.Getoilsuppliercertsub(OilSupplierCertSubName, where, &infoInte.WZsub)
+
+		where = "where SupplierId=" + strconv.Itoa(infoInte.SupplierInfo.Id) + " and SupplierTypeCode='02'"
+		svc.Getoilsuppliercertsub(OilSupplierCertSubName, where, &infoInte.JSsub)
+
+		where = "where SupplierId=" + strconv.Itoa(infoInte.SupplierInfo.Id) + " and SupplierTypeCode='03'"
+		svc.Getoilsuppliercertsub(OilSupplierCertSubName, where, &infoInte.JFsub)
+		infoIntelist = append(infoIntelist, infoInte)
+	}
 
-	svc.GetInfoByCompId(where,&list)
 	var datainfo DataInfo
-	datainfo.Items = list
+	datainfo.Items = infoIntelist
 
 	this.Data["json"] = &datainfo
 	this.ServeJSON()