Commit 0019fa51 authored by chang20170705's avatar chang20170705

limit

parent 6c807939
......@@ -125,7 +125,11 @@ public class BrandController {
Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("OrgNO"));
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();
}
......
......@@ -84,7 +84,11 @@ public class GoodsController {
Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("OrgNO"));
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();
}
}
......@@ -11,5 +11,5 @@ public interface BrandService {
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 {
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 {
}
@Override
public List<Map<String, Object>> getHotSaleBrands(Map<String, Object> map) {
String sql="SELECT TOP 20 "
public List<Map<String, Object>> getHotSaleBrands(Map<String, Object> map, Page page) {
String sql="SELECT "
+ "BrandNO = b.sBrandID, "
+ "BrandName = b.sBrandName, "
+ "ImgPath = b.sLogoUrl, "
......@@ -59,9 +59,9 @@ public class BrandServiceImpl implements BrandService {
+ "JOIN tAgentContractGoods acg ON a.sAgentContractNO = acg.sAgentContractNO "
+ "and a.nGoodsID = acg.nGoodsID "
+ "WHERE acg.sOrgNO = ? "
+ "GROUP BY b.sBrandID, b.sBrandName, b.sLogoUrl "
+ "ORDER BY sum(a.nSaleQty) DESC ";
+ "GROUP BY b.sBrandID, b.sBrandName, b.sLogoUrl ";
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 {
}
@Override
public List<Map<String, Object>> getHotSaleGoods(Map<String, Object> map) {
String sql="SELECT TOP 20"
public List<Map<String, Object>> getHotSaleGoods(Map<String, Object> map, Page page) {
String sql="SELECT "
+"GoodsID = a.nGoodsID, "
+"GoodsNO = g.sGoodsNO, "
+"GoodsName = g.sGoodsDesc, "
......@@ -69,10 +69,11 @@ public class GoodsServiceImpl implements GoodsService {
+"and a.nGoodsID = acg.nGoodsID "
+"WHERE acg.sOrgNO = ? "
+"GROUP BY a.nGoodsID, g.sGoodsNO, g.sGoodsDesc, "
+"acg.nSalePrice, acg.nMinSaleQty, acg.nSaleUnits,acg.sUnit, acg.nMarketPrice, acg.sMarketUnit "
+"ORDER BY sum(a.nSaleQty) DESC ";
+"acg.nSalePrice, acg.nMinSaleQty, acg.nSaleUnits,acg.sUnit, acg.nMarketPrice, acg.sMarketUnit " ;
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