StoreAgent.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. package restcontroller.webmanage.saletool.store;
  2. import beans.attachment.Attachment;
  3. import beans.parameter.Parameter;
  4. import beans.time.Time;
  5. import com.alibaba.fastjson.JSONArray;
  6. import com.alibaba.fastjson.JSONObject;
  7. import common.Controller;
  8. import common.YosException;
  9. import common.annotation.API;
  10. import common.data.*;
  11. import restcontroller.R;
  12. import java.util.ArrayList;
  13. /**
  14. * 门店小程序(经销商)
  15. */
  16. public class StoreAgent extends Controller {
  17. /**
  18. * 构造函数
  19. *
  20. * @param content
  21. */
  22. public StoreAgent(JSONObject content) throws YosException {
  23. super(content);
  24. }
  25. String sa_store = "sa_store";
  26. Controller controller = this;
  27. @API(title = "门店列表", apiversion = R.ID20240410095602.v1.class)
  28. public String list() throws YosException {
  29. StringBuffer where = new StringBuffer(" 1=1 ");
  30. if (content.containsKey("where")) {
  31. JSONObject whereObject = content.getJSONObject("where");
  32. if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
  33. where.append(" and (");
  34. where.append("t1.storename like'%").append(whereObject.getString("condition")).append("%' ");
  35. where.append("or t2.name like'%").append(whereObject.getString("condition")).append("%' ");
  36. where.append("or t2.phonenumber like'%").append(whereObject.getString("condition")).append("%' ");
  37. where.append(")");
  38. }
  39. if (whereObject.containsKey("storetype") && !"".equals(whereObject.getString("storetype"))) {
  40. where.append(" and (");
  41. where.append("t1.storetype='").append(whereObject.getString("storetype")).append("' ");
  42. where.append(")");
  43. }
  44. if (whereObject.containsKey("status") && !"".equals(whereObject.getString("status"))) {
  45. where.append(" and (");
  46. where.append("t1.status='").append(whereObject.getString("status")).append("' ");
  47. where.append(")");
  48. }
  49. if (whereObject.containsKey("markettype") && !"".equals(whereObject.getString("markettype"))) {
  50. where.append(" and (");
  51. where.append("t1.markettype='").append(whereObject.getString("markettype")).append("' ");
  52. where.append(")");
  53. }
  54. }
  55. if (content.containsKey("sys_enterpriseid") && content.getLongValue("sys_enterpriseid") != 0) {
  56. sys_enterpriseid = content.getLongValue("sys_enterpriseid");
  57. }
  58. QuerySQL listQuery = SQLFactory.createQuerySQL(controller, sa_store)
  59. .setTableAlias("t1");
  60. listQuery.addJoinTable(JOINTYPE.left, "sys_enterprise_hr", "t2", "t2.sys_enterprise_hrid=t1.leader_hrid and t2.siteid=t1.siteid"
  61. , "name", "phonenumber");
  62. listQuery.addJoinTable(JOINTYPE.left, "sys_users", "t3", "t3.userid=t2.userid "
  63. , "accountno");
  64. listQuery.addJoinTable(JOINTYPE.left, "sys_enterprise", "t4", "t4.sys_enterpriseid=t1.sys_enterpriseid and t4.siteid=t1.siteid"
  65. , "enterprisename");
  66. listQuery.setWhere("sys_enterpriseid", sys_enterpriseid);
  67. listQuery.setWhere(where.toString());
  68. listQuery.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
  69. Rows rows = listQuery.query();
  70. RowsMap attinfoRows = Attachment.get(controller, sa_store, rows.toArrayList("sa_storeid", new ArrayList<>()));
  71. for (Row row : rows) {
  72. row.put("attinfos", attinfoRows.getOrDefault(row.getString("sa_storeid"), new Rows()));
  73. row.put("detailaddress", row.getString("province") + row.getString("city") + row.getString("county") + row.getString("address"));
  74. }
  75. return getSucReturnObject().setData(rows).toString();
  76. }
  77. @API(title = "门店新增或编辑", apiversion = R.ID20240410095302.v1.class)
  78. public String insertOrUpdate() throws YosException {
  79. Long sa_storeid = content.getLongValue("sa_storeid");
  80. if (sa_storeid <= 0) {
  81. sa_storeid = createTableID(sa_store);
  82. InsertSQL sqlFactory = SQLFactory.createInsertSQL(controller, sa_store);
  83. sqlFactory.setSiteid(siteid);
  84. sqlFactory.setUniqueid(sa_storeid);
  85. sqlFactory.setValue("sys_enterpriseid", sys_enterpriseid);
  86. sqlFactory.setValue("storename", content.getStringValue("storename"));
  87. sqlFactory.setValue("sale_phonenmber", content.getStringValue("sale_phonenmber"));
  88. sqlFactory.setValue("area", content.getStringValue("area"));
  89. sqlFactory.setValue("leader_hrid", content.getLongValue("leader_hrid"));
  90. sqlFactory.setValue("storetype", content.getStringValue("storetype"));
  91. sqlFactory.setValue("markettype", content.getStringValue("markettype"));
  92. sqlFactory.setValue("service_phonenmber", content.getStringValue("service_phonenmber"));
  93. sqlFactory.setValue("latitude", content.getStringValue("latitude"));
  94. sqlFactory.setValue("longitude", content.getStringValue("longitude"));
  95. sqlFactory.setValue("province", content.getStringValue("province"));
  96. sqlFactory.setValue("city", content.getStringValue("city"));
  97. sqlFactory.setValue("county", content.getStringValue("county"));
  98. sqlFactory.setValue("address", content.getStringValue("address"));
  99. sqlFactory.setValue("storeno", content.getStringValue("storeno"));
  100. sqlFactory.setValue("status", "新建");
  101. sqlFactory.insert();
  102. content.put("sa_storeid", sa_storeid);
  103. } else {
  104. UpdateSQL sqlFactory = SQLFactory.createUpdateSQL(controller, sa_store);
  105. sqlFactory.setSiteid(siteid);
  106. sqlFactory.setUniqueid(sa_storeid);
  107. sqlFactory.setValue("sys_enterpriseid", sys_enterpriseid);
  108. sqlFactory.setValue("storename", content.getStringValue("storename"));
  109. sqlFactory.setValue("sale_phonenmber", content.getStringValue("sale_phonenmber"));
  110. sqlFactory.setValue("area", content.getStringValue("area"));
  111. sqlFactory.setValue("leader_hrid", content.getLongValue("leader_hrid"));
  112. sqlFactory.setValue("storetype", content.getStringValue("storetype"));
  113. sqlFactory.setValue("markettype", content.getStringValue("markettype"));
  114. sqlFactory.setValue("service_phonenmber", content.getStringValue("service_phonenmber"));
  115. sqlFactory.setValue("latitude", content.getStringValue("latitude"));
  116. sqlFactory.setValue("longitude", content.getStringValue("longitude"));
  117. sqlFactory.setValue("province", content.getStringValue("province"));
  118. sqlFactory.setValue("city", content.getStringValue("city"));
  119. sqlFactory.setValue("county", content.getStringValue("county"));
  120. sqlFactory.setValue("address", content.getStringValue("address"));
  121. sqlFactory.setValue("storeno", content.getStringValue("storeno"));
  122. sqlFactory.update();
  123. }
  124. InsertSQL insertSQL = SQLFactory.createInsertSQL(controller, "sa_store_hr");
  125. insertSQL.setSiteid(siteid);
  126. insertSQL.setUniqueid(createTableID("sa_store_hr"));
  127. insertSQL.setValue("sys_enterpriseid", sys_enterpriseid);
  128. insertSQL.setValue("sa_storeid", sa_storeid);
  129. insertSQL.setValue("sys_enterprise_hrid", content.getLongValue("leader_hrid"));
  130. insertSQL.setWhere("not exists(select 1 from sa_store_hr where sys_enterprise_hrid=" + content.getLongValue("leader_hrid") + " and sa_storeid=" + sa_storeid + " and siteid='" + siteid + "')");
  131. insertSQL.insert();
  132. return detail();
  133. }
  134. @API(title = "门店详情", apiversion = R.ID20240410095402.v1.class)
  135. public String detail() throws YosException {
  136. Long sa_storeid = content.getLongValue("sa_storeid");
  137. QuerySQL detailQuery = SQLFactory.createQuerySQL(controller, sa_store).setTableAlias("t1");
  138. detailQuery.addJoinTable(JOINTYPE.left, "sys_enterprise_hr", "t2", "t2.sys_enterprise_hrid=t1.leader_hrid and t2.siteid=t1.siteid"
  139. , "name");
  140. detailQuery.addJoinTable(JOINTYPE.left, "sys_users", "t3", "t3.userid=t2.userid "
  141. , "accountno");
  142. detailQuery.addJoinTable(JOINTYPE.left, "sys_enterprise", "t4", "t4.sys_enterpriseid=t1.sys_enterpriseid and t4.siteid=t1.siteid"
  143. , "enterprisename");
  144. detailQuery.addQueryFields("phonenumber", "ifnull(t2.phonenumber,t3.phonenumber)");
  145. detailQuery.setUniqueid(sa_storeid);
  146. Rows rows = detailQuery.query();
  147. Row detailRow = rows.isNotEmpty() ? rows.get(0) : new Row();
  148. detailRow.putIfAbsent("checkdate", "");
  149. detailRow.putIfAbsent("submitdate", "");
  150. Rows attinfoRows = Attachment.get(controller, sa_store, sa_storeid);
  151. detailRow.put("attinfos", attinfoRows);
  152. return getSucReturnObject().setData(detailRow).toString();
  153. }
  154. @API(title = "门店删除", apiversion = R.ID20240410095502.v1.class)
  155. public String delete() throws YosException {
  156. JSONArray sa_storeids = content.getJSONArray("sa_storeids");
  157. QuerySQL querySQL = SQLFactory.createQuerySQL(controller, sa_store);
  158. querySQL.setSiteid(siteid);
  159. querySQL.setWhere("sa_storeid", sa_storeids);
  160. querySQL.setWhere("status!='新建'");
  161. Rows rows = querySQL.query();
  162. if (rows.isNotEmpty()) {
  163. return getErrReturnObject().setErrMsg("当前状态不可删除").toString();
  164. }
  165. DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(controller, sa_store);
  166. deleteSQL.setSiteid(siteid);
  167. deleteSQL.setWhere("sa_storeid", sa_storeids);
  168. deleteSQL.delete();
  169. return getSucReturnObject().toString();
  170. }
  171. @API(title = "门店提交", apiversion = R.ID20240410110302.v1.class)
  172. public String submit() throws YosException {
  173. Long sa_storeid = content.getLongValue("sa_storeid");
  174. Rows rows = dbConnect.runSqlQuery("SELECT status from sa_store WHERE sa_storeid=" + sa_storeid + " and siteid='" + siteid + "' ");
  175. if (rows.isEmpty()) {
  176. return getErrReturnObject().setErrMsg("数据不存在").toString();
  177. }
  178. if (!rows.get(0).getString("status").equals("新建")) {
  179. return getErrReturnObject().setErrMsg("当前状态不允许提交").toString();
  180. }
  181. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_store);
  182. updateSQL.setSiteid(siteid);
  183. updateSQL.setUniqueid(sa_storeid);
  184. updateSQL.setValue("status", "提交");
  185. updateSQL.setValue("submitby", username);
  186. updateSQL.setValue("submitdate", Time.getDateTime_Str());
  187. updateSQL.update();
  188. return getSucReturnObject().toString();
  189. }
  190. @API(title = "门店撤回", apiversion = R.ID20240410110802.v1.class)
  191. public String unsubmit() throws YosException {
  192. Long sa_storeid = content.getLongValue("sa_storeid");
  193. Rows rows = dbConnect.runSqlQuery("SELECT status from sa_store WHERE sa_storeid=" + sa_storeid + " and siteid='" + siteid + "' ");
  194. if (rows.isEmpty()) {
  195. return getErrReturnObject().setErrMsg("数据不存在").toString();
  196. }
  197. if (!rows.get(0).getString("status").equals("提交")) {
  198. return getErrReturnObject().setErrMsg("当前状态不允许撤回").toString();
  199. }
  200. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_store);
  201. updateSQL.setSiteid(siteid);
  202. updateSQL.setUniqueid(sa_storeid);
  203. updateSQL.setValue("status", "新建");
  204. updateSQL.setValue("submitby", "null");
  205. updateSQL.setValue("submitdate", "null");
  206. updateSQL.update();
  207. return getSucReturnObject().toString();
  208. }
  209. @API(title = "门店退回", apiversion = R.ID20240410135402.v1.class)
  210. public String returnBack() throws YosException {
  211. Long sa_storeid = content.getLongValue("sa_storeid");
  212. Rows rows = dbConnect.runSqlQuery("SELECT status from sa_store WHERE sa_storeid=" + sa_storeid + " and siteid='" + siteid + "' ");
  213. if (rows.isEmpty()) {
  214. return getErrReturnObject().setErrMsg("数据不存在").toString();
  215. }
  216. if (!rows.get(0).getString("status").equals("提交")) {
  217. return getErrReturnObject().setErrMsg("当前状态不允许退回").toString();
  218. }
  219. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_store);
  220. updateSQL.setSiteid(siteid);
  221. updateSQL.setUniqueid(sa_storeid);
  222. updateSQL.setValue("status", "新建");
  223. updateSQL.setValue("submitby", "null");
  224. updateSQL.setValue("submitdate", "null");
  225. updateSQL.update();
  226. return getSucReturnObject().toString();
  227. }
  228. @API(title = "门店审核", apiversion = R.ID20240410141002.v1.class)
  229. public String check() throws YosException {
  230. Long sa_storeid = content.getLongValue("sa_storeid");
  231. Rows rows = dbConnect.runSqlQuery("SELECT status from sa_store WHERE sa_storeid=" + sa_storeid + " and siteid='" + siteid + "' ");
  232. if (rows.isEmpty()) {
  233. return getErrReturnObject().setErrMsg("数据不存在").toString();
  234. }
  235. if (!rows.get(0).getString("status").equals("提交")) {
  236. return getErrReturnObject().setErrMsg("当前状态不允许审核").toString();
  237. }
  238. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_store);
  239. updateSQL.setSiteid(siteid);
  240. updateSQL.setUniqueid(sa_storeid);
  241. updateSQL.setValue("status", "审核");
  242. updateSQL.setValue("checkby", username);
  243. updateSQL.setValue("checkdate", Time.getDateTime_Str());
  244. updateSQL.update();
  245. return getSucReturnObject().toString();
  246. }
  247. @API(title = "门店反审核", apiversion = R.ID20240410141402.v1.class)
  248. public String uncheck() throws YosException {
  249. Long sa_storeid = content.getLongValue("sa_storeid");
  250. Rows rows = dbConnect.runSqlQuery("SELECT status from sa_store WHERE sa_storeid=" + sa_storeid + " and siteid='" + siteid + "' ");
  251. if (rows.isEmpty()) {
  252. return getErrReturnObject().setErrMsg("数据不存在").toString();
  253. }
  254. if (!rows.get(0).getString("status").equals("审核")) {
  255. return getErrReturnObject().setErrMsg("当前状态不允许反审核").toString();
  256. }
  257. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_store);
  258. updateSQL.setSiteid(siteid);
  259. updateSQL.setUniqueid(sa_storeid);
  260. updateSQL.setValue("status", "新建");
  261. updateSQL.setValue("checkby", "null");
  262. updateSQL.setValue("checkdate", "null");
  263. updateSQL.setValue("submitby", "null");
  264. updateSQL.setValue("submitdate", "null");
  265. updateSQL.update();
  266. return getSucReturnObject().toString();
  267. }
  268. @API(title = "选择负责人(添加门店人员)", apiversion = R.ID20240410142002.v1.class)
  269. public String chooseLeader() throws YosException {
  270. StringBuffer where = new StringBuffer(" 1=1 ");
  271. if (content.containsKey("where")) {
  272. JSONObject whereObject = content.getJSONObject("where");
  273. if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
  274. where.append(" and (");
  275. where.append("t1.name like'%").append(whereObject.getString("condition")).append("%' ");
  276. where.append("or t1.phonenumber like'%").append(whereObject.getString("condition")).append("%' ");
  277. where.append(")");
  278. }
  279. if (whereObject.containsKey("status") && !"".equals(whereObject.getString("status"))) {
  280. String storerolename = Parameter.get("storerolename");
  281. if (whereObject.getString("status").equals("启用")) {
  282. where.append(" and (");
  283. where.append("t1.userid in (").append("SELECT t1.userid FROM sys_userrole t1 INNER JOIN sys_role t2 ON t1.roleid=t2.roleid AND t2.siteid=t1.siteid WHERE t2.rolename='" + storerolename + "'").append(") ");
  284. where.append(")");
  285. }
  286. if (whereObject.getString("status").equals("停用")) {
  287. where.append(" and (");
  288. where.append("t1.userid not in (").append("SELECT t1.userid FROM sys_userrole t1 INNER JOIN sys_role t2 ON t1.roleid=t2.roleid AND t2.siteid=t1.siteid WHERE t2.rolename='" + storerolename + "'").append(") ");
  289. where.append(")");
  290. }
  291. }
  292. }
  293. Long sa_storeid = content.getLongValue("sa_storeid");
  294. QuerySQL querySQL = SQLFactory.createQuerySQL(controller, "sys_enterprise_hr"
  295. , "sys_enterprise_hrid", "name", "position", "phonenumber", "isleader", "userid")
  296. .setTableAlias("t1");
  297. querySQL.setSiteid(siteid);
  298. querySQL.setWhere(where);
  299. querySQL.setWhere("sys_enterpriseid", sys_enterpriseid);
  300. querySQL.setWhere(" not exists(select 1 from sa_store where leader_hrid=t1.sys_enterprise_hrid and sa_storeid=" + sa_storeid + " and siteid='" + siteid + "')");
  301. querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
  302. Rows rows = querySQL.query();
  303. //查询角色
  304. RowsMap roleRowsMap = StoreHelper.getRoleRowsMap(controller, rows.toArray("userid"));
  305. //查询门店
  306. RowsMap storeRowsMap = StoreHelper.getStoreRowsMap(controller, rows.toArray("sys_enterprise_hrid"));
  307. for (Row row : rows) {
  308. row.put("headpic", getHeadPic(row.getLong("userid")));
  309. Rows roleRows = roleRowsMap.getOrDefault(row.getString("userid"), new Rows());
  310. row.put("rolenames", String.join(",", roleRows.toArrayList("rolename")));
  311. Rows storeRows = storeRowsMap.getOrDefault(row.getString("sys_enterprise_hrid"), new Rows());
  312. row.put("storenames", String.join(",", storeRows.toArrayList("storename")));
  313. if (roleRows.toArrayList("rolename").contains(Parameter.get("storerolename"))) {
  314. row.put("status", "启用");
  315. } else {
  316. row.put("status", "停用");
  317. }
  318. }
  319. return getSucReturnObject().setData(rows).toString();
  320. }
  321. @API(title = "门店人员", apiversion = R.ID20240410150702.v1.class)
  322. public String storeHrs() throws YosException {
  323. StringBuffer where = new StringBuffer(" 1=1 ");
  324. if (content.containsKey("where")) {
  325. JSONObject whereObject = content.getJSONObject("where");
  326. if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
  327. where.append(" and (");
  328. where.append("t1.name like'%").append(whereObject.getString("condition")).append("%' ");
  329. where.append("or t1.phonenumber like'%").append(whereObject.getString("condition")).append("%' ");
  330. where.append(")");
  331. }
  332. }
  333. Long sa_storeid = content.getLongValue("sa_storeid");
  334. QuerySQL querySQL = SQLFactory.createQuerySQL(controller, "sys_enterprise_hr"
  335. , "sys_enterprise_hrid", "name", "position", "phonenumber", "isleader", "userid", "createby", "createdate", "changeby", "changedate")
  336. .setTableAlias("t1");
  337. querySQL.addJoinTable(JOINTYPE.inner, "sa_store_hr", "t2", "t2.sys_enterprise_hrid=t1.sys_enterprise_hrid and t2.siteid=t1.siteid"
  338. , "sa_store_hrid");
  339. querySQL.addJoinTable(JOINTYPE.left, "sys_users", "t3", "t3.userid=t1.userid "
  340. , "accountno");
  341. querySQL.addJoinTable(JOINTYPE.left, "sys_userrole", "t4", "t4.userid=t1.userid and t4.siteid=t1.siteid");
  342. querySQL.addJoinTable(JOINTYPE.left, "sys_role", "t5", "t5.roleid=t4.roleid and t5.siteid=t4.siteid and t5.rolename='" + Parameter.get("storerolename") + "'");
  343. querySQL.addQueryFields("status", "case when t5.roleid >0 then '启用' else '停用' end");
  344. querySQL.setSiteid(siteid);
  345. querySQL.setWhere(where.toString());
  346. querySQL.setWhere("t2.sa_storeid", sa_storeid);
  347. querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
  348. Rows rows = querySQL.query();
  349. //查询角色
  350. RowsMap roleRowsMap = StoreHelper.getRoleRowsMap(controller, rows.toArray("userid"));
  351. //查询门店
  352. RowsMap storeRowsMap = StoreHelper.getStoreRowsMap(controller, rows.toArray("sys_enterprise_hrid"));
  353. for (Row row : rows) {
  354. row.put("headpic", getHeadPic(row.getLong("userid")));
  355. Rows roleRows = roleRowsMap.getOrDefault(row.getString("userid"), new Rows());
  356. row.put("rolenames", String.join(",", roleRows.toArrayList("rolename")));
  357. Rows storeRows = storeRowsMap.getOrDefault(row.getString("sys_enterprise_hrid"), new Rows());
  358. row.put("storenames", String.join(",", storeRows.toArrayList("storename")));
  359. row.putIfAbsent("createdate", "");
  360. row.putIfAbsent("changedate", "");
  361. }
  362. return getSucReturnObject().setData(rows).toString();
  363. }
  364. @API(title = "添加门店人员", apiversion = R.ID20240410153502.v1.class)
  365. public String addstoreHrs() throws YosException {
  366. Long sa_storeid = content.getLongValue("sa_storeid");
  367. JSONArray sys_enterprise_hrids = content.getJSONArray("sys_enterprise_hrids");
  368. ArrayList<String> sqlList = new ArrayList<>();
  369. for (Object object : sys_enterprise_hrids) {
  370. InsertSQL insertSQL = SQLFactory.createInsertSQL(controller, "sa_store_hr");
  371. insertSQL.setSiteid(siteid);
  372. insertSQL.setUniqueid(createTableID("sa_store_hr"));
  373. insertSQL.setValue("sys_enterpriseid", sys_enterpriseid);
  374. insertSQL.setValue("sa_storeid", sa_storeid);
  375. insertSQL.setValue("sys_enterprise_hrid", object);
  376. insertSQL.setWhere("not exists(select 1 from sa_store_hr where sys_enterprise_hrid=" + object + " and sa_storeid=" + sa_storeid + " and siteid='" + siteid + "')");
  377. sqlList.add(insertSQL.getSQL());
  378. }
  379. dbConnect.runSqlUpdate(sqlList);
  380. return getSucReturnObject().toString();
  381. }
  382. @API(title = "删除门店人员", apiversion = R.ID20240410153602.v1.class)
  383. public String deleteStoreHrs() throws YosException {
  384. JSONArray sa_store_hrids = content.getJSONArray("sa_store_hrids");
  385. DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(controller, "sa_store_hr");
  386. deleteSQL.setSiteid(siteid);
  387. deleteSQL.setWhere("sa_store_hrid", sa_store_hrids);
  388. deleteSQL.delete();
  389. return getSucReturnObject().toString();
  390. }
  391. }