Ver código fonte

企业用户插入字典

ZC 3 semanas atrás
pai
commit
5a4ba10225

+ 19 - 10
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java

@@ -8,7 +8,8 @@ import javax.servlet.http.HttpServletResponse;
 
 import com.ruoyi.common.core.constant.SecurityConstants;
 import com.ruoyi.system.api.RemoteExpertService;
-import com.ruoyi.system.api.domain.BsExpert;
+import com.ruoyi.system.api.domain.*;
+import com.ruoyi.system.service.*;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -25,16 +26,7 @@ import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.InnerAuth;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.ruoyi.common.security.utils.SecurityUtils;
-import com.ruoyi.system.api.domain.SysDept;
-import com.ruoyi.system.api.domain.SysRole;
-import com.ruoyi.system.api.domain.SysUser;
 import com.ruoyi.system.api.model.LoginUser;
-import com.ruoyi.system.service.ISysConfigService;
-import com.ruoyi.system.service.ISysDeptService;
-import com.ruoyi.system.service.ISysPermissionService;
-import com.ruoyi.system.service.ISysPostService;
-import com.ruoyi.system.service.ISysRoleService;
-import com.ruoyi.system.service.ISysUserService;
 
 /**
  * 用户信息
@@ -66,6 +58,9 @@ public class SysUserController extends BaseController
     @Autowired
     private RemoteExpertService remoteExpertService;
 
+    @Autowired
+    private ISysDictDataService dictDataService;
+
 
     /**
      * 获取用户列表
@@ -223,6 +218,20 @@ public class SysUserController extends BaseController
             remoteExpertService.insertExpert(bsExpert, SecurityConstants.INNER);
         }
 
+        if(user.getUserName().matches(".*公司$")){
+            SysDictData dict = new SysDictData();
+
+            List<SysDictData> sysDictDatas = dictDataService.selectDictDataList(new SysDictData());
+            dict.setDictType("mast_enterprise");
+            dict.setListClass("default");
+            dict.setDictLabel(user.getUserName());
+            dict.setDictSort((long) (sysDictDatas.size()+1));
+            dict.setDictValue(String.valueOf(sysDictDatas.size()+1));
+            dict.setStatus("0");
+
+            dictDataService.insertDictData(dict);
+        }
+
         return toAjax(i);
     }