数据库信息查看
This commit is contained in:
parent
b0651a83bb
commit
209ae25e34
@ -0,0 +1,32 @@
|
|||||||
|
package com.ruoyi.online.controller;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.online.mapper.OnlineDbMapper;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/online/db")
|
||||||
|
@Anonymous
|
||||||
|
public class OnlineDbController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OnlineDbMapper onlineDbMapper;
|
||||||
|
|
||||||
|
@GetMapping("/table/list")
|
||||||
|
public TableDataInfo selectDbTableList(BaseEntity baseEntity){
|
||||||
|
startPage();
|
||||||
|
return getDataTable(onlineDbMapper.selectDbTableList(baseEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/column/list")
|
||||||
|
public TableDataInfo selectDbColumnsListByTableName(String tableName){
|
||||||
|
return getDataTable(onlineDbMapper.selectDbColumnsListByTableName(tableName));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.ruoyi.online.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
public interface OnlineDbMapper {
|
||||||
|
public List<Map<String,String>> selectDbTableList(BaseEntity baseEntity);
|
||||||
|
public List<Map<String,String>> selectDbColumnsListByTableName(String tableName);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.online.mapper.OnlineDbMapper">
|
||||||
|
<select id="selectDbTableList" resultType="java.util.Map">
|
||||||
|
select * from information_schema.tables
|
||||||
|
where table_schema = (select database())
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDbColumnsListByTableName" parameterType="String" resultType="java.util.Map">
|
||||||
|
select * from information_schema.columns
|
||||||
|
where table_schema = (select database())
|
||||||
|
and table_name = #{tableName};
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -18,9 +18,16 @@ CREATE TABLE online_mb (
|
|||||||
PRIMARY KEY (mb_id)
|
PRIMARY KEY (mb_id)
|
||||||
) ENGINE = InnoDB COMMENT = '在线接口';
|
) ENGINE = InnoDB COMMENT = '在线接口';
|
||||||
|
|
||||||
|
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, `status`, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ('Online', 0, 5, 'online', NULL, NULL, 1, 0, 'M', '0', '0', NULL, 'international', 'admin', '2024-03-07 19:38:34', '', NULL, '');
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
-- 菜单 SQL
|
-- 菜单 SQL
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('mybatis在线接口', '3', '1', 'mb', 'online/mb/index', 1, 0, 'C', '0', '0', 'online:mb:list', 'code', 'admin', sysdate(), '', null, 'mybatis在线接口菜单');
|
values('mybatis在线接口', @parentId, '1', 'mb', 'online/mb/index', 1, 0, 'C', '0', '0', 'online:mb:list', 'code', 'admin', sysdate(), '', null, 'mybatis在线接口菜单');
|
||||||
|
|
||||||
|
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ('数据库', @parentId, 1, 'db', 'online/db/index', NULL, 1, 0, 'C', '0', '0', 'admin', 'table', 'admin', '2024-03-07 19:48:24', 'admin', '2024-03-07 19:54:46', '');
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
-- 按钮父菜单ID
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
Loading…
Reference in New Issue
Block a user