Forráskód Böngészése

前后:合同列表有无评价筛选

dubch 4 éve
szülő
commit
c80ec09a6c

+ 56 - 0
src/dashoo.cn/backend/api/business/oilcontract/contract/contractService.go

@@ -2,6 +2,7 @@ package contract
 
 import (
 	. "dashoo.cn/backend/api/mydb"
+	"dashoo.cn/utils"
 	"github.com/go-xorm/xorm"
 	"strconv"
 )
@@ -89,3 +90,58 @@ func (s *OilContractService) GetJoinBySelect1(where string, entityPtr interface{
 	s.DBE.SQL(sql).Get(entityPtr)
 	return
 }
+
+func (s *OilContractService) GetMyPagingEntitiesWithOrderByIsReview(oilContractName, oilContractReviewName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where string, isReview string) (total int64) {
+	var resultsSlice []map[string][]byte
+
+	//获取总记录数
+	sqlCount := `select count(a.Id) from ` + oilContractName + ` a `
+	sqlCount += ` left join ` + oilContractReviewName + " b on b.ContractId = a.Id"
+	sqlCount += ` where ` + where
+	if isReview == "1" {
+		sqlCount = `select count(*) as total from (select count(a.Id) from ` + oilContractName + ` a `
+		sqlCount += ` left join ` + oilContractReviewName + " b on b.ContractId = a.Id"
+		sqlCount += ` where ` + where
+		sqlCount += ` GROUP BY a.Id,b.ContractId `
+		sqlCount += ` HAVING count(b.Id) > 0) c `
+	} else if isReview == "2" {
+		sqlCount = `select count(*) as total from (select count(a.Id) from ` + oilContractName + ` a `
+		sqlCount += ` left join ` + oilContractReviewName + " b on b.ContractId = a.Id"
+		sqlCount += ` where ` + where
+		sqlCount += ` GROUP BY a.Id,b.ContractId `
+		sqlCount += ` HAVING count(b.Id) = 0) c `
+	}
+
+	var sql string
+	sql = `select SQL_CALC_FOUND_ROWS a.*, count(b.Id)`
+	sql += ` from ` + oilContractName + ` a `
+	sql += ` left join ` + oilContractReviewName + " b on b.ContractId = a.Id"
+	sql += ` where ` + where
+	sql += ` GROUP BY a.Id `
+	if isReview == "1" {
+		sql += ` HAVING count(b.Id) > 0 `
+	} else if isReview == "2" {
+		sql += ` HAVING count(b.Id) = 0 `
+	}
+	if asc {
+		sql += ` order by ` + orderby + ` ASC `
+	} else {
+		sql += ` order by ` + orderby + ` DESC `
+	}
+	if pageIndex != 0 && itemsPerPage != 0 {
+		sql += ` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
+	}
+	s.DBE.SQL(sql).Find(entitiesPtr)
+	resultsSlice, _ = s.DBE.Query(sqlCount)
+
+	if len(resultsSlice) > 0 {
+		results := resultsSlice[0]
+		for _, value := range results {
+			total, _ = strconv.ParseInt(string(value), 10, 64)
+			break
+		}
+	}
+
+	return total
+}
+

+ 162 - 159
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -39,7 +39,7 @@ func (this *OilContractController) GetEntityList() {
 	//获取分页信息
 	page := this.GetPageInfoForm()
 	where := " 1=1 "
-	orderby := "Id"
+	orderby := "a.Id"
 	asc := false
 	Order := this.GetString("Order")
 	Prop := this.GetString("Prop")
@@ -118,173 +118,174 @@ func (this *OilContractController) GetEntityList() {
 	ClassName := this.GetString("ClassName")
 	SecondUnit := this.GetString("SecondUnit")
 	ImportSecondUnit := this.GetString("ImportSecondUnit")
+	IsReview := this.GetString("IsReview")
 
 	if Id != "" {
-		where = where + " and Id like '%" + Id + "%'"
+		where = where + " and a.Id like '%" + Id + "%'"
 	}
 
 	if ContractClass != "" {
-		where = where + " and ContractClass='" + ContractClass + "' "
+		where = where + " and a.ContractClass='" + ContractClass + "' "
 	}
 
 	if SecondUnit != "" {
-		where = where + " and SecondUnit=" + SecondUnit + " "
+		where = where + " and a.SecondUnit=" + SecondUnit + " "
 	}
 
 	if ImportSecondUnit != "" {
-		where = where + " and SecondUnit=" + ImportSecondUnit + " "
+		where = where + " and a.SecondUnit=" + ImportSecondUnit + " "
 	}
 
 	if ClassName != "" {
-		where = where + " and ClassName='" + ClassName + "' "
+		where = where + " and a.ClassName='" + ClassName + "' "
 	}
 
 	if SupplierId != "" {
-		where = where + " and SupplierId like '%" + SupplierId + "%'"
+		where = where + " and a.SupplierId like '%" + SupplierId + "%'"
 	}
 
 	if SupplierName != "" {
-		where = where + " and SupplierName like '%" + SupplierName + "%'"
+		where = where + " and a.SupplierName like '%" + SupplierName + "%'"
 	}
 
 	if ImportSupplierName != "" {
-		where = where + " and ImportSupplierName like '%" + ImportSupplierName + "%'"
+		where = where + " and a.ImportSupplierName like '%" + ImportSupplierName + "%'"
 	}
 
 	if ImportUnitName != "" {
-		where = where + " and ImportSecondUnit like '%" + ImportUnitName + "%'"
+		where = where + " and a.ImportSecondUnit like '%" + ImportUnitName + "%'"
 	}
 
 	if Status != "" {
-		where = where + " and Status=" + Status + " "
+		where = where + " and a.Status=" + Status + " "
 	}
 
 	if SettleStatus != "" {
-		where = where + " and SettleStatus='" + SettleStatus + "' "
+		where = where + " and a.SettleStatus='" + SettleStatus + "' "
 	}
 
 	if ProjectName != "" {
-		where = where + " and ProjectName like '%" + ProjectName + "%'"
+		where = where + " and a.ProjectName like '%" + ProjectName + "%'"
 	}
 
 	if ContractNo != "" {
-		where = where + " and ContractNo like '%" + ContractNo + "%'"
+		where = where + " and a.ContractNo like '%" + ContractNo + "%'"
 	}
 
 	if ProjectPlace != "" {
-		where = where + " and ProjectPlace like '%" + ProjectPlace + "%'"
+		where = where + " and a.ProjectPlace like '%" + ProjectPlace + "%'"
 	}
 
 	if ProjectOwner != "" {
-		where = where + " and ProjectOwner like '%" + ProjectOwner + "%'"
+		where = where + " and a.ProjectOwner like '%" + ProjectOwner + "%'"
 	}
 
 	if Telephone != "" {
-		where = where + " and Telephone like '%" + Telephone + "%'"
+		where = where + " and a.Telephone like '%" + Telephone + "%'"
 	}
 
 	if ProjectType != "" {
-		where = where + " and ProjectType like '%" + ProjectType + "%'"
+		where = where + " and a.ProjectType like '%" + ProjectType + "%'"
 	}
 
 	if ContractMode != "" {
-		where = where + " and ContractMode like '%" + ContractMode + "%'"
+		where = where + " and a.ContractMode like '%" + ContractMode + "%'"
 	}
 
 	if Amount != "" {
-		where = where + " and Amount like '%" + Amount + "%'"
+		where = where + " and a.Amount like '%" + Amount + "%'"
 	}
 
 	if ContractPeriod != "" {
-		where = where + " and ContractPeriod like '%" + ContractPeriod + "%'"
+		where = where + " and a.ContractPeriod like '%" + ContractPeriod + "%'"
 	}
 
 	if EndDate != "" {
-		where = where + " and EndDate like '%" + EndDate + "%'"
+		where = where + " and a.EndDate like '%" + EndDate + "%'"
 	}
 
 	if StartDate != "" {
-		where = where + " and StartDate like '%" + StartDate + "%'"
+		where = where + " and a.StartDate like '%" + StartDate + "%'"
 	}
 
 	if ConstructionUnit != "" {
-		where = where + " and ConstructionUnit like '%" + ConstructionUnit + "%'"
+		where = where + " and a.ConstructionUnit like '%" + ConstructionUnit + "%'"
 	}
 
 	if ConstructionOwner != "" {
-		where = where + " and ConstructionOwner like '%" + ConstructionOwner + "%'"
+		where = where + " and a.ConstructionOwner like '%" + ConstructionOwner + "%'"
 	}
 
 	if ConstructionTelphone != "" {
-		where = where + " and ConstructionTelphone like '%" + ConstructionTelphone + "%'"
+		where = where + " and a.ConstructionTelphone like '%" + ConstructionTelphone + "%'"
 	}
 
 	if BuildUnit != "" {
-		where = where + " and BuildUnit like '%" + BuildUnit + "%'"
+		where = where + " and a.BuildUnit like '%" + BuildUnit + "%'"
 	}
 
 	if BuildOwner != "" {
-		where = where + " and BuildOwner like '%" + BuildOwner + "%'"
+		where = where + " and a.BuildOwner like '%" + BuildOwner + "%'"
 	}
 
 	if BuildTelphone != "" {
-		where = where + " and BuildTelphone like '%" + BuildTelphone + "%'"
+		where = where + " and a.BuildTelphone like '%" + BuildTelphone + "%'"
 	}
 
 	if SuperviseUnit != "" {
-		where = where + " and SuperviseUnit like '%" + SuperviseUnit + "%'"
+		where = where + " and a.SuperviseUnit like '%" + SuperviseUnit + "%'"
 	}
 
 	if SuperviseOwner != "" {
-		where = where + " and SuperviseOwner like '%" + SuperviseOwner + "%'"
+		where = where + " and a.SuperviseOwner like '%" + SuperviseOwner + "%'"
 	}
 
 	if SuperviseTelphone != "" {
-		where = where + " and SuperviseTelphone like '%" + SuperviseTelphone + "%'"
+		where = where + " and a.SuperviseTelphone like '%" + SuperviseTelphone + "%'"
 	}
 
 	if QualityUnit != "" {
-		where = where + " and QualityUnit like '%" + QualityUnit + "%'"
+		where = where + " and a.QualityUnit like '%" + QualityUnit + "%'"
 	}
 
 	if QualityOwner != "" {
-		where = where + " and QualityOwner like '%" + QualityOwner + "%'"
+		where = where + " and a.QualityOwner like '%" + QualityOwner + "%'"
 	}
 
 	if QualityTelphone != "" {
-		where = where + " and QualityTelphone like '%" + QualityTelphone + "%'"
+		where = where + " and a.QualityTelphone like '%" + QualityTelphone + "%'"
 	}
 
 	if Remark != "" {
-		where = where + " and Remark like '%" + Remark + "%'"
+		where = where + " and a.Remark like '%" + Remark + "%'"
 	}
 
 	if IsDelete != "" {
-		where = where + " and IsDelete like '%" + IsDelete + "%'"
+		where = where + " and a.IsDelete like '%" + IsDelete + "%'"
 	}
 
 	//if CreateOn != "" {
-	//	where = where + " and CreateOn like '%" + CreateOn + "%'"
+	//	where = where + " and a.CreateOn like '%" + CreateOn + "%'"
 	//}
 
 	if CreateUserId != "" {
-		where = where + " and CreateUserId like '%" + CreateUserId + "%'"
+		where = where + " and a.CreateUserId like '%" + CreateUserId + "%'"
 	}
 
 	if CreateBy != "" {
-		where = where + " and CreateBy like '%" + CreateBy + "%'"
+		where = where + " and a.CreateBy like '%" + CreateBy + "%'"
 	}
 
 	if ModifiedOn != "" {
-		where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
+		where = where + " and a.ModifiedOn like '%" + ModifiedOn + "%'"
 	}
 
 	if ModifiedUserId != "" {
-		where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
+		where = where + " and a.ModifiedUserId like '%" + ModifiedUserId + "%'"
 	}
 
 	if ModifiedBy != "" {
-		where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
+		where = where + " and a.ModifiedBy like '%" + ModifiedBy + "%'"
 	}
 
 	if CreateOn != "" {
@@ -292,7 +293,7 @@ func (this *OilContractController) GetEntityList() {
 		if len(dates) == 2 {
 			minDate := dates[0]
 			maxDate := dates[1]
-			where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
+			where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
 		}
 	}
 
@@ -301,114 +302,114 @@ func (this *OilContractController) GetEntityList() {
 		if len(dates) == 2 {
 			minDate := dates[0]
 			maxDate := dates[1]
-			where = where + " and StartDate>='" + minDate + "' and EndDate<='" + maxDate + "'"
+			where = where + " and a.StartDate>='" + minDate + "' and a.EndDate<='" + maxDate + "'"
 		}
 	}
 
 	if SubPackage != "" {
-		where = where + " and SubPackage like '%" + SubPackage + "%'"
+		where = where + " and a.SubPackage like '%" + SubPackage + "%'"
 	}
 
 	if ContractName != "" {
-		where = where + " and ContractName like '%" + ContractName + "%'"
+		where = where + " and a.ContractName like '%" + ContractName + "%'"
 	}
 
 	if ContractSonClass != "" {
-		where = where + " and ContractSonClass like '%" + ContractSonClass + "%'"
+		where = where + " and a.ContractSonClass like '%" + ContractSonClass + "%'"
 	}
 
 	if SmallClass != "" {
-		where = where + " and SmallClass like '%" + SmallClass + "%'"
+		where = where + " and a.SmallClass like '%" + SmallClass + "%'"
 	}
 
 	if People != "" {
-		where = where + " and People like '%" + People + "%'"
+		where = where + " and a.People like '%" + People + "%'"
 	}
 
 	if Number != "" {
-		where = where + " and Number like '%" + Number + "%'"
+		where = where + " and a.Number like '%" + Number + "%'"
 	}
 
 	if ChooseWay != "" {
-		where = where + " and ChooseWay like '%" + ChooseWay + "%'"
+		where = where + " and a.ChooseWay like '%" + ChooseWay + "%'"
 	}
 
 	if ContractMark != "" {
-		where = where + " and ContractMark like '%" + ContractMark + "%'"
+		where = where + " and a.ContractMark like '%" + ContractMark + "%'"
 	}
 
 	if Currency != "" {
-		where = where + " and Currency like '%" + Currency + "%'"
+		where = where + " and a.Currency like '%" + Currency + "%'"
 	}
 
 	if BudgetAmount != "" {
-		where = where + " and BudgetAmount like '%" + BudgetAmount + "%'"
+		where = where + " and a.BudgetAmount like '%" + BudgetAmount + "%'"
 	}
 
 	if PerformAmount != "" {
-		where = where + " and PerformAmount like '%" + PerformAmount + "%'"
+		where = where + " and a.PerformAmount like '%" + PerformAmount + "%'"
 	}
 
 	if IsInternal != "" {
-		where = where + " and IsInternal like '%" + IsInternal + "%'"
+		where = where + " and a.IsInternal like '%" + IsInternal + "%'"
 	}
 
 	if IsForeign != "" {
-		where = where + " and IsForeign like '%" + IsForeign + "%'"
+		where = where + " and a.IsForeign like '%" + IsForeign + "%'"
 	}
 
 	if IsDeal != "" {
-		where = where + " and IsDeal like '%" + IsDeal + "%'"
+		where = where + " and a.IsDeal like '%" + IsDeal + "%'"
 	}
 
 	if MoneyFlows != "" {
-		where = where + " and MoneyFlows like '%" + MoneyFlows + "%'"
+		where = where + " and a.MoneyFlows like '%" + MoneyFlows + "%'"
 	}
 
 	if MoneyChannel != "" {
-		where = where + " and MoneyChannel like '%" + MoneyChannel + "%'"
+		where = where + " and a.MoneyChannel like '%" + MoneyChannel + "%'"
 	}
 
 	if MoneyChannelSon != "" {
-		where = where + " and MoneyChannelSon like '%" + MoneyChannelSon + "%'"
+		where = where + " and a.MoneyChannelSon like '%" + MoneyChannelSon + "%'"
 	}
 
 	if MoneyChannelSmall != "" {
-		where = where + " and MoneyChannelSmall like '%" + MoneyChannelSmall + "%'"
+		where = where + " and a.MoneyChannelSmall like '%" + MoneyChannelSmall + "%'"
 	}
 
 	if SingUnit != "" {
-		where = where + " and SingUnit like '%" + SingUnit + "%'"
+		where = where + " and a.SingUnit like '%" + SingUnit + "%'"
 	}
 
 	if Place != "" {
-		where = where + " and Place like '%" + Place + "%'"
+		where = where + " and a.Place like '%" + Place + "%'"
 	}
 
 	if DisputeResolution != "" {
-		where = where + " and DisputeResolution like '%" + DisputeResolution + "%'"
+		where = where + " and a.DisputeResolution like '%" + DisputeResolution + "%'"
 	}
 
 	if SubmitDate != "" {
-		where = where + " and SubmitDate like '%" + SubmitDate + "%'"
+		where = where + " and a.SubmitDate like '%" + SubmitDate + "%'"
 	}
 
 	if SealName != "" {
-		where = where + " and SealName like '%" + SealName + "%'"
+		where = where + " and a.SealName like '%" + SealName + "%'"
 	}
 
 	if PoNumber != "" {
-		where = where + " and PoNumber like '%" + PoNumber + "%'"
+		where = where + " and a.PoNumber like '%" + PoNumber + "%'"
 	}
 
 	if SignedDate != "" {
-		where = where + " and PoNumber like '%" + SignedDate + "%'"
+		where = where + " and a.PoNumber like '%" + SignedDate + "%'"
 	}
 
 	if ImportStatus != "" {
-		where = where + " and ImportStatus = " + ImportStatus
+		where = where + " and a.ImportStatus = " + ImportStatus
 	} else {
-		where = where + " and ImportStatus != 0"
+		where = where + " and a.ImportStatus != 0"
 	}
 
 	// 企管法规处可看所有合同, 获取企管法规处人员
@@ -423,12 +424,13 @@ func (this *OilContractController) GetEntityList() {
 	orgSvc.GetEntity(&settingProf, wherePAudit) // PROF_AUDIT
 	res2 := orgSvc.UserInRoleById(this.User.Id, strconv.Itoa(settingProf.RoleId))
 	if !res1 && !res2 {
-		where = where + " and SecondUnit= " + strconv.Itoa(this.User.UnitId)
+		where = where + " and a.SecondUnit= " + strconv.Itoa(this.User.UnitId)
 	}
 
 	svc := contract.GetOilContractService(utils.DBE)
 	var list []contract.OilContract
-	total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
+	//total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
+	total := svc.GetMyPagingEntitiesWithOrderByIsReview(OilContractName, OilContractReviewName, page.CurrentPage, page.Size, orderby, asc, &list, where, IsReview)
 	var datainfo DataInfo
 	datainfo.Items = list
 	datainfo.CurrentItemCount = total
@@ -447,7 +449,7 @@ func (this *OilContractController) ExportList() {
 	//获取分页信息
 	page := this.GetPageInfoForm()
 	where := " 1=1 "
-	orderby := "Id"
+	orderby := "a.Id"
 	asc := false
 	Order := this.GetString("Order")
 	Prop := this.GetString("Prop")
@@ -526,173 +528,174 @@ func (this *OilContractController) ExportList() {
 	ClassName := this.GetString("ClassName")
 	SecondUnit := this.GetString("SecondUnit")
 	ImportSecondUnit := this.GetString("ImportSecondUnit")
+	IsReview := this.GetString("IsReview")
 
 	if Id != "" {
-		where = where + " and Id like '%" + Id + "%'"
+		where = where + " and a.Id like '%" + Id + "%'"
 	}
 
 	if ContractClass != "" {
-		where = where + " and ContractClass='" + ContractClass + "' "
+		where = where + " and a.ContractClass='" + ContractClass + "' "
 	}
 
 	if SecondUnit != "" {
-		where = where + " and SecondUnit=" + SecondUnit + " "
+		where = where + " and a.SecondUnit=" + SecondUnit + " "
 	}
 
 	if ImportSecondUnit != "" {
-		where = where + " and SecondUnit=" + ImportSecondUnit + " "
+		where = where + " and a.SecondUnit=" + ImportSecondUnit + " "
 	}
 
 	if ClassName != "" {
-		where = where + " and ClassName='" + ClassName + "' "
+		where = where + " and a.ClassName='" + ClassName + "' "
 	}
 
 	if SupplierId != "" {
-		where = where + " and SupplierId like '%" + SupplierId + "%'"
+		where = where + " and a.SupplierId like '%" + SupplierId + "%'"
 	}
 
 	if SupplierName != "" {
-		where = where + " and SupplierName like '%" + SupplierName + "%'"
+		where = where + " and a.SupplierName like '%" + SupplierName + "%'"
 	}
 
 	if ImportSupplierName != "" {
-		where = where + " and ImportSupplierName like '%" + ImportSupplierName + "%'"
+		where = where + " and a.ImportSupplierName like '%" + ImportSupplierName + "%'"
 	}
 
 	if ImportUnitName != "" {
-		where = where + " and ImportSecondUnit like '%" + ImportUnitName + "%'"
+		where = where + " and a.ImportSecondUnit like '%" + ImportUnitName + "%'"
 	}
 
 	if Status != "" {
-		where = where + " and Status=" + Status + " "
+		where = where + " and a.Status=" + Status + " "
 	}
 
 	if SettleStatus != "" {
-		where = where + " and SettleStatus='" + SettleStatus + "' "
+		where = where + " and a.SettleStatus='" + SettleStatus + "' "
 	}
 
 	if ProjectName != "" {
-		where = where + " and ProjectName like '%" + ProjectName + "%'"
+		where = where + " and a.ProjectName like '%" + ProjectName + "%'"
 	}
 
 	if ContractNo != "" {
-		where = where + " and ContractNo like '%" + ContractNo + "%'"
+		where = where + " and a.ContractNo like '%" + ContractNo + "%'"
 	}
 
 	if ProjectPlace != "" {
-		where = where + " and ProjectPlace like '%" + ProjectPlace + "%'"
+		where = where + " and a.ProjectPlace like '%" + ProjectPlace + "%'"
 	}
 
 	if ProjectOwner != "" {
-		where = where + " and ProjectOwner like '%" + ProjectOwner + "%'"
+		where = where + " and a.ProjectOwner like '%" + ProjectOwner + "%'"
 	}
 
 	if Telephone != "" {
-		where = where + " and Telephone like '%" + Telephone + "%'"
+		where = where + " and a.Telephone like '%" + Telephone + "%'"
 	}
 
 	if ProjectType != "" {
-		where = where + " and ProjectType like '%" + ProjectType + "%'"
+		where = where + " and a.ProjectType like '%" + ProjectType + "%'"
 	}
 
 	if ContractMode != "" {
-		where = where + " and ContractMode like '%" + ContractMode + "%'"
+		where = where + " and a.ContractMode like '%" + ContractMode + "%'"
 	}
 
 	if Amount != "" {
-		where = where + " and Amount like '%" + Amount + "%'"
+		where = where + " and a.Amount like '%" + Amount + "%'"
 	}
 
 	if ContractPeriod != "" {
-		where = where + " and ContractPeriod like '%" + ContractPeriod + "%'"
+		where = where + " and a.ContractPeriod like '%" + ContractPeriod + "%'"
 	}
 
 	if EndDate != "" {
-		where = where + " and EndDate like '%" + EndDate + "%'"
+		where = where + " and a.EndDate like '%" + EndDate + "%'"
 	}
 
 	if StartDate != "" {
-		where = where + " and StartDate like '%" + StartDate + "%'"
+		where = where + " and a.StartDate like '%" + StartDate + "%'"
 	}
 
 	if ConstructionUnit != "" {
-		where = where + " and ConstructionUnit like '%" + ConstructionUnit + "%'"
+		where = where + " and a.ConstructionUnit like '%" + ConstructionUnit + "%'"
 	}
 
 	if ConstructionOwner != "" {
-		where = where + " and ConstructionOwner like '%" + ConstructionOwner + "%'"
+		where = where + " and a.ConstructionOwner like '%" + ConstructionOwner + "%'"
 	}
 
 	if ConstructionTelphone != "" {
-		where = where + " and ConstructionTelphone like '%" + ConstructionTelphone + "%'"
+		where = where + " and a.ConstructionTelphone like '%" + ConstructionTelphone + "%'"
 	}
 
 	if BuildUnit != "" {
-		where = where + " and BuildUnit like '%" + BuildUnit + "%'"
+		where = where + " and a.BuildUnit like '%" + BuildUnit + "%'"
 	}
 
 	if BuildOwner != "" {
-		where = where + " and BuildOwner like '%" + BuildOwner + "%'"
+		where = where + " and a.BuildOwner like '%" + BuildOwner + "%'"
 	}
 
 	if BuildTelphone != "" {
-		where = where + " and BuildTelphone like '%" + BuildTelphone + "%'"
+		where = where + " and a.BuildTelphone like '%" + BuildTelphone + "%'"
 	}
 
 	if SuperviseUnit != "" {
-		where = where + " and SuperviseUnit like '%" + SuperviseUnit + "%'"
+		where = where + " and a.SuperviseUnit like '%" + SuperviseUnit + "%'"
 	}
 
 	if SuperviseOwner != "" {
-		where = where + " and SuperviseOwner like '%" + SuperviseOwner + "%'"
+		where = where + " and a.SuperviseOwner like '%" + SuperviseOwner + "%'"
 	}
 
 	if SuperviseTelphone != "" {
-		where = where + " and SuperviseTelphone like '%" + SuperviseTelphone + "%'"
+		where = where + " and a.SuperviseTelphone like '%" + SuperviseTelphone + "%'"
 	}
 
 	if QualityUnit != "" {
-		where = where + " and QualityUnit like '%" + QualityUnit + "%'"
+		where = where + " and a.QualityUnit like '%" + QualityUnit + "%'"
 	}
 
 	if QualityOwner != "" {
-		where = where + " and QualityOwner like '%" + QualityOwner + "%'"
+		where = where + " and a.QualityOwner like '%" + QualityOwner + "%'"
 	}
 
 	if QualityTelphone != "" {
-		where = where + " and QualityTelphone like '%" + QualityTelphone + "%'"
+		where = where + " and a.QualityTelphone like '%" + QualityTelphone + "%'"
 	}
 
 	if Remark != "" {
-		where = where + " and Remark like '%" + Remark + "%'"
+		where = where + " and a.Remark like '%" + Remark + "%'"
 	}
 
 	if IsDelete != "" {
-		where = where + " and IsDelete like '%" + IsDelete + "%'"
+		where = where + " and a.IsDelete like '%" + IsDelete + "%'"
 	}
 
 	//if CreateOn != "" {
-	//	where = where + " and CreateOn like '%" + CreateOn + "%'"
+	//	where = where + " and a.CreateOn like '%" + CreateOn + "%'"
 	//}
 
 	if CreateUserId != "" {
-		where = where + " and CreateUserId like '%" + CreateUserId + "%'"
+		where = where + " and a.CreateUserId like '%" + CreateUserId + "%'"
 	}
 
 	if CreateBy != "" {
-		where = where + " and CreateBy like '%" + CreateBy + "%'"
+		where = where + " and a.CreateBy like '%" + CreateBy + "%'"
 	}
 
 	if ModifiedOn != "" {
-		where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
+		where = where + " and a.ModifiedOn like '%" + ModifiedOn + "%'"
 	}
 
 	if ModifiedUserId != "" {
-		where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
+		where = where + " and a.ModifiedUserId like '%" + ModifiedUserId + "%'"
 	}
 
 	if ModifiedBy != "" {
-		where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
+		where = where + " and a.ModifiedBy like '%" + ModifiedBy + "%'"
 	}
 
 	if CreateOn != "" {
@@ -700,7 +703,7 @@ func (this *OilContractController) ExportList() {
 		if len(dates) == 2 {
 			minDate := dates[0]
 			maxDate := dates[1]
-			where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
+			where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
 		}
 	}
 
@@ -709,114 +712,114 @@ func (this *OilContractController) ExportList() {
 		if len(dates) == 2 {
 			minDate := dates[0]
 			maxDate := dates[1]
-			where = where + " and StartDate>='" + minDate + "' and EndDate<='" + maxDate + "'"
+			where = where + " and a.StartDate>='" + minDate + "' and a.EndDate<='" + maxDate + "'"
 		}
 	}
 
 	if SubPackage != "" {
-		where = where + " and SubPackage like '%" + SubPackage + "%'"
+		where = where + " and a.SubPackage like '%" + SubPackage + "%'"
 	}
 
 	if ContractName != "" {
-		where = where + " and ContractName like '%" + ContractName + "%'"
+		where = where + " and a.ContractName like '%" + ContractName + "%'"
 	}
 
 	if ContractSonClass != "" {
-		where = where + " and ContractSonClass like '%" + ContractSonClass + "%'"
+		where = where + " and a.ContractSonClass like '%" + ContractSonClass + "%'"
 	}
 
 	if SmallClass != "" {
-		where = where + " and SmallClass like '%" + SmallClass + "%'"
+		where = where + " and a.SmallClass like '%" + SmallClass + "%'"
 	}
 
 	if People != "" {
-		where = where + " and People like '%" + People + "%'"
+		where = where + " and a.People like '%" + People + "%'"
 	}
 
 	if Number != "" {
-		where = where + " and Number like '%" + Number + "%'"
+		where = where + " and a.Number like '%" + Number + "%'"
 	}
 
 	if ChooseWay != "" {
-		where = where + " and ChooseWay like '%" + ChooseWay + "%'"
+		where = where + " and a.ChooseWay like '%" + ChooseWay + "%'"
 	}
 
 	if ContractMark != "" {
-		where = where + " and ContractMark like '%" + ContractMark + "%'"
+		where = where + " and a.ContractMark like '%" + ContractMark + "%'"
 	}
 
 	if Currency != "" {
-		where = where + " and Currency like '%" + Currency + "%'"
+		where = where + " and a.Currency like '%" + Currency + "%'"
 	}
 
 	if BudgetAmount != "" {
-		where = where + " and BudgetAmount like '%" + BudgetAmount + "%'"
+		where = where + " and a.BudgetAmount like '%" + BudgetAmount + "%'"
 	}
 
 	if PerformAmount != "" {
-		where = where + " and PerformAmount like '%" + PerformAmount + "%'"
+		where = where + " and a.PerformAmount like '%" + PerformAmount + "%'"
 	}
 
 	if IsInternal != "" {
-		where = where + " and IsInternal like '%" + IsInternal + "%'"
+		where = where + " and a.IsInternal like '%" + IsInternal + "%'"
 	}
 
 	if IsForeign != "" {
-		where = where + " and IsForeign like '%" + IsForeign + "%'"
+		where = where + " and a.IsForeign like '%" + IsForeign + "%'"
 	}
 
 	if IsDeal != "" {
-		where = where + " and IsDeal like '%" + IsDeal + "%'"
+		where = where + " and a.IsDeal like '%" + IsDeal + "%'"
 	}
 
 	if MoneyFlows != "" {
-		where = where + " and MoneyFlows like '%" + MoneyFlows + "%'"
+		where = where + " and a.MoneyFlows like '%" + MoneyFlows + "%'"
 	}
 
 	if MoneyChannel != "" {
-		where = where + " and MoneyChannel like '%" + MoneyChannel + "%'"
+		where = where + " and a.MoneyChannel like '%" + MoneyChannel + "%'"
 	}
 
 	if MoneyChannelSon != "" {
-		where = where + " and MoneyChannelSon like '%" + MoneyChannelSon + "%'"
+		where = where + " and a.MoneyChannelSon like '%" + MoneyChannelSon + "%'"
 	}
 
 	if MoneyChannelSmall != "" {
-		where = where + " and MoneyChannelSmall like '%" + MoneyChannelSmall + "%'"
+		where = where + " and a.MoneyChannelSmall like '%" + MoneyChannelSmall + "%'"
 	}
 
 	if SingUnit != "" {
-		where = where + " and SingUnit like '%" + SingUnit + "%'"
+		where = where + " and a.SingUnit like '%" + SingUnit + "%'"
 	}
 
 	if Place != "" {
-		where = where + " and Place like '%" + Place + "%'"
+		where = where + " and a.Place like '%" + Place + "%'"
 	}
 
 	if DisputeResolution != "" {
-		where = where + " and DisputeResolution like '%" + DisputeResolution + "%'"
+		where = where + " and a.DisputeResolution like '%" + DisputeResolution + "%'"
 	}
 
 	if SubmitDate != "" {
-		where = where + " and SubmitDate like '%" + SubmitDate + "%'"
+		where = where + " and a.SubmitDate like '%" + SubmitDate + "%'"
 	}
 
 	if SealName != "" {
-		where = where + " and SealName like '%" + SealName + "%'"
+		where = where + " and a.SealName like '%" + SealName + "%'"
 	}
 
 	if PoNumber != "" {
-		where = where + " and PoNumber like '%" + PoNumber + "%'"
+		where = where + " and a.PoNumber like '%" + PoNumber + "%'"
 	}
 
 	if SignedDate != "" {
-		where = where + " and PoNumber like '%" + SignedDate + "%'"
+		where = where + " and a.PoNumber like '%" + SignedDate + "%'"
 	}
 
 	if ImportStatus != "" {
-		where = where + " and ImportStatus = " + ImportStatus
+		where = where + " and a.ImportStatus = " + ImportStatus
 	} else {
-		where = where + " and ImportStatus != 0"
+		where = where + " and a.ImportStatus != 0"
 	}
 
 	// 企管法规处可看所有合同, 获取企管法规处人员
@@ -831,12 +834,12 @@ func (this *OilContractController) ExportList() {
 	orgSvc.GetEntity(&settingProf, wherePAudit) // PROF_AUDIT
 	res2 := orgSvc.UserInRoleById(this.User.Id, strconv.Itoa(settingProf.RoleId))
 	if !res1 && !res2 {
-		where = where + " and SecondUnit= " + strconv.Itoa(this.User.UnitId)
+		where = where + " and a.SecondUnit= " + strconv.Itoa(this.User.UnitId)
 	}
 
 	svc := contract.GetOilContractService(utils.DBE)
 	var list []contract.OilContract
-	svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
+	svc.GetMyPagingEntitiesWithOrderByIsReview(OilContractName, OilContractReviewName, page.CurrentPage, page.Size, orderby, asc, &list, where, IsReview)
 
 	fileTitle := "合同列表"
 	//自定义显示列
@@ -1718,17 +1721,17 @@ func (this *OilContractController) UpdateEntity() {
 		model.SupplierId = supp.Id
 	}
 
-	if model.Status == 3 {
-		var review contractReview.OilContractReview
-		svc.GetEntityByWhere(OilContractReviewName, "Status = 8 and ContractId = '" + strconv.Itoa(model.Id) + "'", &review)
-		if review.Id == 0 {
-			errinfo.Message = "没有已完成评价不能选履行完毕!"
-			errinfo.Code = -1
-			this.Data["json"] = &errinfo
-			this.ServeJSON()
-			return
-		}
-	}
+	//if model.Status == 3 {
+	//	var review contractReview.OilContractReview
+	//	svc.GetEntityByWhere(OilContractReviewName, "Status = 8 and ContractId = '" + strconv.Itoa(model.Id) + "'", &review)
+	//	if review.Id == 0 {
+	//		errinfo.Message = "没有已完成评价不能选履行完毕!"
+	//		errinfo.Code = -1
+	//		this.Data["json"] = &errinfo
+	//		this.ServeJSON()
+	//		return
+	//	}
+	//}
 
 	err := svc.UpdateEntityBytbl(OilContractName, id, &model, cols)
 	if err == nil {

+ 8 - 0
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/index.vue

@@ -54,6 +54,13 @@
               <el-option label="服务商" value="03" key="04"></el-option>
             </el-select>
           </el-form-item>
+          <el-form-item label="有无评价">
+            <el-select size="mini" v-model="searchForm.IsReview" placeholder="请选择" style="width: 90px">
+              <el-option label="全部" value="0" key="0"></el-option>
+              <el-option label="已创建评价" value="1" key="1"></el-option>
+              <el-option label="未创建评价" value="2" key="2"></el-option>
+            </el-select>
+          </el-form-item>
 <!--          <el-form-item label="创建时间">-->
 <!--            <el-date-picker size="mini" style="width: 180px" v-model="CreateOn" type="daterange" range-separator="至"-->
 <!--                            start-placeholder="开始" end-placeholder="结束"></el-date-picker>-->
@@ -726,6 +733,7 @@
         searchForm: {
           Id: '',
           SupplierId: '',
+          IsReview: '2',
           SecondUnit: '',
           ContractClass: '',
           ImportSecondUnit: '',