|
|
@@ -7,8 +7,8 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
|
import common.annotation.API;
|
|
|
-import common.data.Rows;
|
|
|
-import common.data.SQLFactory;
|
|
|
+import common.data.*;
|
|
|
+import restcontroller.R;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
@@ -231,4 +231,235 @@ public class coursewareauth extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @API(title = "通告权限新增", apiversion = R.ID20240314145102.v1.class)
|
|
|
+ public String add() throws YosException {
|
|
|
+ Long sat_coursewareid = content.getLongValue("sat_coursewareid");
|
|
|
+
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+
|
|
|
+ if (content.containsKey("sys_enterpriseids")) {
|
|
|
+ JSONArray sys_enterpriseids = content.getJSONArray("sys_enterpriseids");
|
|
|
+ for (Object obj : sys_enterpriseids) {
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sat_courseware_auth");
|
|
|
+ insertSQL.setUniqueid(createTableID("sat_courseware_auth"));
|
|
|
+ insertSQL.setSiteid(siteid);
|
|
|
+ insertSQL.setValue("sat_coursewareid", sat_coursewareid);
|
|
|
+ insertSQL.setValue("sys_enterpriseid", obj);
|
|
|
+ insertSQL.setWhere("not exists(select 1 from sat_courseware_auth where sys_enterpriseid=" + obj + " and sat_coursewareid=" + sat_coursewareid + " and siteid='" + siteid + "' )");
|
|
|
+ sqlList.add(insertSQL.getSQL());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.containsKey("departmentids")) {
|
|
|
+ JSONArray departmentids = content.getJSONArray("departmentids");
|
|
|
+ for (Object obj : departmentids) {
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sat_courseware_auth");
|
|
|
+ insertSQL.setUniqueid(createTableID("sat_courseware_auth"));
|
|
|
+ insertSQL.setSiteid(siteid);
|
|
|
+ insertSQL.setValue("sat_coursewareid", sat_coursewareid);
|
|
|
+ insertSQL.setValue("departmentid", obj);
|
|
|
+ insertSQL.setWhere("not exists(select 1 from sat_courseware_auth where departmentid=" + obj + " and sat_coursewareid=" + sat_coursewareid + " and siteid='" + siteid + "' )");
|
|
|
+ sqlList.add(insertSQL.getSQL());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.containsKey("hrids")) {
|
|
|
+ JSONArray hrids = content.getJSONArray("hrids");
|
|
|
+ for (Object obj : hrids) {
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sat_courseware_auth");
|
|
|
+ insertSQL.setUniqueid(createTableID("sat_courseware_auth"));
|
|
|
+ insertSQL.setSiteid(siteid);
|
|
|
+ insertSQL.setValue("sat_coursewareid", sat_coursewareid);
|
|
|
+ insertSQL.setValue("hrid", obj);
|
|
|
+ insertSQL.setWhere("not exists(select 1 from sat_courseware_auth where hrid=" + obj + " and sat_coursewareid=" + sat_coursewareid + " and siteid='" + siteid + "' )");
|
|
|
+ sqlList.add(insertSQL.getSQL());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.containsKey("sa_saleareaids")) {
|
|
|
+ JSONArray sa_saleareaids = content.getJSONArray("sa_saleareaids");
|
|
|
+ for (Object obj : sa_saleareaids) {
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sat_courseware_auth");
|
|
|
+ insertSQL.setUniqueid(createTableID("sat_courseware_auth"));
|
|
|
+ insertSQL.setSiteid(siteid);
|
|
|
+ insertSQL.setValue("sat_coursewareid", sat_coursewareid);
|
|
|
+ insertSQL.setValue("sa_saleareaid", obj);
|
|
|
+ insertSQL.setWhere("not exists(select 1 from sat_courseware_auth where sa_saleareaid=" + obj + " and sat_coursewareid=" + sat_coursewareid + " and siteid='" + siteid + "' )");
|
|
|
+ sqlList.add(insertSQL.getSQL());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sqlList.size() > 0) {
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @API(title = "课程角色权限新增", apiversion = R.ID20240314145202.v1.class)
|
|
|
+ public String addrole() throws YosException {
|
|
|
+ Long sat_coursewareid = content.getLongValue("sat_coursewareid");
|
|
|
+
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ JSONArray roleids = content.getJSONArray("roleids");
|
|
|
+ for (Object obj : roleids) {
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sat_courseware_auth");
|
|
|
+ insertSQL.setUniqueid(createTableID("sat_courseware_auth"));
|
|
|
+ insertSQL.setSiteid(siteid);
|
|
|
+ insertSQL.setValue("sat_coursewareid", sat_coursewareid);
|
|
|
+ insertSQL.setValue("roleid", obj);
|
|
|
+ insertSQL.setValue("roleid", obj);
|
|
|
+ insertSQL.setWhere("not exists(select 1 from sat_courseware_auth where roleid=" + obj + " and sat_coursewareid=" + sat_coursewareid + " and siteid='" + siteid + "' )");
|
|
|
+ sqlList.add(insertSQL.getSQL());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sqlList.size() > 0) {
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+ }
|
|
|
+
|
|
|
+ DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sat_courseware_auth");
|
|
|
+ deleteSQL.setSiteid(siteid);
|
|
|
+ deleteSQL.setWhere("sat_coursewareid", sat_coursewareid);
|
|
|
+ deleteSQL.setWhere("roleid not in " + roleids.toString().replace("[", "(").replace("]", ")") + "");
|
|
|
+ deleteSQL.delete();
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "通告角色权限删除", apiversion = R.ID20240314145302.v1.class)
|
|
|
+ public String deleteQuanXian() throws YosException {
|
|
|
+ Long sat_coursewareid = content.getLongValue("sat_coursewareid");
|
|
|
+
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+
|
|
|
+ if (content.containsKey("sys_enterpriseids")) {
|
|
|
+ JSONArray sys_enterpriseids = content.getJSONArray("sys_enterpriseids");
|
|
|
+ DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sat_courseware_auth");
|
|
|
+ deleteSQL.setSiteid(siteid);
|
|
|
+ deleteSQL.setWhere("sat_coursewareid", sat_coursewareid);
|
|
|
+ deleteSQL.setWhere("sys_enterpriseid ", sys_enterpriseids.toArray());
|
|
|
+ sqlList.add(deleteSQL.getSQL());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.containsKey("departmentids")) {
|
|
|
+ JSONArray departmentids = content.getJSONArray("departmentids");
|
|
|
+ DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sat_courseware_auth");
|
|
|
+ deleteSQL.setSiteid(siteid);
|
|
|
+ deleteSQL.setWhere("sat_coursewareid", sat_coursewareid);
|
|
|
+ deleteSQL.setWhere("departmentid ", departmentids);
|
|
|
+ sqlList.add(deleteSQL.getSQL());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.containsKey("hrids")) {
|
|
|
+ JSONArray hrids = content.getJSONArray("hrids");
|
|
|
+ DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sat_courseware_auth");
|
|
|
+ deleteSQL.setSiteid(siteid);
|
|
|
+ deleteSQL.setWhere("sat_coursewareid", sat_coursewareid);
|
|
|
+ deleteSQL.setWhere("hrid ", hrids);
|
|
|
+ sqlList.add(deleteSQL.getSQL());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.containsKey("sa_saleareaids")) {
|
|
|
+ JSONArray sa_saleareaids = content.getJSONArray("sa_saleareaids");
|
|
|
+ DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sat_courseware_auth");
|
|
|
+ deleteSQL.setSiteid(siteid);
|
|
|
+ deleteSQL.setWhere("sat_coursewareid", sat_coursewareid);
|
|
|
+ deleteSQL.setWhere("sa_saleareaid ", sa_saleareaids);
|
|
|
+ sqlList.add(deleteSQL.getSQL());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sqlList.size() > 0) {
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @API(title = "部门列表",apiversion = R.ID20240314145402.v1.class)
|
|
|
+ public String depList() throws YosException {
|
|
|
+
|
|
|
+ Long sat_coursewareid = content.getLongValue("sat_coursewareid");
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_department",
|
|
|
+ "departmentid", "depname", "depno");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sys_department", "t2", "t2.departmentid=t1.parentid and t2.siteid=t1.siteid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sat_courseware_auth", "t3", "t1.siteid=t3.siteid and t1.departmentid=t3.departmentid");
|
|
|
+ querySQL.addQueryFields("parentdepname","t2.depname");
|
|
|
+ querySQL.setWhere("t1.siteid", siteid);
|
|
|
+ querySQL.setWhere("t3.sat_coursewareid",sat_coursewareid);
|
|
|
+ querySQL.setTableAlias("t1").setPage(pageSize, pageNumber);
|
|
|
+
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "人员列表",apiversion = R.ID20240314145502.v1.class)
|
|
|
+ public String hrList() throws YosException {
|
|
|
+ Long sat_coursewareid = content.getLongValue("sat_coursewareid");
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_hr",
|
|
|
+ "hrid", "hrcode", "name", "position");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sys_department", "t2", "t1.siteid=t2.siteid and t1.departmentid=t2.departmentid",
|
|
|
+ "depname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sat_courseware_auth", "t3", "t1.siteid=t3.siteid and t1.hrid=t3.hrid");
|
|
|
+ querySQL.setWhere("t1.siteid", siteid);
|
|
|
+ querySQL.setWhere("t3.sat_coursewareid",sat_coursewareid);
|
|
|
+ querySQL.setTableAlias("t1").setPage(pageSize, pageNumber);
|
|
|
+
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "区域列表",apiversion = R.ID20240314145602.v1.class)
|
|
|
+ public String areaList() throws YosException {
|
|
|
+
|
|
|
+ Long sat_coursewareid = content.getLongValue("sat_coursewareid");
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_salearea",
|
|
|
+ "areaname", "sa_saleareaid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_salearea", "t2", "t2.sa_saleareaid=t1.parentid and t2.siteid=t1.siteid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sat_courseware_auth", "t3", "t1.siteid=t3.siteid and t1.sa_saleareaid=t3.sa_saleareaid");
|
|
|
+ querySQL.addQueryFields("parentareaname","t2.areaname");
|
|
|
+ querySQL.setWhere("t1.siteid", siteid);
|
|
|
+ querySQL.setWhere("t3.sat_coursewareid",sat_coursewareid);
|
|
|
+ querySQL.setTableAlias("t1").setPage(pageSize, pageNumber);
|
|
|
+
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "合作伙伴列表",apiversion = R.ID20240314145702.v1.class)
|
|
|
+ public String enterpriseList() throws YosException {
|
|
|
+ Long sat_coursewareid = content.getLongValue("sat_coursewareid");
|
|
|
+
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents",
|
|
|
+ "agentnum", "sys_enterpriseid", "type");
|
|
|
+
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sys_enterprise", "t2", "t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid",
|
|
|
+ "enterprisename");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise_tradefield", "t5", "t1.sys_enterpriseid = t5.sys_enterpriseid and t1.siteid = t5.siteid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_salearea", "t6", "t5.sa_saleareaid=t6.sa_saleareaid and t5.siteid=t6.siteid",
|
|
|
+ "areaname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sat_courseware_auth", "t3", "t1.siteid=t3.siteid and t1.sys_enterpriseid=t3.sys_enterpriseid");
|
|
|
+ querySQL.setWhere("t1.siteid", siteid);
|
|
|
+ querySQL.setWhere("t3.sat_coursewareid",sat_coursewareid);
|
|
|
+ querySQL.setTableAlias("t1").setPage(pageSize, pageNumber);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|