Commit 48c07c77 authored by chang20170705's avatar chang20170705

GetCategoryGoods

parent b72ae1ef
......@@ -93,4 +93,30 @@ public class GoodsController {
listMap=goodsService.getHotSaleGoods(params,page);
return Rjx.jsonOk().set("list", listMap).set("page",page).toJson();
}
@ApiOperation("分类商品页数据")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "OrgNO", dataType = "String", required = true, value = "区域编号", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "ShopNO", dataType = "String", required = false, value = "店铺件编号", defaultValue = "00029997"),
@ApiImplicitParam(paramType = "query", name = "CategoryNOA", dataType = "String", required = false, value = "一级分类编码", defaultValue = "%"),
@ApiImplicitParam(paramType = "query", name = "CategoryNOB", dataType = "String", required = false, value = "二级分类编码", defaultValue = "%"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "第几页", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页数量", defaultValue = "20"),
})
@RequestMapping(value = "/GetCategoryGoods",method=RequestMethod.GET)
public String GetCategoryGoods(HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> listMap;
Map<String,Object> params=new HashMap<>();
params.put("OrgNO", request.getParameter("OrgNO"));
params.put("ShopNO", request.getParameter("ShopNO")==null?"":request.getParameter("ShopNO"));
params.put("CategoryNOA", request.getParameter("CategoryNOA")==null?"%":request.getParameter("CategoryNOA"));
params.put("CategoryNOB", request.getParameter("CategoryNOB")==null?"%":request.getParameter("CategoryNOB"));
Page page=new Page();
page.setIndex(Long.valueOf(request.getParameter("index")==null?"1":request.getParameter("index")));
page.setLimit(Long.valueOf(request.getParameter("limit")==null?"20":request.getParameter("limit")));
page.setLimitKey("GoodsID desc");
listMap=goodsService.GetCategoryGoods(params,page);
return Rjx.jsonOk().set("list", listMap).set("page",page).toJson();
}
}
......@@ -10,4 +10,6 @@ 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, Page page);
public List<Map<String,Object>> GetCategoryGoods (Map<String,Object> map, Page page);
}
......@@ -9,6 +9,7 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
import com.egolm.common.DateUtil;
......@@ -75,6 +76,51 @@ public class GoodsServiceImpl implements GoodsService {
jdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page,OrgNO);
}
@Override
public List<Map<String, Object>> GetCategoryGoods(Map<String, Object> map, Page page) {
String OrgNO=(String) map.get("OrgNO");
String ShopNO=(String) map.get("ShopNO");
String CategoryNOA=(String) map.get("CategoryNOA");
String CategoryNOB=(String) map.get("CategoryNOB");
String DistrictID;
String sql_0="SELECT DistrictID=sDistrictID FROM tShop WHERE sOrgNO =? AND sShopNO = ?";
try {
DistrictID=jdbcTemplate.queryForString(sql_0, OrgNO,ShopNO);
} catch (EmptyResultDataAccessException e) {
DistrictID="";
}
String sql=" SELECT GoodsID = acg.nGoodsID,"+
" GoodsNO = acg.sGoodsNO, " +
" GoodsName = acg.sGoodsDesc, " +
" Price = acg.nSalePrice, " +
" Unit = acg.sUnit, " +
" Spec = acg.sSpec, " +
" MinQty = acg.nMinSaleQty, " +
" SaleUnit = acg.nSaleUnits, " +
" MarketPrice = acg.nMarketPrice, " +
" MarketUnit = acg.sMarketUnit, " +
" ImagePath = ISNULL(g.sURL,'')," +
" PopImagePath = '' " +
" FROM tAgentContractWarehouse acw, tAgentContractGoods acg "
+ "LEFT JOIN tGoodsPic g ON acg.nGoodsID = g.nGoodsID " +
" AND g.sPicTypeID = '1' " +
" AND g.nItem = 1, " +
"(SELECT a.sWarehouseNO FROM tWarehouseDistrict a, (SELECT sDistrictID, nDCPriority = max(nDCPriority) FROM tWarehouseDistrict " +
" GROUP BY sDistrictID) b WHERE a.sDistrictID = b.sDistrictID AND a.nDCPriority = b.nDCPriority AND (a.sDistrictID = ? OR ? = '') " +
" ) d, tCategory c " +
" WHERE acw.sAgentContractNO = acg.sAgentContractNO " +
" AND acw.sWarehouseNO = d.sWarehouseNO " +
" AND acg.sCategoryNO = c.sCategoryNO " +
" AND acg.nTag&1=0 " +
" AND acg.sOrgNO = 'SHBS' " +
" AND (c.sPath LIKE ISNULL((SELECT sPath FROM tCategory WHERE sCategoryNO = ?),'') + '%') " +
" AND (c.sPath LIKE ISNULL((SELECT sPath FROM tCategory WHERE sCategoryNO = ?),'') + '%') " ;
jdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql,page, DistrictID,DistrictID,CategoryNOA,CategoryNOB);
}
}
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