Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

Administrator 4 tahun lalu
induk
melakukan
234b5480ae

+ 2 - 0
boman-modules/boman-file/src/main/java/com/boman/file/service/LocalSysFileServiceImpl.java

@@ -1,6 +1,7 @@
 package com.boman.file.service;
 
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
@@ -13,6 +14,7 @@ import com.boman.file.utils.FileUploadUtils;
  */
 @Primary
 @Service
+@RefreshScope
 public class LocalSysFileServiceImpl implements ISysFileService
 {
     /**

+ 1 - 1
boman-modules/boman-system/src/main/java/com/boman/system/controller/SysRoleController.java

@@ -41,7 +41,7 @@ public class SysRoleController extends BaseController
     @GetMapping("/list")
     public TableDataInfo list(SysRole role)
     {
-        startPage();
+//        startPage();
         List<SysRole> list = roleService.selectRoleList(role);
         return getDataTable(list);
     }

+ 32 - 18
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysMenuServiceImpl.java

@@ -9,6 +9,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.common.core.web.domain.AjaxResult;
 import com.boman.system.api.domain.SysMenu;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -189,29 +190,42 @@ public class SysMenuServiceImpl implements ISysMenuService
      * @return 树结构列表
      */
     @Override
-    public List<SysMenu> buildMenuTree(List<SysMenu> menus)
-    {
-        List<SysMenu> returnList = new ArrayList<SysMenu>();
-        List<Long> tempList = new ArrayList<Long>();
-        for (SysMenu dept : menus)
-        {
-            tempList.add(dept.getId());
-        }
-        for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext();)
-        {
-            SysMenu menu = (SysMenu) iterator.next();
+    public List<SysMenu> buildMenuTree(List<SysMenu> menus) {
+        List<SysMenu> returnList = new ArrayList<>();
+        List<Long> allMenuId = ObjectUtils.map(menus, SysMenu::getId);
+        for (SysMenu menu : menus) {
             // 如果是顶级节点, 遍历该父节点的所有子节点
-            if (!tempList.contains(menu.getParentId()))
-            {
-                recursionFn(menus, menu);
+            if (!allMenuId.contains(menu.getParentId())) {
+                recursionNotAddLeafNode(menus, menu);
                 returnList.add(menu);
             }
         }
-        if (returnList.isEmpty())
-        {
-            returnList = menus;
+
+        return returnList.isEmpty() ? menus : returnList;
+    }
+
+    /**
+     * 功能描述: 递归调用,叶子节点不放到父类中
+     *
+     * @param list 所有的菜单
+     * @param menu 当前菜单
+     */
+    private void recursionNotAddLeafNode(List<SysMenu> list, SysMenu menu) {
+        // 叶子结点
+        int count = 0;
+        // 得到子节点列表
+        List<SysMenu> childList = getChildList(list, menu);
+        for (SysMenu tChild : childList) {
+            if (hasChild(list, tChild)) {
+                recursionFn(list, tChild);
+            } else {
+                // 为叶子节点
+                count++;
+            }
+        }
+        if (count != childList.size()) {
+            menu.setChildren(childList);
         }
-        return returnList;
     }
 
     /**

+ 2 - 0
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -224,6 +224,8 @@ public class TableServiceCmdService {
         checkColumn(showData, genTable.getColumns());
         // 需要返回到前台的列, 需要判断是否是列表展示, 4为判断列表是否可见
         showData = filterData(columns, 4, showData, MaskConstant.LIST_VISIBLE::equals);
+        // 表的id单独处理,不管mask,都查出来返给前台
+        IdUtils.putIfNotContains(showData, IdUtils.getPkName(columns));
 
         JSONObject rows = new JSONObject();
         int total = selectService.countByCondition(genTable.getTableName(), condition, packCondition);

+ 12 - 0
boman-web-core/src/main/java/com/boman/web/core/utils/IdUtils.java

@@ -1,5 +1,6 @@
 package com.boman.web.core.utils;
 
+import com.alibaba.fastjson.JSONArray;
 import com.boman.common.core.utils.SpringUtils;
 import com.boman.common.redis.RedisKey;
 import com.boman.common.redis.service.RedisService;
@@ -9,6 +10,7 @@ import org.apache.commons.collections.CollectionUtils;
 
 import java.util.List;
 
+import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
 import static com.boman.common.core.utils.obj.ObjectUtils.requireNonNull;
 
 /**
@@ -54,4 +56,14 @@ public class IdUtils {
         throw new IllegalArgumentException("获取主键失败");
     }
 
+    public static void putIfNotContains(JSONArray jsonArray, String input) {
+        if (isEmpty(jsonArray)) {
+            jsonArray = new JSONArray();
+        }
+
+        if (!jsonArray.contains(input)) {
+            jsonArray.add(input);
+        }
+    }
+
 }

+ 2 - 2
ruoyi-ui/src/settings.js

@@ -1,10 +1,10 @@
 module.exports = {
   title: '潜山市云数据中心',
   // urls: `http://192.168.101.11:8090`,
-  urls: `http://192.168.101.110:8090`,
+  // urls: `http://192.168.101.110:8090`,
   // urls: `http://192.168.101.49:8080`,
 
-  // urls: ``,
+  urls: ``,
 
   /**
    * 侧边栏主题 深色主题theme-dark,浅色主题theme-light

+ 18 - 4
ruoyi-ui/src/views/system/form/index.vue

@@ -2,7 +2,9 @@
   <div class="tabForm">
     <div class="tabForm_header">
       <div class="table_headerBtun" v-if="queryData.buttonList">
-        <el-button type="primary" size="small" plain @click="handleQuery(item)" v-for="(item,index) in queryData.buttonList.split('')" :key="index">{{item | btnConversion}}</el-button>
+        <el-button type="primary" size="small" plain @click="handleQuery(item)" v-for="(item,index) in queryData.buttonList.split('')" :key="index">{{item | btnConversion}}</el-button>
+        <el-button type="primary" size="small" plain @click="handleQuery('sx')">刷新</el-button>
+        <el-button type="primary" size="small" plain @click="handleQuery('fh')">返回</el-button>
       </div>
     </div>
     <!-- 内容 -->
@@ -97,6 +99,7 @@
         postList: {},
         numtab: 0,
         tabldie:[],
+        xidugje: '',
         tabShoes:false,//tab 显示隐藏
         tableZbietabg:{
           table:'sys_user'
@@ -196,12 +199,15 @@
           console.log(res)
           let data = res.data
           this.queryData = data
-          console.log(this.queryData,567)
+          if(this.xidugje == 'sx'){
+            if(res.code == 200){
+              this.msgSuccess("操作成功");
+            }
+          }
         })
       },
       // tab数据
       edingelsietab(){
-        console.log(4566)
         geteditindeTab(this.tableZbietabg).then(response => {
           if(response.data.ref.length !==0){
             this.tabldie = response.data.ref
@@ -246,7 +252,14 @@
       },
       /** 搜索按钮操作 */
       handleQuery(index) {
-         console.log(index,4)
+        if(index == 'fs'){
+          this.$router.go(-1)
+          return
+        }else if(index == 'sx'){
+          this.xidugje = 'sx'
+          this.init()
+          return
+        }
          for(let item of this.queryData.showData){
            for(var i = 0 ; i < item.hrChildren.length ; i++){
              if(item.hrChildren[i].htmlType == 'checkbox' || item.hrChildren[i].htmlType == 'imageUpload' || item.hrChildren[i].htmlType == 'fileUpload'){
@@ -290,6 +303,7 @@
            //新增
            // this.forme.table = 'obj_test'
            // this.forme.objId = -1
+           
            this.forme.fixedData = this.queryParams
            this.submitForm()
          }

+ 19 - 19
ruoyi-ui/src/views/system/role/index.vue

@@ -103,7 +103,7 @@
 
     <el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="角色编号" prop="roleId" width="120" />
+      <el-table-column label="角色编号" prop="id" width="120" />
       <el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
       <el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
       <el-table-column label="显示顺序" prop="roleSort" width="100" />
@@ -388,15 +388,15 @@ export default {
       return checkedKeys;
     },
     /** 根据角色ID查询菜单树结构 */
-    getRoleMenuTreeselect(roleId) {
-      return roleMenuTreeselect(roleId).then(response => {
+    getRoleMenuTreeselect(id) {
+      return roleMenuTreeselect(id).then(response => {
         this.menuOptions = response.menus;
         return response;
       });
     },
     /** 根据角色ID查询部门树结构 */
-    getRoleDeptTreeselect(roleId) {
-      return roleDeptTreeselect(roleId).then(response => {
+    getRoleDeptTreeselect(id) {
+      return roleDeptTreeselect(id).then(response => {
         this.deptOptions = response.depts;
         return response;
       });
@@ -409,7 +409,7 @@ export default {
           cancelButtonText: "取消",
           type: "warning"
         }).then(function() {
-          return changeRoleStatus(row.roleId, row.status);
+          return changeRoleStatus(row.id, row.status);
         }).then(() => {
           this.msgSuccess(text + "成功");
         }).catch(function() {
@@ -436,7 +436,7 @@ export default {
       this.deptExpand = true,
       this.deptNodeAll = false,
       this.form = {
-        roleId: undefined,
+        id: undefined,
         roleName: undefined,
         roleKey: undefined,
         roleSort: 0,
@@ -462,7 +462,7 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.roleId)
+      this.ids = selection.map(item => item.id)
       this.single = selection.length!=1
       this.multiple = !selection.length
     },
@@ -506,9 +506,9 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const roleId = row.roleId || this.ids
-      const roleMenu = this.getRoleMenuTreeselect(roleId);
-      getRole(roleId).then(response => {
+      const id = row.id || this.ids
+      const roleMenu = this.getRoleMenuTreeselect(id);
+      getRole(id).then(response => {
         this.form = response.data;
         this.open = true;
         this.$nextTick(() => {
@@ -533,8 +533,8 @@ export default {
     /** 分配数据权限操作 */
     handleDataScope(row) {
       this.reset();
-      const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId);
-      getRole(row.roleId).then(response => {
+      const roleDeptTreeselect = this.getRoleDeptTreeselect(row.id);
+      getRole(row.id).then(response => {
         this.form = response.data;
         this.openDataScope = true;
         this.$nextTick(() => {
@@ -549,7 +549,7 @@ export default {
     submitForm: function() {
       this.$refs["form"].validate(valid => {
         if (valid) {
-          if (this.form.roleId != undefined) {
+          if (this.form.id != undefined) {
             this.form.menuIds = this.getMenuAllCheckedKeys();
             updateRole(this.form).then(response => {
               this.msgSuccess("修改成功");
@@ -569,7 +569,7 @@ export default {
     },
     /** 提交按钮(数据权限) */
     submitDataScope: function() {
-      if (this.form.roleId != undefined) {
+      if (this.form.id != undefined) {
         this.form.deptIds = this.getDeptAllCheckedKeys();
         dataScope(this.form).then(response => {
           this.msgSuccess("修改成功");
@@ -580,13 +580,13 @@ export default {
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const roleIds = row.roleId || this.ids;
-      this.$confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?', "警告", {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除角色编号为"' + ids + '"的数据项?', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
         }).then(function() {
-          return delRole(roleIds);
+          return delRole(ids);
         }).then(() => {
           this.getList();
           this.msgSuccess("删除成功");
@@ -607,4 +607,4 @@ export default {
     }
   }
 };
-</script>
+</script>

+ 2 - 4
ruoyi-ui/src/views/system/table/index.vue

@@ -4,7 +4,7 @@
       <!-- <p>单表</p>
       <el-divider></el-divider> -->
       <div class="table_headerBtun" v-if="queryData.buttonList">
-        <el-button type="primary" size="mini"  plain v-for="(item,index) in jeigneutwo" :key="index" @click="handleQuery(item)">{{item }}</el-button>
+        <el-button type="primary" size="mini"  plain v-for="(item,index) in jeigneutwo" :key="index" @click="handleQuery(item)">{{item}}</el-button>
       </div>
     </div>
     <!-- 内容 -->
@@ -135,7 +135,6 @@
       },
       /** 搜索按钮操作 */
       handleQuery(index) {
-         console.log(index,4)
          for(let item of this.queryData.showData){
            for(var i = 0 ; i < item.hrChildren.length ; i++){
              if(item.hrChildren[i].htmlType == 'checkbox' || item.hrChildren[i].htmlType == 'imageUpload' || item.hrChildren[i].htmlType == 'fileUpload'){
@@ -210,7 +209,6 @@
 
       },
       init() {
-
         getTableQuery(
           this.tableZbie
         ).then(res => {
@@ -303,7 +301,7 @@
                 // if(this.xidugje =="新增"){
                 //    this.$router.go(-2)
                 // }else{
-                  this.$router.go(-1)
+                  this.$router.replace('surface')
                 // }
 
                 // this.getList();

+ 0 - 1
ruoyi-ui/src/views/tool/gen/editTable.vue

@@ -777,7 +777,6 @@
           let data = response.data
           data.relationType = data.relationType + ""
           data.embedEdit = data.embedEdit?(data.embedEdit + ""): data.embedEdit
-
           getGenTable(data.relationParentId).then(res => {
             this.genList = res.data.rows;
             this.form = data;