Browse Source

数据应用查询模块

wangzhe 2 years ago
parent
commit
0cdafd97f2

+ 8 - 0
leiSP-system/src/main/java/com/sooka/system/mapper/SysMenuMapper.java

@@ -27,6 +27,14 @@ public interface SysMenuMapper
     public List<SysMenu> selectMenuAllByUserId(Long userId);
 
     /**
+     * 根据父ID查询菜单
+     *
+     * @param parentId 上级ID
+     * @return 菜单列表
+     */
+    public List<SysMenu> selectMenuListByParentId(Long parentId);
+
+    /**
      * 查询系统正常显示菜单(不含按钮)
      * 
      * @return 菜单列表

+ 7 - 0
leiSP-system/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -60,6 +60,13 @@
 		order by m.parent_id, m.order_num
 	</select>
 
+	<select id="selectMenuListByParentId" parameterType="Long" resultMap="SysMenuResult">
+		select m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, ifnull(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
+		from sys_menu m
+		where m.menu_type in ('M', 'C') and m.visible = 0 and m.parent_id = #{parentId}
+		order by m.order_num
+	</select>
+
 	<select id="selectPermsByUserId" parameterType="Long" resultType="String">
 		select distinct m.perms
 		from sys_menu m

+ 24 - 1
mybusiness/src/main/java/com/sooka/system/controller/TUInterfaceinfoController.java

@@ -1,5 +1,6 @@
 package com.sooka.system.controller;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -11,6 +12,8 @@ import com.sooka.common.core.page.TableDataInfo;
 import com.sooka.common.enums.BusinessType;
 import com.sooka.common.utils.poi.ExcelUtil;
 import com.sooka.system.domain.*;
+import com.sooka.system.mapper.SysMenuMapper;
+import com.sooka.system.service.ISysMenuService;
 import com.sooka.system.service.ITUParamsbusinessService;
 import com.sooka.system.service.ITUParamspublicService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -44,6 +47,8 @@ public class TUInterfaceinfoController extends BaseController {
     private ITUParamsbusinessService ituParamsbusinessService;
     @Resource
     private ITUParamspublicService ituParamspublicService;
+    @Resource
+    private SysMenuMapper menuMapper;
 
     @RequiresPermissions("system:interfaceinfo:view")
     @GetMapping("/{shareType}")
@@ -66,7 +71,7 @@ public class TUInterfaceinfoController extends BaseController {
     }
 
     /**
-     * 根据部门ID获取接口
+     * 根据部门ID获取接口应用
      */
     @GetMapping("/selectInterfaceByDeptId/{deptId}/{shareType1}/{shareType3}")
     public String selectInterfaceByDeptId(@PathVariable("deptId") String deptId,
@@ -87,6 +92,24 @@ public class TUInterfaceinfoController extends BaseController {
     }
 
     /**
+     * 根据部门ID获取数据应用
+     */
+    @GetMapping("/selectDataByDeptId/{deptId}")
+    public String selectDataByDeptId(@PathVariable("deptId") Long deptId, ModelMap mmap)
+    {
+        startPage();
+        List<SysMenu> menuList = menuMapper.selectMenuListByParentId(deptId);
+        List<TUInterfaceinfo> list = new ArrayList();
+        for (int i = 0; i < menuList.size(); i++) {
+            TUInterfaceinfo tuInterfaceinfo = new TUInterfaceinfo();
+            tuInterfaceinfo.setInterfaceName(menuList.get(i).getMenuName());
+            list.add(tuInterfaceinfo);
+        }
+        mmap.put("list", list.stream().collect(Collectors.toList()));
+        return prefix + "/selectData";
+    }
+
+    /**
      * 根据部门ID获取接口
      */
     @RequestMapping("/selectInterfaceByIds")

+ 2 - 2
mybusiness/src/main/resources/templates/applyData/record/add.html

@@ -175,8 +175,8 @@
         if(deptId == "" || deptId == null){
             $.modal.alertError('请先选择数据应用提供部门');
         }else{
-            let url = prefix + '/interfaceinfo/selectInterfaceByDeptId/' + deptId + '/share_type_1/share_type_4';
-            $.modal.open("请选择接口", url, ($(window).width() - 50),($(window).height() - 50), interfaceCallback);
+            let url = prefix + '/interfaceinfo/selectDataByDeptId/' + deptId;
+            $.modal.open("请选择数据应用", url, ($(window).width() - 50),($(window).height() - 50), interfaceCallback);
         }
     }
 

+ 2 - 2
mybusiness/src/main/resources/templates/applyData/record/edit.html

