|
|
@@ -36,7 +36,13 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
@Override
|
|
|
public Page<VendorIntroduction> getVendorIntroduction(int page, int size, String keyword) {
|
|
|
long start = System.currentTimeMillis();
|
|
|
- Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ if (!StringUtils.isEmpty(keyword)) {
|
|
|
+ keyword = keyword.trim();
|
|
|
+ }
|
|
|
+ Long enUU = 0L;
|
|
|
+ if (null != SystemSession.getUser()) {
|
|
|
+ enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ }
|
|
|
// 查询所有物料个数
|
|
|
Integer total = getTotalCount(enUU, keyword);
|
|
|
// 查询企业
|
|
|
@@ -58,6 +64,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
public Page<V_ProductPrivate> getVendorProductList(int page, int size, Long vendUU, String keyword) {
|
|
|
String whereCondition = " 1 = 1 ";
|
|
|
if (!StringUtils.isEmpty(keyword)) {
|
|
|
+ keyword = keyword.trim();
|
|
|
// 物料名称、规格、品牌、原厂型号、单位
|
|
|
whereCondition = " (pr_title like '%" + keyword + "%' or pr_spec like '%" + keyword + "%' or pr_brand like '%"
|
|
|
+ keyword + "%' or pr_cmpcode like '%" + keyword + "%' or pr_unit like '%" + keyword + "%' or pr_kind like '%"
|
|
|
@@ -66,13 +73,13 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
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 " + whereCondition
|
|
|
+ + " pr_brand brand, pr_pbranden pbranden, pr_standard standard from v$product$private where ifnull(pr_b2cenabled, 1) <> 0 and pr_enuu = "
|
|
|
+ + vendUU + " and pr_issale = 1 and pr_pbranden is not null and pr_pcmpcode is not null 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 " + whereCondition;
|
|
|
+ + " and pr_issale = 1 and pr_pbranden is not null and pr_pcmpcode is not null 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,15 +115,17 @@ 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,prodCounts desc limit " + (page - 1) * size + "," + size ;
|
|
|
+ String rownumSql = ") s order by isStore desc,prodCounts desc,enUU asc 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,"
|
|
|
- + "(select count(1) from v$product$private where ifnull(pr_b2cenabled, 1) = 1 and pr_enuu = enUU and pr_issale = 1) prodCounts from ("
|
|
|
+ + "(select 1 from v$product$private where ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 and pr_pbranden is not null " +
|
|
|
+ "and pr_pcmpcode is not null and pr_enuu = enUU limit 0,1) hasProduct,"
|
|
|
+ + "(select count(1) from v$product$private where ifnull(pr_b2cenabled, 1) = 1 " +
|
|
|
+ "and pr_pbranden is not null and pr_pcmpcode is not null 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;
|
|
|
@@ -156,7 +165,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
"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 ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 )) and en_uu <> " + enUU;
|
|
|
+ + "%') and ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 and pr_pbranden is not null and pr_pcmpcode is not null)) and en_uu <> " + enUU;
|
|
|
}
|
|
|
|
|
|
/**
|