Hu Jie 8 лет назад
Родитель
Сommit
dd850f0ac4

+ 8 - 8
src/main/java/com/uas/platform/b2b/service/impl/VendorsServiceImpl.java

@@ -329,13 +329,13 @@ public class VendorsServiceImpl implements VendorService {
 				" and en_uu <> ").append(enUU).append(" and en_name not like '%测试%' and en_name not like '%test%' and ").append(enterpriseMatchCondition).append(" group by en_uu order by count(1) desc" +
 				" ) a on en.en_uu = a.en_uu order by en.en_weight desc");
 		// rownum 控制
-		String rownumSql = ") t where rownum <= " + page * size + ") s where r1 > " + (page - 1) * size;
+		String rownumSql = ") t limit " + (page - 1) * size+ "," + (page * size - (page - 1) * size)  ;
 		// 查找非供应商的卖当前商品的企业UU
 		StringBuffer vendorRecommendUusSql = new StringBuffer();
-		vendorRecommendUusSql.append("select s.*,( select wm_concat(pr_title || (case when pr_brand is not null then '(' || pr_brand || ')' else ' ' end)) from v$products where pr_enuu=en_uu and ").append(productMatchCondition)
+		vendorRecommendUusSql.append("select t.*,( select group_concat(pr_title || (case when pr_brand is not null then '(' || pr_brand || ')' else ' ' end)) from v$products where pr_enuu=en_uu and ").append(productMatchCondition)
 				.append(" and exists (select 1 from v$products B where B.pr_cmpcode = pr_cmpcode and B.pr_enuu = ").append(enUU)
-				.append(") and rownum<5 ) productInfo, (select 1 from purc$vendors where ve_vendenuu = en_uu and ve_myenuu = ")
-				.append(enUU).append(") isVendor from (select t.*,rownum as r1 from (").append(enterpriseSql).append(rownumSql);
+				.append(") and limit 4 ) productInfo, (select 1 from purc$vendors where ve_vendenuu = en_uu and ve_myenuu = ")
+				.append(enUU).append(") isVendor from (").append(enterpriseSql).append(rownumSql);
 		// 因为需求更改为所有有销售产品的企业都会被返回,所以total直接取除本企业外其他有销售产品的企业数即可,之前的匹配企业数不再返回
 		StringBuffer totalSql = new StringBuffer().append(" select count(1) from (select en_uu from sec$enterprises left join " +
 				" v$products on en_uu = pr_enuu where pr_b2bdisabled <> 1 and en_name not like '%测试%' and en_name not like '%test%' and en_uu <> ")
@@ -479,8 +479,8 @@ public class VendorsServiceImpl implements VendorService {
 		StringBuffer idSql = new StringBuffer();
 		String countSql = "select count(1) from v$products where pr_enuu = " + vendUU + " and pr_b2bdisabled <> 1 and " + whereCondition;
 		// rownum 控制
-		String rownumSql = " t where rownum <= " + page * size + ") where r1 > " + (page - 1) * size;
-		idSql.append("select pr_id from (select t.*,rownum as r1 from (").append(productsMatchSql).append(" union all ").append(notMatchProductsSql)
+		String rownumSql = " t limit" + (page - 1) * size + ", " + (page * size -(page - 1) * size);
+		idSql.append("select pr_id from (").append(productsMatchSql).append(" union all ").append(notMatchProductsSql)
 				.append(")").append(rownumSql);
 		List<Long> matchedIds = commonDao.queryForList(productsMatchSql.toString(), Long.class);
 		Integer count = commonDao.queryForObject(countSql, Integer.class);
@@ -490,8 +490,8 @@ public class VendorsServiceImpl implements VendorService {
 		    Product product = productDao.findOne(id);
 		    if (matchedIds.contains(id)) {
 		    	StringBuffer matchCodeSql = new StringBuffer();
-		    	matchCodeSql.append("select wm_concat(pr_code) from v$products where pr_b2bdisabled <> 1 and pr_enuu = ")
-						.append(enUU).append(" and pr_cmpcode = '").append(product.getCmpCode()).append("'").append(" and rownum <= 20");
+		    	matchCodeSql.append("select group_concat(pr_code) from v$products where pr_b2bdisabled <> 1 and pr_enuu = ")
+						.append(enUU).append(" and pr_cmpcode = '").append(product.getCmpCode()).append("'").append(" and limit 20");
 		    	String matchCodes = commonDao.queryForObject(matchCodeSql.toString(), String.class);
 		    	product.setIfMatched(matchCodes);
 			}