Commit 3eab5926 authored by Quxl's avatar Quxl

x

parent 91fa395d
...@@ -60,16 +60,6 @@ public class CartServiceImpl implements CartService { ...@@ -60,16 +60,6 @@ public class CartServiceImpl implements CartService {
strs.add("nTag = " + nGoodsTypeID); strs.add("nTag = " + nGoodsTypeID);
strs.add("sAgentContractNO = '" + sAgentContractNO + "'"); strs.add("sAgentContractNO = '" + sAgentContractNO + "'");
strs.add("nGoodsID = " + nGoodsID); strs.add("nGoodsID = " + nGoodsID);
if(StringUtil.isNotBlank(sPromoPaperNO)) {
strs.add("sPromoPaperNO = '" + sPromoPaperNO + "'");
} else {
strs.add("(sPromoPaperNO = '' or sPromoPaperNO is null)");
}
if(StringUtil.isNotBlank(sPromoGroupNO)) {
strs.add("sPromoGroupNO = '" + sPromoGroupNO + "'");
} 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)); List<Map<String, Object>> list = jdbcTemplate.queryForList("select nIdx, nSaleQty, sPromoPaperNO from tCart" + StringUtil.join(" and ", " where ", "", strs));
if(list.size() == 0) { if(list.size() == 0) {
Object[] args = new Object[]{shopNO, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, sPromoPaperNO, sPromoGroupNO}; Object[] args = new Object[]{shopNO, orgNo, ++nMaxIdx, nGoodsTypeID, sAgentContractNO, nGoodsID, nSaleQty, nSetPrice, sPromoPaperNO, sPromoGroupNO};
...@@ -77,11 +67,15 @@ public class CartServiceImpl implements CartService { ...@@ -77,11 +67,15 @@ 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);
if(StringUtil.isNotBlank(sPromoPaperNO)) {
jdbcTemplate.executeUpdate("update tCart set sPromoPaperNO = ?, sPromoGroupNO = ?, nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?", sPromoPaperNO, sPromoGroupNO, nSetPrice, orgNo, shopNO, nIdx);
} else {
jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?", nSetPrice, orgNo, shopNO, nIdx); jdbcTemplate.executeUpdate("update tCart set nSaleQty = " + (nSaleQty + nQty) + ", nSetPrice = ? where sOrgNO = ? and sShopNO = ? and nIdx = ?", nSetPrice, orgNo, shopNO, nIdx);
} }
} }
} }
} }
}
return Rjx.jsonOk().set("count", count(orgNo, shopNO)).toJson(); return Rjx.jsonOk().set("count", count(orgNo, shopNO)).toJson();
} }
......
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