|
|
@@ -67,12 +67,12 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
// 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 "
|
|
|
- + whereCondition + " order by pr_issale desc, pr_standard desc, pr_id desc) a limit " + (page - 1) * size + "," + size;
|
|
|
+ + vendUU + " and pr_issale = 1 and " + whereCondition
|
|
|
+ + " order by pr_issale desc, pr_standard desc, pr_id desc) a limit " + (page - 1) * size + "," + size;
|
|
|
System.out.println("prod:" + prodSql);
|
|
|
+ // 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 countSql = "select count(1) from v$product$private where 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 "
|
|
|
- + whereCondition;
|
|
|
+ + " and pr_issale = 1 and ifnull(pr_b2cenabled, 1) <> 0 and " + whereCondition;
|
|
|
Integer count = commonDao.queryForObject(countSql, Integer.class);
|
|
|
List<V_ProductPrivate> products = commonDao.query(prodSql, V_ProductPrivate.class);
|
|
|
System.out.println("耗时" + (System.currentTimeMillis() - start));
|
|
|
@@ -108,17 +108,19 @@ 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 order by isStore desc limit " + (page - 1) * size + "," + size ;
|
|
|
+ String rownumSql = ") s order by isStore desc,prodCounts 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 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 ("
|
|
|
+ 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,"
|
|
|
+ + "(select count(1) from v$product$private where ifnull(pr_b2cenabled, 1) = 1 and pr_enuu = enUU and pr_issale = 1) prodCounts from ("
|
|
|
+ enterpriseSql + rownumSql;
|
|
|
// String vendorIntroductionUusSql = "select s.*,( " + prodInfoSql + ") productInfo, (" + storeSql +
|
|
|
// ") isStore from (select t.*,rownum as r1 from (" + enterpriseSql + rownumSql;
|
|
|
+ System.out.println("ens:" + vendorIntroductionUusSql);
|
|
|
return commonDao.query(vendorIntroductionUusSql, VendorIntroduction.class);
|
|
|
}
|
|
|
|
|
|
@@ -139,6 +141,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
" and lower(en_name) not like '%test%') en left join products on en.en_uu = pr_enuu where en_uu <> ").append(enUU);
|
|
|
}
|
|
|
enCountSql.append(" group by en_uu ) a");
|
|
|
+ System.out.println("en_count:" + enCountSql.toString());
|
|
|
return commonDao.queryForObject(enCountSql.toString(), Integer.class);
|
|
|
}
|
|
|
|
|
|
@@ -149,11 +152,11 @@ 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 pr_issale = 1 and (en_name like '%"
|
|
|
+ return "select en_uu,count(1) as counts from sec$enterprises left join v$product$private on pr_enuu = en_uu where en_name not like '%测试%' " +
|
|
|
+ "and lower(en_name) not like '%test%' 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;
|
|
|
+ + "%') or ((pr_cmpcode like '%" + keyword + "%' or pr_brand like '%" + keyword
|
|
|
+ + "%') and ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 )) and en_uu <> " + enUU;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -169,7 +172,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 pr_issale = 1 and en.en_uu <> ").append(enUU);
|
|
|
+ " and lower(en_name) not like '%test%') en left join products on en.en_uu = pr_enuu where en.en_uu <> ").append(enUU);
|
|
|
}
|
|
|
enUUSql.append(" group by en_uu order by count(1) desc ");
|
|
|
return enUUSql.toString();
|