Browse Source

人员邀请个人信息修改中角色逻辑调整

eganwu 1 year ago
parent
commit
1fa093adc8
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/custom/restcontroller/webmanage/saletool/store/StoreTeam.java

+ 4 - 4
src/custom/restcontroller/webmanage/saletool/store/StoreTeam.java

@@ -314,8 +314,7 @@ public class StoreTeam extends Controller {
             updateSQL.setValue("usertype", usertype);
             updateSQL.update();
 
-            ArrayList<Long> deleteroles = dbConnect.runSqlQuery("select roleid from sys_role where siteid='" + siteid + "' and usertype='31' and issystem=1").toArrayList("roleid", new ArrayList<>());
-            ArrayList<Long> defaultroles = dbConnect.runSqlQuery("select roleid from sys_role where siteid='" + siteid + "' and usertype='" + usertype + "' and issystem=1").toArrayList("roleid", new ArrayList<>());
+            ArrayList<Long> deleteroles = dbConnect.runSqlQuery("SELECT visitor_roleid from sys_wechatapp WHERE (systemclient='" + systemclient + "' or systemclient_auth='" + systemclient + "' ) and  siteid='" + siteid + "'  and isvisitor=1").toArrayList("roleid", new ArrayList<>());
 
             if (deleteroles.size() > 0) {
                 DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sys_userrole");
@@ -325,12 +324,13 @@ public class StoreTeam extends Controller {
                 deleteSQL.delete();
             }
 
-            for (Long roleid : defaultroles) {
+            rows = dbConnect.runSqlQuery("select * from sys_role where rolename='" + Parameter.get("storerolename") + "' and siteid='" + siteid + "'");
+            if (rows.isNotEmpty()) {
                 InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_userrole");
                 insertSQL.setSiteid(siteid);
                 insertSQL.setUniqueid(createTableID("sys_userrole"));
                 insertSQL.setValue("userid", userid);
-                insertSQL.setValue("roleid", roleid);
+                insertSQL.setValue("roleid", rows.get(0).getLong("roleid"));
                 insertSQL.insert();
             }