Commit 0019fa51 authored by chang20170705's avatar chang20170705

limit

parent 6c807939
...@@ -125,7 +125,11 @@ public class BrandController { ...@@ -125,7 +125,11 @@ public class BrandController {
Map<String,Object> params=new HashMap<>(); Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("OrgNO")); params.put("OrgNO", request.getParameter("OrgNO"));
params.put("CompNO", request.getParameter("CompNO")); params.put("CompNO", request.getParameter("CompNO"));
listMap=brandService.getHotSaleBrands(params); Page page=new Page();
page.setIndex(1l);
page.setLimit(20l);
page.setLimitKey("SaleQty desc");
listMap=brandService.getHotSaleBrands(params,page);
return Rjx.jsonOk().set("list", listMap).toJson(); return Rjx.jsonOk().set("list", listMap).toJson();
} }
......
...@@ -84,7 +84,11 @@ public class GoodsController { ...@@ -84,7 +84,11 @@ public class GoodsController {
Map<String,Object> params=new HashMap<>(); Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("OrgNO")); params.put("OrgNO", request.getParameter("OrgNO"));
params.put("CompNO", request.getParameter("CompNO")); params.put("CompNO", request.getParameter("CompNO"));
listMap=goodsService.getHotSaleGoods(params); Page page=new Page();
page.setIndex(1l);
page.setLimit(20l);
page.setLimitKey("SaleQty desc");
listMap=goodsService.getHotSaleGoods(params,page);
return Rjx.jsonOk().set("list", listMap).toJson(); return Rjx.jsonOk().set("list", listMap).toJson();
} }
} }
...@@ -11,5 +11,5 @@ public interface BrandService { ...@@ -11,5 +11,5 @@ public interface BrandService {
public List<Map<String,Object>> getBrandList(Map<String,Object> map); public List<Map<String,Object>> getBrandList(Map<String,Object> map);
public List <Map<String,Object>> getHotSaleBrands(Map<String,Object> map); public List <Map<String,Object>> getHotSaleBrands(Map<String,Object> map, Page page);
} }
...@@ -9,5 +9,5 @@ public interface GoodsService { ...@@ -9,5 +9,5 @@ public interface GoodsService {
public List<Map<String,Object>> listThinkLike(Map<String,Object> params, Page page); public List<Map<String,Object>> listThinkLike(Map<String,Object> params, Page page);
public List<Map<String,Object>> getHotSaleGoods(Map<String,Object> map); public List<Map<String,Object>> getHotSaleGoods(Map<String,Object> map, Page page);
} }
...@@ -47,8 +47,8 @@ public class BrandServiceImpl implements BrandService { ...@@ -47,8 +47,8 @@ public class BrandServiceImpl implements BrandService {
} }
@Override @Override
public List<Map<String, Object>> getHotSaleBrands(Map<String, Object> map) { public List<Map<String, Object>> getHotSaleBrands(Map<String, Object> map, Page page) {
String sql="SELECT TOP 20 " String sql="SELECT "
+ "BrandNO = b.sBrandID, " + "BrandNO = b.sBrandID, "
+ "BrandName = b.sBrandName, " + "BrandName = b.sBrandName, "
+ "ImgPath = b.sLogoUrl, " + "ImgPath = b.sLogoUrl, "
...@@ -59,9 +59,9 @@ public class BrandServiceImpl implements BrandService { ...@@ -59,9 +59,9 @@ public class BrandServiceImpl implements BrandService {
+ "JOIN tAgentContractGoods acg ON a.sAgentContractNO = acg.sAgentContractNO " + "JOIN tAgentContractGoods acg ON a.sAgentContractNO = acg.sAgentContractNO "
+ "and a.nGoodsID = acg.nGoodsID " + "and a.nGoodsID = acg.nGoodsID "
+ "WHERE acg.sOrgNO = ? " + "WHERE acg.sOrgNO = ? "
+ "GROUP BY b.sBrandID, b.sBrandName, b.sLogoUrl " + "GROUP BY b.sBrandID, b.sBrandName, b.sLogoUrl ";
+ "ORDER BY sum(a.nSaleQty) DESC ";
String OrgNO=(String) map.get("OrgNO"); String OrgNO=(String) map.get("OrgNO");
return jdbcTemplate.queryForList(sql, OrgNO); jdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page,OrgNO);
} }
} }
...@@ -51,8 +51,8 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -51,8 +51,8 @@ public class GoodsServiceImpl implements GoodsService {
} }
@Override @Override
public List<Map<String, Object>> getHotSaleGoods(Map<String, Object> map) { public List<Map<String, Object>> getHotSaleGoods(Map<String, Object> map, Page page) {
String sql="SELECT TOP 20" String sql="SELECT "
+"GoodsID = a.nGoodsID, " +"GoodsID = a.nGoodsID, "
+"GoodsNO = g.sGoodsNO, " +"GoodsNO = g.sGoodsNO, "
+"GoodsName = g.sGoodsDesc, " +"GoodsName = g.sGoodsDesc, "
...@@ -69,10 +69,11 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -69,10 +69,11 @@ public class GoodsServiceImpl implements GoodsService {
+"and a.nGoodsID = acg.nGoodsID " +"and a.nGoodsID = acg.nGoodsID "
+"WHERE acg.sOrgNO = ? " +"WHERE acg.sOrgNO = ? "
+"GROUP BY a.nGoodsID, g.sGoodsNO, g.sGoodsDesc, " +"GROUP BY a.nGoodsID, g.sGoodsNO, g.sGoodsDesc, "
+"acg.nSalePrice, acg.nMinSaleQty, acg.nSaleUnits,acg.sUnit, acg.nMarketPrice, acg.sMarketUnit " +"acg.nSalePrice, acg.nMinSaleQty, acg.nSaleUnits,acg.sUnit, acg.nMarketPrice, acg.sMarketUnit " ;
+"ORDER BY sum(a.nSaleQty) DESC ";
String OrgNO=(String) map.get("OrgNO"); String OrgNO=(String) map.get("OrgNO");
return jdbcTemplate.queryForList(sql, OrgNO); jdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page,OrgNO);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment