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

后端: 年度评价汇总导出sql

baichengfei 4 éve
szülő
commit
08d22b2097

+ 13 - 0
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScoreService.go

@@ -87,6 +87,10 @@ func (s *OilContractSumScoreService) GetPagingComputeEntitiesWithOrderBytbl(page
 	sqlCount += ` select contract.SupplierId from ` + controllers.OilContractReviewName + ` review `
 	sqlCount += ` left join ` + controllers.OilContractName + ` contract on review.ContractId=contract.id `
 	sqlCount += ` left join ` + controllers.OilContractEvaluationItemsName + ` items on items.ContentReviewId=review.id and items.LevelCode=1 `
+	// 2021年03月28日新增4个字段查询 开始 ↓↓↓↓↓↓↓↓↓ 后又加合同总金额
+	//sqlCount += ` left join ` + controllers.OilSupplierName + ` supplier on supplier.Id=Contract.SupplierId `
+	//sqlCount += ` left join ` + controllers.OilSupplierCertName + ` cert on cert.SupplierId=supplier.Id and SupplierTypeCode='01'`
+	// 2021年03月28日新增4个字段查询 结束 ↑↑↑↑↑↑↑↑↑
 	sqlCount += ` where ` + where
 	sqlCount += ` group by contract.SupplierId,contract.SupplierName `
 	sqlCount += ` ) t `
@@ -94,6 +98,13 @@ func (s *OilContractSumScoreService) GetPagingComputeEntitiesWithOrderBytbl(page
 	var sql string
 	where1 := ""
 	sql = `select YEAR(NOW()) as Year,contract.ContractClass,contract.SupplierId,contract.SupplierName,count(review.id) as count, `
+	// 2021年03月28日新增4个字段查询 开始 ↓↓↓↓↓↓↓↓↓ 后又加合同总金额
+	//sql += ` supplier.OperType as "OperType",cert.AccessCardNo as "AccessCardNo", `
+	//sql += ` case max(cert.InStyle) when '1' then '评审准入' when '2' then '一级物资备案准入' when '3' then '二级物资备案准入' when '4' then '战略合作准入' when '5' then '内部多元准入' when '6' then '招标准入' else '' end  as "InStyle", `
+	//sql += ` case max(supplier.Grade) when '1' then '一级' when '2' then '二级' else '' end as "supplierGrade", `
+	//sql += ` case max(cert.Status) when '8' then '已准入' when '11' then '已准入' else '未准入' end as "certStatus", `
+	//sql += ` case max(cert.Status) when '8' then '已准入' when '11' then '已准入' else '未准入' end as "certStatus", `
+	// 2021年03月28日新增4个字段查询 结束 ↑↑↑↑↑↑↑↑↑
 
 	sql += ` sum(case when items.SequenceNo in  ('1') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B1, `
 	sql += ` sum(case when items.SequenceNo in  ('2') AND items.Type = 2 AND items.Value > 0 then 1 else 0 end )  B2, `
@@ -123,6 +134,8 @@ func (s *OilContractSumScoreService) GetPagingComputeEntitiesWithOrderBytbl(page
 	sql += ` from ` + controllers.OilContractReviewName + ` review `
 	sql += ` left join ` + controllers.OilContractName + ` contract on review.ContractId=contract.id `
 	sql += ` left join ` + controllers.OilContractEvaluationItemsName + ` items on items.ContentReviewId=review.id and items.LevelCode=1 ` + where1
+	//sql += ` left join ` + controllers.OilSupplierName + ` supplier on supplier.Id=contract.SupplierId `
+	//sql += ` left join ` + controllers.OilSupplierCertName + ` cert on cert.SupplierId=supplier.Id and SupplierTypeCode='01'`
 	sql += ` where ` + where
 	sql += ` group by contract.SupplierId,contract.SupplierName `
 	sql += ` having ` + having