|
@@ -4,7 +4,9 @@ import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import com.ruoyi.common.security.annotation.InnerAuth;
|
|
import com.ruoyi.common.security.annotation.InnerAuth;
|
|
|
|
+import com.ruoyi.system.api.domain.SysDictData;
|
|
import com.ruoyi.system.domain.vo.TreeSelect;
|
|
import com.ruoyi.system.domain.vo.TreeSelect;
|
|
|
|
+import com.ruoyi.system.service.ISysDictDataService;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -32,6 +34,9 @@ public class SysDeptController extends BaseController
|
|
@Autowired
|
|
@Autowired
|
|
private ISysDeptService deptService;
|
|
private ISysDeptService deptService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysDictDataService dictDataService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取部门列表
|
|
* 获取部门列表
|
|
*/
|
|
*/
|
|
@@ -79,6 +84,21 @@ public class SysDeptController extends BaseController
|
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
|
}
|
|
}
|
|
dept.setCreateBy(SecurityUtils.getUsername());
|
|
dept.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
+
|
|
|
|
+ if(dept.getDeptName().matches(".*公司$")){
|
|
|
|
+ SysDictData dict = new SysDictData();
|
|
|
|
+
|
|
|
|
+ dict.setDictType("mast_enterprise");
|
|
|
|
+ List<SysDictData> sysDictDatas = dictDataService.selectDictDataList(dict);
|
|
|
|
+ dict.setListClass("default");
|
|
|
|
+ dict.setDictLabel(dept.getDeptName());
|
|
|
|
+ dict.setDictSort((long) (sysDictDatas.size()+1));
|
|
|
|
+ dict.setDictValue(String.valueOf(sysDictDatas.size()+1));
|
|
|
|
+ dict.setStatus("0");
|
|
|
|
+
|
|
|
|
+ dictDataService.insertDictData(dict);
|
|
|
|
+ }
|
|
|
|
+
|
|
return toAjax(deptService.insertDept(dept));
|
|
return toAjax(deptService.insertDept(dept));
|
|
}
|
|
}
|
|
|
|
|