| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- package beans.itemgroup;
- import beans.dispatch.Dispatch;
- import com.alibaba.fastjson.JSONArray;
- import common.BaseClass;
- import common.Controller;
- import common.YosException;
- import common.data.Rows;
- import common.data.RowsMap;
- import common.data.SQLFactory;
- import java.util.ArrayList;
- public class Itemgroup extends BaseClass {
- /**
- * 获取增加商品组语句
- * @param controller
- * @param itemid
- * @param itemname
- * @param itemno
- * @param tradefields
- * @param sa_brandid
- * @return
- * @throws YosException
- */
- public static ArrayList<String> createItemGroupSql(Controller controller, long itemid, String itemname, String itemno, JSONArray tradefields, long sa_brandid) throws YosException {
- ArrayList<String> sqlList = new ArrayList<>();
- long sa_itemgroupid = controller.createTableID("sa_itemgroup");
- String tradefield="";
- if(tradefields!=null && !tradefields.isEmpty()){
- for (Object object:tradefields) {
- tradefield = tradefield +(String) object + ",";
- }
- }
- if (!tradefield.equals("")) {
- tradefield = tradefield.substring(0, tradefield.length() - 1);
- }
- SQLFactory sqlAddFactory = new SQLFactory(new Itemgroup(), "商品组新增");
- sqlAddFactory.addParameter("sa_itemgroupid", sa_itemgroupid);
- sqlAddFactory.addParameter("siteid", controller.siteid);
- sqlAddFactory.addParameter("groupname", itemname);
- sqlAddFactory.addParameter("itemno", itemno);
- sqlAddFactory.addParameter("username", controller.username);
- sqlAddFactory.addParameter("groupnum", itemno);
- sqlAddFactory.addParameter("tradefield", tradefield);
- sqlAddFactory.addParameter("sa_brandid", sa_brandid);
- sqlAddFactory.addParameter("sequence", 1);
- //System.out.println(sqlAddFactory.getSQL());
- sqlList.add(sqlAddFactory.getSQL());
- SQLFactory saleFactory = new SQLFactory(new Itemgroup(), "商品组商品明细新增");
- saleFactory.addParameter("siteid", controller.siteid);
- saleFactory.addParameter("sequence",1);
- saleFactory.addParameter("sa_itemgroupmxid", controller.createTableID("sa_itemgroupmx"));
- saleFactory.addParameter("itemno", itemno);
- saleFactory.addParameter("itemid", itemid);
- saleFactory.addParameter("sa_itemgroupid", sa_itemgroupid);
- //System.out.println(saleFactory.getSQL());
- sqlList.add(saleFactory.getSQL());
- return sqlList;
- }
- /**
- * 查询商品组的方案
- *
- * @param controller
- * @param sa_itemgroupids
- * @return
- * @throws YosException
- */
- public static RowsMap getItemgroupScemeid(Controller controller, ArrayList<Long> sa_itemgroupids) throws YosException {
- SQLFactory sqlFactory = new SQLFactory(new Itemgroup(), "查询商品组对应方案");
- sqlFactory.addParameter("siteid", controller.siteid);
- sqlFactory.addParameter_in("sa_itemgroupid", sa_itemgroupids);
- Rows rows = controller.dbConnect.runSqlQuery(sqlFactory);
- return rows.toRowsMap("sa_itemgroupid");
- }
- }
|