Commit a9d83ac4 authored by 韩旭's avatar 韩旭

Update CartServiceImpl.java

查询购物车是否已存在,改为按sOrgNO、sShopNO、nTag、sAgentContractNO、nGoodsID来检查唯一性
parent 34189da0
......@@ -102,7 +102,16 @@ public class CartServiceImpl implements CartService {
} else {
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) {
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);
......
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