Commit 8148c4c1 authored by Quxl's avatar Quxl

x

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