@@ -226,8 +226,8 @@
         if(deptId == "" || deptId == null){
             $.modal.alertError('请先选择数据应用提供部门');
         }else{
-            let url = prefix + '/interfaceinfo/selectInterfaceByDeptId/' + deptId + '/share_type_1/share_type_4';
-            $.modal.open("请选择接口", url, ($(window).width() - 50),($(window).height() - 50), interfaceCallback);
+            let url = prefix + '/interfaceinfo/selectDataByDeptId/' + deptId;
+            $.modal.open("请选择数据应用", url, ($(window).width() - 50),($(window).height() - 50), interfaceCallback);
         }
     }
 

+ 147 - 0
mybusiness/src/main/resources/templates/system/interfaceinfo/selectData.html

@@ -0,0 +1,147 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('选择数据应用')" />
+</head>
+<body>
+<div class="main-content">
+    <form id="form-user-add" class="form-horizontal">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="col-sm-12 select-table table-striped">
+                    <table id="bootstrap-table"></table>
+                </div>
+            </div>
+        </div>
+    </form>
+</div>
+<th:block th:include="include :: footer" />
+<script th:inline="javascript">
+    let prefix = ctx + "system/interfaceinfo";
+    let list = [[${list}]];
+    let shareType_datas = [[${@dict.getType('share_type')}]];
+    let interfaceType_datas = [[${@dict.getType('interface_type')}]];
+    let shareType = [[${shareType}]];
+
+    $(function() {
+        let options = {
+            data: list,
+            sidePagination: "client",
+            sortName: "roleSort",
+            showSearch: false,
+            showRefresh: false,
+            showToggle: false,
+            showColumns: false,
+            clickToSelect: true,
+            maintainSelected: true,
+            columns: [{
+                checkbox: true,
+                formatter:function (value, row, index) {
+                    if($.common.isEmpty(value)) {
+                        return { checked: row.flag };
+                    } else {
+                        return { checked: value }
+                    }
+                }
+            },
+            {
+                field: 'id',
+                title: '主键ID',
+                visible: false
+            },
+
+            {
+                field: 'remark',
+                title: '注释',
+                visible: false
+            },
+            {
+                field: 'code',
+                title: '接口码',
+                visible: false
+            },
+            {
+                field: 'interfaceName',
+                title: '数据应用名称'
+            },
+            {
+                field: 'infoItem',
+                title: '信息项',
+                visible: false
+            },
+            {
+                field: 'usageScenarios',
+                title: '使用场景描述',
+                visible: false
+            },
+            {
+                field: 'shareType',
+                title: '接口方式',
+                formatter: function (value, item, index) {
+                    return $.table.selectDictLabel(shareType_datas, item.shareType);
+                },
+                visible: false
+            },
+            {
+                field: 'interfaceType',
+                title: '请求方式',
+                formatter: function (value, item, index) {
+                    return $.table.selectDictLabel(interfaceType_datas, item.interfaceType);
+                },
+                visible: false
+            },
+            {
+                field: 'env',
+                title: '环境',
+                visible: false
+            },
+            {
+                field: 'signServeraddress',
+                title: '签名服务地址',
+                visible: false
+            },
+            {
+                field: 'interfaceAddress',
+                title: '接口地址',
+                visible: false
+            },
+            {
+                title: '接口状态',
+                align: 'center',
+                formatter: function (value, row, index) {
+                    return statusTools(row);
+                },
+                visible: false
+            },
+            {
+                field: 'typeIam',
+                title: 'IAM方式',
+                visible: false
+            },
+            {
+                field: 'typeAksk',
+                title: 'AK/SK方式',
+                visible: false
+            }]
+        };
+        $.table.init(options);
+    });
+
+    /* 状态显示 */
+    function statusTools(row) {
+        if (row.status === '1') {
+            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
+        } else {
+            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
+        }
+    }
+
+    /* 提交 */
+    function submitHandler(index, layero){
+        let rows = $.table.selectFirstColumns();
+        parent.interfaceCallback("123");
+        closeItem();
+    }
+</script>
+</body>
+</html>

+ 7 - 4
mybusiness/src/main/resources/templates/system/interfaceinfo/selectInterface.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
 <head>
-    <th:block th:include="include :: header('用户分配角色')" />
+    <th:block th:include="include :: header('选择接口应用')" />
 </head>
 <body>
 <div class="main-content">
@@ -94,18 +94,21 @@
             },
             {
                 field: 'signServeraddress',
-                title: '签名服务地址'
+                title: '签名服务地址',
+                visible: false
             },
             {
                 field: 'interfaceAddress',
-                title: '接口地址'
+                title: '接口地址',
+                visible: false
             },
             {
                 title: '接口状态',
                 align: 'center',
                 formatter: function (value, row, index) {
                     return statusTools(row);
-                }
+                },
+                visible: false
             },
             {
                 field: 'typeIam',