Просмотр исходного кода

Merge branch 'dev' into dev-mysql

dongbw 8 лет назад
Родитель
Сommit
c24a8a7e30
1 измененных файлов с 17 добавлено и 14 удалено
  1. 17 14
      src/main/java/com/uas/platform/b2b/service/impl/VendorsServiceImpl.java

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

@@ -333,18 +333,19 @@ public class VendorsServiceImpl implements VendorService {
 		StringBuffer enterpriseSql = new StringBuffer();
 		enterpriseSql.append("select en.en_uu, en.en_name, en.en_shortname, en.en_address, en.en_tel, en.en_email, en.en_corporation, en.en_businesscode, en.en_profession, en.en_tags, en.en_contactman, en.en_contacttel from sec$enterprises en right join (" +
 				" select en_uu, count(1) as counts from sec$enterprises left join v$products on en_uu = pr_enuu where ").append(productMatchCondition).append(" 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" +
+				.append(enUU).append(" and en_name not like '%测试%' and lower(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, counts desc");
 		// rownum 控制
 		String rownumSql = ") t where rownum <= " + page * size + ") s where r1 > " + (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).append(" and pr_issale = 1 and pr_b2bdisabled <> 1  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(productMatchCondition).append(" and pr_issale = 1 and pr_b2bdisabled <> 1 and instr(Pr_Title,'测试')<1 and instr(lower(Pr_Title),'test')<1 " +
+				" 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);
 		// 因为需求更改为所有有销售产品的企业都会被返回,所以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 en_name not like '%测试%' and en_name not like '%test%' and en_uu <> ")
+				" v$products on en_uu = pr_enuu where en_name not like '%测试%' and lower(en_name) not like '%test%' and 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());
@@ -379,20 +380,20 @@ public class VendorsServiceImpl implements VendorService {
 //		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 nvl(pr_issale,0) <> 1 and pr_ispurchase = 1 and pr_b2bdisabled <> 1 ");
+					.append(enUU).append(" and nvl(pr_issale,0) <> 1 and pr_ispurchase = 1 and pr_b2bdisabled <> 1 and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%' ");
 //			if (null != productMatchCondition) {
 //				cmpCodesSql.append(" and ").append(productMatchCondition);
 //			}
 			// 查找匹配在售物料的语句
 			StringBuffer productsMatchSql = new StringBuffer();
-			productsMatchSql.append("select pr_id from (select pr_id from v$products p1 where exists (").append(cmpCodesSql)
-					.append(") and p1.pr_enuu = ").append(vendUU).append(" and p1.pr_issale = 1 and p1.pr_b2bdisabled <> 1 and ")
-					.append(whereCondition).append(" order by pr_code desc)");
+			productsMatchSql.append("select pr_id from (select pr_id from v$products p1 where exists (").append(cmpCodesSql).append(") and p1.pr_enuu = ").append(vendUU)
+					.append(" and p1.pr_issale = 1 and p1.pr_b2bdisabled <> 1 and p1.Pr_Title not like '%测试%' and lower(p1.Pr_Title) not like '%test%' and p1.Pr_code not like '%测试%' and lower(p1.Pr_code) not like '%test%' and ")
+					.append(whereCondition).append(" order by pr_standard desc, pr_id desc)");
 			// 查找不匹配但是在售物料的语句  union all 方便排序
 			StringBuffer notMatchProductsSql = new StringBuffer();
-			notMatchProductsSql.append("select pr_id from (select pr_id from v$products p1 where not exists (").append(cmpCodesSql)
-					.append(") and p1.pr_enuu = ").append(vendUU).append(" and p1.pr_issale = 1 and p1.pr_b2bdisabled <> 1 and ")
-					.append(whereCondition).append(" order by pr_code desc)");
+			notMatchProductsSql.append("select pr_id from (select pr_id from v$products p1 where not exists (").append(cmpCodesSql).append(") and p1.pr_enuu = ").append(vendUU)
+					.append(" and p1.pr_issale = 1 and p1.pr_b2bdisabled <> 1 and p1.Pr_Title not like '%测试%' and lower(p1.Pr_Title) not like '%test%' and p1.Pr_code not like '%测试%' and lower(p1.Pr_code) not like '%test%' and ")
+					.append(whereCondition).append(" order by pr_standard desc, pr_id desc)");
 			// 物料id
 			StringBuffer idSql = new StringBuffer();
 			// rownum 控制
@@ -417,13 +418,15 @@ public class VendorsServiceImpl implements VendorService {
 		} else {
 			String prodSql = "select a.* from (select t.*,rownum as r1 from (select pr_id id, pr_code code, pr_title title, pr_spec spec, pr_cmpcode cmpCode, pr_unit unit, pr_kind kind, "
 					+ "pr_minpack minPack, pr_minOrder minOrder, pr_brand brand, pr_standard standard, pr_issale isSale, pr_ispurchase isPurchase from v$products where pr_enuu = "
-					+ vendUU + " and pr_issale = 1 and pr_b2bdisabled <> 1 and " + whereCondition
-					+ " order by pr_issale desc, pr_standard desc, pr_id desc) t where rownum <= " + page * size + ") a where r1 > " + (page - 1) * size;
+					+ vendUU + " and pr_issale = 1 and pr_b2bdisabled <> 1 and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%' and "
+					+ whereCondition + " order by pr_issale desc, pr_standard desc, pr_id desc) t where rownum <= " + page * size + ") a where r1 > " + (page - 1) * size;
 			System.out.println("无UU:" + prodSql);
 			products = commonDao.query(prodSql, Product.class);
 
 		}
-		String countSql = "select count(1) from v$products where pr_enuu = " + vendUU + " and pr_issale = 1 and pr_b2bdisabled <> 1 and " + whereCondition;
+		String countSql = "select count(1) from v$products where pr_enuu = " + vendUU
+				+ " and pr_issale = 1 and pr_b2bdisabled <> 1 and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%' and "
+				+ whereCondition;
 		Integer count = commonDao.queryForObject(countSql, Integer.class);
 //		System.out.println("count:" + countSql);
 		return new com.uas.account.support.Page<>(page, size, products, count);