Browse Source

【供应商资源库接口】分页调整

dongbw 7 years ago
parent
commit
2a6f375c23

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

@@ -339,7 +339,7 @@ public class VendorsServiceImpl implements VendorService {
 		// 因为需求更改为所有有销售产品的企业都会被返回,所以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 <> ")
-				.append(enUU).append(" group by en_uu)");
+				.append(enUU).append(" and ").append(productMatchCondition).append(" and ").append(enterpriseMatchCondition).append(" group by en_uu)");
 //        System.out.println("SQL:" + vendorRecommendUusSql.toString());
 //        System.out.println("NUM_SQL:" + totalSql.toString());
 		Integer total = commonDao.queryForObject(totalSql.toString(), Integer.class);
@@ -453,10 +453,12 @@ public class VendorsServiceImpl implements VendorService {
 	@Override
 	public com.uas.account.support.Page<Product> getProductsByVendorRecommend(int page, int size, Long vendUU, String productMatchCondition, String whereCondition) {
 		System.out.println("进入方法:" + System.currentTimeMillis());
+		if (!StringUtils.isEmpty(whereCondition)) {
+			whereCondition = " 1 = 1 ";
+		}
 		long start = System.currentTimeMillis();
 		// UAS企业UU
 		Long enUU = SystemSession.getUser().getEnterprise().getUu();
-		// 先查询当前企业的采购物料(待购&&不在售)的标准物料标准料号
 		StringBuffer cmpCodesSql = new StringBuffer();
 		cmpCodesSql.append("select 1 from v$products where pr_cmpcode = p1.pr_cmpcode and pr_enuu = ")
 				.append(enUU).append(" and pr_b2bdisabled <> 1 ");
@@ -475,8 +477,7 @@ public class VendorsServiceImpl implements VendorService {
 				.append(null != whereCondition ? whereCondition : "").append(" order by pr_code desc)");
 		// 物料id
 		StringBuffer idSql = new StringBuffer();
-		String countSql = "select count(1) from v$products where pr_enuu = " + vendUU
-				+ " and pr_b2bdisabled <> 1";
+		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)