|
@@ -86,6 +86,63 @@ public class ShoppingCart extends Controller {
|
|
|
return queryDetail();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "(批量新增)", apiversion = R.ID20231024110003.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiversions = {R.ID20220924095302.class})
|
|
|
+ public String insert() throws YosException {
|
|
|
+ JSONArray items =new JSONArray();
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+ for (Object object:items) {
|
|
|
+ JSONObject item = (JSONObject)object;
|
|
|
+ Long sa_brandid = item.getLongValue("sa_brandid");
|
|
|
+ Long itemid = item.getLong("itemid");
|
|
|
+ BigDecimal qty = item.getBigDecimal("qty");
|
|
|
+ BigDecimal length = item.getBigDecimal("length");
|
|
|
+ BigDecimal width = item.getBigDecimal("width");
|
|
|
+ String itemno = item.getString("itemno");
|
|
|
+ String tradefield = item.getStringValue("tradefield");
|
|
|
+ long sa_promotionid =item.getLongValue("sa_promotionid");
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "购物车新增");
|
|
|
+ Long sa_shoppingcartid = 0L;
|
|
|
+ Rows rows = dbConnect.runSqlQuery("SELECT sa_shoppingcartid FROM sa_shoppingcart WHERE siteid = '" + siteid +
|
|
|
+ "' AND sa_brandid = " + sa_brandid +
|
|
|
+ " and length="+length+" and width="+width+" AND itemid = " + itemid +
|
|
|
+ " AND sys_enterpriseid = " + sys_enterpriseid +
|
|
|
+ " AND tradefield = '" + tradefield +
|
|
|
+ "' AND itemno = '" + itemno + "' and sa_promotionid="+sa_promotionid);
|
|
|
+ if (rows.isNotEmpty()) {
|
|
|
+ sa_shoppingcartid = rows.get(0).getLong("sa_shoppingcartid");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (sa_shoppingcartid <= 0) {
|
|
|
+ sa_shoppingcartid = createTableID("sa_shoppingcart");
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "sa_shoppingcart", sa_shoppingcartid, "新增", "购物车新增" + sa_shoppingcartid).getSQL());
|
|
|
+ } else {
|
|
|
+ sqlFactory = new SQLFactory(this, "购物车更新");
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "sa_shoppingcart", sa_shoppingcartid, "更新", "购物车更新" + sa_shoppingcartid).getSQL());
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("itemid", itemid);
|
|
|
+ sqlFactory.addParameter("username", username);
|
|
|
+ sqlFactory.addParameter("userid", userid);
|
|
|
+ sqlFactory.addParameter("itemno", itemno);
|
|
|
+ sqlFactory.addParameter("length", length);
|
|
|
+ sqlFactory.addParameter("width", width);
|
|
|
+ sqlFactory.addParameter("sa_promotionid", sa_promotionid);
|
|
|
+ sqlFactory.addParameter("tradefield", tradefield);
|
|
|
+ sqlFactory.addParameter("sa_shoppingcartid", sa_shoppingcartid);
|
|
|
+ sqlFactory.addParameter("sa_brandid", sa_brandid);
|
|
|
+ sqlFactory.addParameter("qty", qty);
|
|
|
+ sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
+ sqlList.add(sqlFactory.getSQL());
|
|
|
+ }
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
@API(title = "更新数量", apiversion = R.ID20220924104302.v1.class)
|
|
|
@CACHEING_CLEAN(apiversions = {R.ID20220924095302.class})
|
|
|
public String updateQty() throws YosException {
|