Commit 767da70a authored by 张永's avatar 张永
parents cb68c842 a9d83ac4
...@@ -102,7 +102,16 @@ public class CartServiceImpl implements CartService { ...@@ -102,7 +102,16 @@ public class CartServiceImpl implements CartService {
} else { } else {
strs.add("(sPromoGroupNO = '' or sPromoGroupNO is null)"); strs.add("(sPromoGroupNO = '' or sPromoGroupNO is null)");
} }
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nIdx, nSaleQty, sPromoPaperNO from tCart" + StringUtil.join(" and ", " where ", "", strs));
//查询购物车是否已存在,改为按sOrgNO、sShopNO、nTag、sAgentContractNO、nGoodsID来检查唯一性
List<String> strQuery = new ArrayList<String>();
strQuery.add("sShopNO = '" + shopNO + "'");
strQuery.add("sAgentContractNO = '" + sAgentContractNO + "'");
strQuery.add("nGoodsID = " + nGoodsID);
strQuery.add("sOrgNO = '" + orgNo + "'");
strQuery.add("nTag = " + nGoodsTypeID);
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nIdx, nSaleQty, sPromoPaperNO from tCart" + StringUtil.join(" and ", " where ", "", strQuery));
if(list.size() == 0) { if(list.size() == 0) {
Object[] args = new Object[]{shopNO, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, sPromoPaperNO, sPromoGroupNO,sSaleUnit,saleBigQty}; Object[] args = new Object[]{shopNO, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, sPromoPaperNO, sPromoGroupNO,sSaleUnit,saleBigQty};
jdbcTemplate.executeUpdate("insert into tCart (sShopNO, sOrgNO, nIdx, nTag, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, dLastUpdateTime, sPromoPaperNO, sPromoGroupNO,sSaleUnit,nSaleBigQty) values (?, ?, ?, ?, ?, ?, ?, ?, getdate(), ?, ?,?,?)", args); jdbcTemplate.executeUpdate("insert into tCart (sShopNO, sOrgNO, nIdx, nTag, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, dLastUpdateTime, sPromoPaperNO, sPromoGroupNO,sSaleUnit,nSaleBigQty) values (?, ?, ?, ?, ?, ?, ?, ?, getdate(), ?, ?,?,?)", args);
......
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