소스 검색

查询

Signed-off-by: lijunqing <lijunqing@dashoo.cn>
lijunqing 6 년 전
부모
커밋
614b3071fb

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

@@ -24,12 +24,11 @@ func (s *SelectService) GetMyPagingEntitiesWithOrderBytbl(supplierTableName, sup
 	//获取总记录数
 	sqlCount := `select count(*) from ` + supplierTableName + ` a `
 	sqlCount += ` left join ` + supplierCertTableName + " b on b.SupplierId = a.Id"
-	// sqlCount += ` left join ` + OilInfoChangeName + " c on c.SupplierId = a.Id"
 	// sqlCount += ` left join ` + OilSupplierFileName + ` d on d.SupplierId = a.Id `
 	sqlCount += ` where ` + where
 
 	var sql string
-	sql = `select a.*, b.Id as CertId, b.AccessCardNo, b.SupplierTypeCode, b.SupplierTypeName, b.InFlag, b.AuditDate,`
+	sql = `select * from (select a.*, b.Id as CertId, b.AccessCardNo, b.SupplierTypeCode, b.SupplierTypeName, b.InFlag, b.AuditDate,`
 	sql += ` b.WorkerTotal, `
 	sql += ` b.ContractNum, `
 	sql += ` b.UniversityNum, `
@@ -42,11 +41,10 @@ func (s *SelectService) GetMyPagingEntitiesWithOrderBytbl(supplierTableName, sup
 	sql += ` b.SkillerTotal, `
 	sql += ` b.Status, `
 	sql += ` b.WorkflowId, `
-	sql += ` b.ApplyTime `
-	// sql += ` c.OldSupplierName `
+	sql += ` b.ApplyTime, `
+	sql += ` (select c.OldSupplierName from OilInfoChange c where c.SupplierId=a.Id order by c.CreateOn desc limit 1) OldSupplierName `
 	sql += ` from ` + supplierTableName + ` a `
-	sql += ` left join ` + supplierCertTableName + ` b on b.SupplierId = a.Id `
-	// sql += ` right join ` + OilInfoChangeName + ` c on c.SupplierId = a.Id `
+	sql += ` left join ` + supplierCertTableName + ` b on b.SupplierId = a.Id) ab`
 	// sql += ` left join ` + OilSupplierFileName + ` d on d.SupplierId = a.Id `
 	sql += ` where ` + where
 	if asc {

+ 1 - 4
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplier.go

@@ -4,9 +4,6 @@ import (
 	"time"
 )
 
-type UsedName struct {
-	OldSupplierName string `xorm:"comment('曾用名') VARCHAR(255)"`
-}
 
 type OilSupplier struct {
 	Id                 int       `xorm:"not null pk autoincr INT(10)"`
@@ -82,8 +79,8 @@ type OilSupplier struct {
 }
 
 type OilSupplierView struct {
-	//UsedName          `xorm:"extends"`
 	OilSupplier       `xorm:"extends"`
+	OldSupplierName   string    `xorm:"comment('曾用名') VARCHAR(255)"`
 	CertId            string
 	AccessCardNo      string
 	SupplierTypeCode  string

+ 72 - 62
src/dashoo.cn/backend/api/controllers/oilsupplier/select.go

@@ -1,12 +1,16 @@
 package oilsupplier
 
 import (
+	"encoding/json"
+	"fmt"
+	"strconv"
+	"time"
+
 	"dashoo.cn/backend/api/business/oilsupplier/annualaudit"
 	"dashoo.cn/backend/api/business/oilsupplier/infochange"
 	"dashoo.cn/backend/api/business/oilsupplier/qualchange"
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercertappend"
-	"encoding/json"
-	"fmt"
+
 	// "fmt"
 
 	"dashoo.cn/backend/api/business/oilsupplier/selectbusiness"
@@ -47,8 +51,8 @@ type NeedFileTypeStruct struct {
 func (this *SelectController) GetTList() {
 
 	var model supplier.OilSupplierView
-	var model1 RegCapitalRange
-	var model2 NeedFileTypeStruct
+	var model1 RegCapitalRange    //注册资金范围
+	var model2 NeedFileTypeStruct //资质结构体
 
 	var jsonBlob = this.Ctx.Input.RequestBody
 	json.Unmarshal(jsonBlob, &model)
@@ -58,104 +62,110 @@ func (this *SelectController) GetTList() {
 	// //获取分页信息
 	page := this.GetPageInfoForm()
 	where := " 1=1"
-	orderby := "a.Id"
+	orderby := "ab.Id"
 	asc := false
 	Order := this.GetString("Order")
 	Prop := this.GetString("Prop")
 	fmt.Println(Prop)
 	if Order != "" && Prop != "" {
-		orderby = Prop
+		orderby = "ab." + Prop
 		if Order == "asc" {
 			asc = true
 		}
 	}
 
+	//准入证号
 	if model.AccessCardNo != "" {
-		where = where + " and b.AccessCardNo like '%" + model.AccessCardNo + "%'"
+		where = where + " and ab.AccessCardNo like '%" + model.AccessCardNo + "%'"
 	}
+	//企业名称
 	if model.SupplierName != "" {
-		where = where + " and a.SupplierName like '%" + model.SupplierName + "%'"
+		where = where + " and ab.SupplierName like '%" + model.SupplierName + "%'"
+	}
+
+	if model.OldSupplierName != "" {
+		where = where + " and ab.OldSupplierName like '%" + model.OldSupplierName + "%'"
 	}
+
+	//准入类别(基建,物资,技术服务)
 	if model.SupplierTypeCode != "" {
-		where = where + " and b.SupplierTypeCode = '" + model.SupplierTypeCode + "'"
+		where = where + " and ab.SupplierTypeCode = '" + model.SupplierTypeCode + "'"
 	}
+	//准入标识 1 准入 2 暂停 3取消
 	if model.InFlag != "" {
-		where = where + " and b.InFlag = '" + model.InFlag + "'"
+		where = where + " and ab.InFlag = '" + model.InFlag + "'"
 	}
+	//法人
 	if model.LegalPerson != "" {
-		where = where + " and a.LegalPerson like '%" + model.LegalPerson + "%'"
+		where = where + " and ab.LegalPerson like '%" + model.LegalPerson + "%'"
 	}
+	//联系人
 	if model.ContactName != "" {
-		where = where + " and a.ContactName like '%" + model.ContactName + "%'"
+		where = where + " and ab.ContactName like '%" + model.ContactName + "%'"
 	}
+	//统一社会信用代码
 	if model.CommercialNo != "" {
-		where = where + " and a.CommercialNo like '%" + model.CommercialNo + "%'"
+		where = where + " and ab.CommercialNo like '%" + model.CommercialNo + "%'"
 	}
-
-	if model.CompanyType != "" {
-		where = where + " and a.CompanyType like '%" + model.CompanyType + "%'"
+	//开户银行
+	if model.DepositBank != "" {
+		where = where + " and ab.DepositBank like '%" + model.DepositBank + "%'"
 	}
-	HseTraining := this.GetString("HseTraining")
-	if HseTraining != "" {
-		where = where + " and a.HseTraining = '" + HseTraining + "'"
+	//HSE审查
+	if model.HseTraining != "" {
+		where = where + " and ab.HseTraining = '" + model.HseTraining + "'"
 	}
-
-	BusinessScope := this.GetString("BusinessScope")
-	if BusinessScope != "" {
-		where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
+	//公司类型
+	if model.CompanyType != "" {
+		where = where + " and ab.CompanyType like '%" + model.CompanyType + "%'"
 	}
-	//OldSupplierName := this.GetString("OldSupplierName")
-	//if OldSupplierName != "" {
-	//	where = where + " and c.OldSupplierName like '%" + OldSupplierName + "%'"
-	//}
-	Province := this.GetString("Province")
-	if Province != "" {
-		where = where + " and a.Province = '" + Province + "'"
+	//成立时间
+	SetupTime := this.GetString("SetupTime")
+	if SetupTime != "" {
+		where = where + " and ab.SetupTime ='" + SetupTime + "'"
 	}
-	City := this.GetString("City")
-	if City != "" {
-		where = where + " and a.City = '" + City + "'"
+	//注册资金范围
+	if model1.RegCapital1 != "" {
+		where = where + " and ab.RegCapital >= '" + model1.RegCapital1 + "'"
 	}
-
-	Street := this.GetString("Street")
-	if Street != "" {
-		where = where + " and a.Street = '" + Street + "'"
+	if model1.RegCapital2 != "" {
+		where = where + " and ab.RegCapital <= '" + model1.RegCapital2 + "'"
 	}
-	Address := this.GetString("Address")
-	if Address != "" {
-		where = where + " and a.Address like '%" + Address + "%'"
+
+	//注册省份
+	if model.Province != "" {
+		where = where + " and ab.Province = '" + model.Province + "'"
 	}
-	LinkProvince := this.GetString("LinkProvince")
-	if LinkProvince != "" {
-		where = where + " and a.LinkProvince = '" + LinkProvince + "'"
+	//注册市
+	if model.City != "" {
+		where = where + " and ab.City = '" + model.City + "'"
 	}
-	LinkCity := this.GetString("LinkCity")
-	if LinkCity != "" {
-		where = where + " and a.LinkCity = '" + LinkCity + "'"
+	//注册区
+	if model.Street != "" {
+		where = where + " and ab.Street = '" + model.Street + "'"
 	}
-	LinkStreet := this.GetString("LinkStreet")
-	if LinkStreet != "" {
-		where = where + " and a.LinkStreet = '" + LinkStreet + "'"
+	//注册详细地址
+	if model.Address != "" {
+		where = where + " and ab.Address like '%" + model.Address + "%'"
 	}
-	LinkAddress := this.GetString("LinkAddress")
-	if LinkAddress != "" {
-		where = where + " and a.LinkAddress like '%" + LinkAddress + "%'"
+	if model.LinkProvince != "" {
+		where = where + " and ab.LinkProvince = '" + model.LinkProvince + "'"
 	}
-	DepositBank := this.GetString("DepositBank")
-	if DepositBank != "" {
-		where = where + " and a.DepositBank like '%" + DepositBank + "%'"
+	if model.LinkCity != "" {
+		where = where + " and ab.LinkCity = '" + model.LinkCity + "'"
 	}
-	SetupTime := this.GetString("SetupTime")
-	if SetupTime != "" {
-		where = where + " and a.SetupTime ='" + SetupTime + "'"
+	if model.LinkStreet != "" {
+		where = where + " and ab.LinkStreet = '" + model.LinkStreet + "'"
 	}
-	if model1.RegCapital1 != "" {
-		where = where + " and a.RegCapital >= '" + model1.RegCapital1 + "'"
+	if model.LinkAddress != "" {
+		where = where + " and ab.LinkAddress like '%" + model.LinkAddress + "%'"
 	}
-	if model1.RegCapital2 != "" {
-		where = where + " and a.RegCapital <= '" + model1.RegCapital2 + "'"
+	//营业范围
+	if model.BusinessScope != "" {
+		where = where + " and ab.BusinessScope like '%" + model.BusinessScope + "%'"
 	}
 
+	//包含资质
 	if model2.NeedFileType != nil && len(model2.NeedFileType) > 0 {
 		pararm := ""
 		for i := 0; i < len(model2.NeedFileType); i++ {

+ 7 - 23
src/dashoo.cn/frontend_web/src/pages/select/companyselect/index.vue

@@ -523,7 +523,7 @@
           <el-col :span="12">
             <el-form-item label="成立时间">
               <el-date-picker
-                v-model="searchForm.SetupTime"
+                v-model="SetupTime"
                 size="mini"
                 type="date"
                 format="yyyy 年 MM 月 dd 日"
@@ -691,11 +691,11 @@ export default {
           label: "全部"
         },
         {
-          value: 1,
+          value: '1',
           label: "是"
         },
         {
-          value: 0,
+          value: '0',
           label: "否"
         }
       ],
@@ -758,7 +758,7 @@ export default {
       size: 10,
       currentPage: 1,
       currentItemCount: 0,
-      SetupTime: "",
+      SetupTime: "",//成立时间
       searchForm: {
         AccessCardNo: "",
         SupplierName: "",
@@ -770,7 +770,6 @@ export default {
         RegCapital1: "",
         RegCapital2: "",
         CompanyType: "",
-        SetupTime: "",
         Province: "",
         City: "",
         Street: "",
@@ -782,7 +781,7 @@ export default {
         DepositBank: "",
         BusinessScope: "",
         OldSupplierName: "",
-        HseTraining: "",
+        HseTraining: "", 
         NeedFileType: []
       },
       //列表排序
@@ -811,7 +810,6 @@ export default {
       this.searchForm.LinkStreet = value[2];
     },
     handleAreaChange(value) {
-      console.log(value);
       this.searchForm.Province = value[0];
       this.searchForm.City = value[1];
       this.searchForm.Street = value[2];
@@ -822,6 +820,7 @@ export default {
         .then(res => {
           this.dictData = res.data.items;
           this.CompanyTypeOptions = this.dictData["CompanyType"];
+          console.log(this.CompanyTypeOptions)
           this.getCityList(this.dictData["GaodeMapChinaAreas"]);
         })
         .catch(err => {
@@ -856,7 +855,6 @@ export default {
       return wbout;
     },
     handle(row, column, event, cell) {
-      console.log(row);
       this.formData.SupplierName = row.SupplierName;
       this.formData.AccessCardNo = row.AccessCardNo;
       this.formData.SpecTypeCode = row.SpecTypeCode;
@@ -935,22 +933,8 @@ export default {
         _currentPage: this.currentPage,
         Order: this.Column.Order,
         Prop: this.Column.Prop,
-        SetupTime: this.searchForm.SetupTime,
-        Province: this.searchForm.Province,
-        City: this.searchForm.City,
-        Street: this.searchForm.Street,
-        Address: this.searchForm.Address,
-        LinkProvince: this.searchForm.LinkProvince,
-        LinkCity: this.searchForm.LinkCity,
-        LinkStreet: this.searchForm.LinkStreet,
-        LinkAddress: this.searchForm.LinkAddress,
-        DepositBank: this.searchForm.DepositBank,
-        BusinessScope: this.searchForm.BusinessScope,
-        OldSupplierName: this.searchForm.OldSupplierName,
-        HseTraining: this.searchForm.HseTraining,
-        NeedFileType: this.searchForm.NeedFileType
+        SetupTime: this.SetupTime,
       };
-      console.log(this.searchForm.NeedFileType);
       api
         .getCompanyList(params, this.searchForm, this.$axios)
         .then(res => {