Commit 8148c4c1 authored by Quxl's avatar Quxl

x

parent cd26e77e
...@@ -29,7 +29,7 @@ public interface GoodsService { ...@@ -29,7 +29,7 @@ public interface GoodsService {
* @return: List<Map<String,Object>> * @return: List<Map<String,Object>>
* @throws * @throws
*/ */
public List<Map<String,Object>> goodsPicList(String goodsID,String agentContractNO ); public Map<String, List<Map<String, Object>>> goodsPicList(String goodsID,String agentContractNO );
/** /**
* 批量查询商品价格 * 批量查询商品价格
* @Title: queryGoodsPrice * @Title: queryGoodsPrice
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -371,7 +372,7 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -371,7 +372,7 @@ public class GoodsServiceImpl implements GoodsService {
String contractNo=(String) map.get("contractNo"); String contractNo=(String) map.get("contractNo");
String sql = "select * from tAgentContractGoods where sAgentContractNO = ? and nGoodsID = ?"; String sql = "select * from tAgentContractGoods where sAgentContractNO = ? and nGoodsID = ?";
Map<String, Object> detail = jdbcTemplate.queryForMap(sql, contractNo, goodsId); Map<String, Object> detail = jdbcTemplate.queryForMap(sql, contractNo, goodsId);
List<Map<String,Object>> picList = goodsPicList(goodsId, contractNo); Map<String, List<Map<String, Object>>> picList = goodsPicList(goodsId, contractNo);
return Rjx.jsonOk().set("goodsDetail", detail).set("imgGroup", picList).toJson(); return Rjx.jsonOk().set("goodsDetail", detail).set("imgGroup", picList).toJson();
} }
...@@ -386,23 +387,22 @@ public class GoodsServiceImpl implements GoodsService { ...@@ -386,23 +387,22 @@ public class GoodsServiceImpl implements GoodsService {
* @return: List<Map<String,Object>> * @return: List<Map<String,Object>>
* @throws * @throws
*/ */
public List<Map<String,Object>> goodsPicList(String goodsID,String agentContractNO ){ public Map<String, List<Map<String, Object>>> goodsPicList(String goodsID,String agentContractNO ){
String sql1 = "select agp.* from tAgentGoodsPic agp, tAgentContractGoods acg where agp.nAgentID = acg.nAgentID and agp.nGoodsID = acg.nGoodsID and acg.sAgentContractNO = ? and acg.nGoodsID = ?";
//查询经销商上传的图片 String sql2 = "select gp.* from tGoodsPic gp where gp.nGoodsID = ?";
String agentPicSql="SELECT ID=agp.nItem,picTypeID=agp.sPicTypeID,picType=agp.sPicType,picDesc=agp.sPicDesc,url=agp.sURL " List<Map<String, Object>> picList1 = jdbcTemplate.queryForList(sql1);
+ " FROM tAgentGoodsPic agp LEFT JOIN tAgentContractGoods g ON g.nGoodsID = agp.nGoodsID AND g.nAgentID = agp.nAgentID and agp.nTag&1=0 and g.nTag&1=0 " List<Map<String, Object>> picList2 = jdbcTemplate.queryForList(sql2);
+ " WHERE g.sAgentContractNO= '"+agentContractNO+"' AND g.nGoodsID = " + goodsID +" "; Map<String, List<Map<String,Object>>> picML1 = Util.listToML(picList1, "sPicTypeID");
Map<String, List<Map<String,Object>>> picML2 = Util.listToML(picList2, "sPicTypeID");
//图片库中商品图片 Map<String, List<Map<String, Object>>> pics = new HashMap<String, List<Map<String, Object>>>();
String picSql="SELECT ID=t.nItem,picTypeID=t.sPicTypeID,picType=t.sPicType,picDesc=t.sPicDesc,url=t.sURL FROM tGoodsPic t WHERE t.nGoodsID = " + goodsID + " and t.nTag&1=0 "; for(String sPicTypeID : new String[] {"1", "2", "3", "4"}) {
List<Map<String, Object>> picList = picML1.get(sPicTypeID);
jdbcTemplate.setDialect(new SqlServerDialect()); if(picList == null || picList.size() == 0) {
List<Map<String,Object>> agentPicList = jdbcTemplate.queryForList(agentPicSql); picList = picML2.get(sPicTypeID);
if(agentPicList != null && agentPicList.size() >0) { }
return agentPicList; pics.put(sPicTypeID, picList);
}else {
return jdbcTemplate.queryForList(picSql);
} }
return pics;
} }
......
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