|
|
@@ -64,9 +64,10 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
+ keyword + "%') ";
|
|
|
}
|
|
|
long start = System.currentTimeMillis();
|
|
|
+ // and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%'
|
|
|
String prodSql = "select a.* from (select pr_id id, pr_code prodNum, pr_title prodName, pr_spec spec, pr_cmpcode cmpCode, pr_unit unit, pr_kind kind, "
|
|
|
+ " pr_brand brand, pr_standard standard from v$product$private where ifnull(pr_b2cenabled, 1) <> 0 and pr_enuu = "
|
|
|
- + vendUU + " and pr_issale = 1 and ifnull(pr_b2cenabled, 1) <> 0 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 "
|
|
|
+ + vendUU + " and pr_issale = 1 and ifnull(pr_b2cenabled, 1) <> 0 and "
|
|
|
+ whereCondition + " order by pr_issale desc, pr_standard desc, pr_id desc) a limit " + (page - 1) * size + "," + size;
|
|
|
System.out.println("prod:" + prodSql);
|
|
|
String countSql = "select count(1) from v$product$private where pr_enuu = " + vendUU
|
|
|
@@ -107,13 +108,13 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
" from sec$enterprises en right join (").append(enUUSql)
|
|
|
.append(" ) a on en.en_uu = a.en_uu order by en.en_weight desc, counts desc");
|
|
|
// rownum 控制
|
|
|
- String rownumSql = ") s limit " + (page - 1) * size + "," + size ;
|
|
|
+ String rownumSql = ") s order by isStore desc limit " + (page - 1) * size + "," + size ;
|
|
|
// // 查询企业简要物料信息语句
|
|
|
// String prodInfoSql = "select wm_concat(pr_title || (case when pr_brand is not null then '(' || pr_brand || ')' else ' ' end)) from v$product$private where pr_enuu=en_uu and "
|
|
|
// + " and pr_issale = 1 and pr_b2cenabled = 1 and rownum<5 ";
|
|
|
// 查询企业是否开店语句
|
|
|
// 查找非供应商的卖当前商品的企业UU
|
|
|
- String vendorIntroductionUusSql = "select s.*, ( select 1 from store$info where st_enuu = enUU) isStore, " +
|
|
|
+ String vendorIntroductionUusSql = "select s.*, ( select 1 from store$info where st_enuu = enUU and st_status = 'OPENED') isStore, " +
|
|
|
"(select 1 from v$product$private where ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 and pr_enuu = enUU limit 0,1) hasProduct from ("
|
|
|
+ enterpriseSql + rownumSql;
|
|
|
// String vendorIntroductionUusSql = "select s.*,( " + prodInfoSql + ") productInfo, (" + storeSql +
|
|
|
@@ -148,7 +149,8 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
* @return
|
|
|
*/
|
|
|
private String getKeywordSql(Long enUU, String keyword) {
|
|
|
- return "select en_uu,count(1) as counts from sec$enterprises left join products on pr_enuu = en_uu where en_name not like '%测试%' and lower(en_name) not like '%test%' and (en_name like '%"
|
|
|
+ return "select en_uu,count(1) as counts from sec$enterprises left join products on pr_enuu = en_uu where en_name not like '%测试%' " +
|
|
|
+ "and lower(en_name) not like '%test%' and pr_issale = 1 and (en_name like '%"
|
|
|
+ keyword + "%' or en_address like '%" + keyword + "%' or en_industry like '%" + keyword
|
|
|
+ "%' or pr_cmpcode like '%" + keyword + "%' or pr_brand like '%" + keyword
|
|
|
+ "%') and en_uu <> " + enUU;
|
|
|
@@ -167,7 +169,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
enUUSql.append(getKeywordSql(enUU, keyword));
|
|
|
} else {
|
|
|
enUUSql.append("select en_uu, count(1) as counts from (select * from sec$enterprises where en_name not like '%测试%' " +
|
|
|
- " and lower(en_name) not like '%test%') en left join products on en.en_uu = pr_enuu where en.en_uu <> ").append(enUU);
|
|
|
+ " and lower(en_name) not like '%test%') en left join products on en.en_uu = pr_enuu where pr_issale = 1 and en.en_uu <> ").append(enUU);
|
|
|
}
|
|
|
enUUSql.append(" group by en_uu order by count(1) desc ");
|
|
|
return enUUSql.toString();
|