Commit 5026b845 authored by 韩旭's avatar 韩旭

CartServiceImpl.java

1.查询购物车是否已存在,改为按sOrgNO、sShopNO、nTag、sAgentContractNO、nGoodsID、sSaleUnit来检查唯一性
2.购物车更新增加了sPromoPaperNO和sPromoGroupNO
parent a9d83ac4
...@@ -103,13 +103,15 @@ public class CartServiceImpl implements CartService { ...@@ -103,13 +103,15 @@ public class CartServiceImpl implements CartService {
strs.add("(sPromoGroupNO = '' or sPromoGroupNO is null)"); strs.add("(sPromoGroupNO = '' or sPromoGroupNO is null)");
} }
//查询购物车是否已存在,改为按sOrgNO、sShopNO、nTag、sAgentContractNO、nGoodsID来检查唯一性 //查询购物车是否已存在,改为按sOrgNO、sShopNO、nTag、sAgentContractNO、nGoodsID、sSaleUnit来检查唯一性
//modify by hanhan 2024-08-23 10:29:53
List<String> strQuery = new ArrayList<String>(); List<String> strQuery = new ArrayList<String>();
strQuery.add("sShopNO = '" + shopNO + "'"); strQuery.add("sShopNO = '" + shopNO + "'");
strQuery.add("sAgentContractNO = '" + sAgentContractNO + "'"); strQuery.add("sAgentContractNO = '" + sAgentContractNO + "'");
strQuery.add("nGoodsID = " + nGoodsID); strQuery.add("nGoodsID = " + nGoodsID);
strQuery.add("sOrgNO = '" + orgNo + "'"); strQuery.add("sOrgNO = '" + orgNo + "'");
strQuery.add("nTag = " + nGoodsTypeID); strQuery.add("nTag = " + nGoodsTypeID);
strQuery.add("sSaleUnit = '" + sSaleUnit + "'");
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nIdx, nSaleQty, sPromoPaperNO from tCart" + StringUtil.join(" and ", " where ", "", strQuery)); 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) {
...@@ -118,7 +120,9 @@ public class CartServiceImpl implements CartService { ...@@ -118,7 +120,9 @@ public class CartServiceImpl implements CartService {
} else { } else {
Integer nIdx = Util.objTo(list.get(0).get("nIdx"), Integer.class); Integer nIdx = Util.objTo(list.get(0).get("nIdx"), Integer.class);
Double nQty = Util.objTo(list.get(0).get("nSaleQty"), Double.class); Double nQty = Util.objTo(list.get(0).get("nSaleQty"), Double.class);
jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? ,sSaleUnit = ?,nSaleBigQty =? where sOrgNO = ? and sShopNO = ? and nIdx = ?", nSetPrice,sSaleUnit,saleBigQty, orgNo, shopNO, nIdx); //购物车更新增加了sPromoPaperNO和sPromoGroupNO
//modify by hanhan 2024-08-23 10:29:53
jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? ,sSaleUnit = ?,nSaleBigQty =?,sPromoPaperNO = ?,sPromoGroupNO = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?", nSetPrice,sSaleUnit,saleBigQty, sPromoPaperNO, sPromoGroupNO, orgNo, shopNO, nIdx);
} }
} }
......
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