提交数据库产品管理功能

pull/1136/head
15892072232 2025-11-06 09:39:47 +08:00
parent 16eb9c0e31
commit 8cf08c6fa0
33 changed files with 1693 additions and 1 deletions

1
check_menu.sql 100644
View File

@ -0,0 +1 @@
SELECT menu_id, menu_name, parent_id, path FROM sys_menu WHERE menu_name LIKE '%数据库%';

View File

@ -0,0 +1,27 @@
-- 删除已存在的数据库产品管理相关菜单
DELETE FROM sys_role_menu WHERE menu_id IN (SELECT menu_id FROM sys_menu WHERE perms LIKE 'database:%');
DELETE FROM sys_menu WHERE perms LIKE 'database:%' OR menu_name = '数据库产品管理';
-- 创建数据库产品管理顶级菜单
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES (2000, '数据库产品管理', 0, 6, 'database', NULL, 'M', '0', '0', '', 'database', 'admin', NOW());
-- 创建子菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES
('数据库产品列表', 2000, 1, 'product', 'database/product/index', 'C', '0', '0', 'database:product:list', 'list', 'admin', NOW()),
('姓名一', 2000, 2, 'nameOne', 'database/product/nameOne', 'C', '0', '0', 'database:nameOne:list', 'user', 'admin', NOW()),
('姓名二', 2000, 3, 'nameTwo', 'database/product/nameTwo', 'C', '0', '0', 'database:nameTwo:list', 'user', 'admin', NOW());
-- 创建按钮权限
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES
('新增', 2000, 4, '', '', 'F', '0', '0', 'database:product:add', '#', 'admin', NOW()),
('修改', 2000, 5, '', '', 'F', '0', '0', 'database:product:edit', '#', 'admin', NOW()),
('删除', 2000, 6, '', '', 'F', '0', '0', 'database:product:remove', '#', 'admin', NOW()),
('导出', 2000, 7, '', '', 'F', '0', '0', 'database:product:export', '#', 'admin', NOW()),
('查询', 2000, 8, '', '', 'F', '0', '0', 'database:product:query', '#', 'admin', NOW());
-- 分配权限给管理员角色
INSERT INTO sys_role_menu (role_id, menu_id)
SELECT 1, menu_id FROM sys_menu WHERE perms LIKE 'database:%' OR menu_id = 2000;

7
create_menu.ps1 100644
View File

@ -0,0 +1,7 @@
Write-Host "正在创建数据库产品管理菜单..."
# 执行SQL脚本
& mysql -u root -p -e "source create_menu_simple.sql"
Write-Host "菜单创建完成!"
Read-Host "按任意键继续..."

View File

@ -0,0 +1,30 @@
-- 删除已存在的数据库产品管理相关菜单
DELETE FROM sys_role_menu WHERE menu_id IN (SELECT menu_id FROM sys_menu WHERE perms LIKE 'database:%');
DELETE FROM sys_menu WHERE perms LIKE 'database:%' OR menu_name = '数据库产品管理';
-- 创建数据库产品管理顶级菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES ('数据库产品管理', 0, 6, 'database', NULL, 'M', '0', '0', '', 'database', 'admin', NOW());
-- 获取刚插入的菜单ID
SET @parentId = LAST_INSERT_ID();
-- 创建子菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES
('数据库产品列表', @parentId, 1, 'product', 'database/product/index', 'C', '0', '0', 'database:product:list', 'list', 'admin', NOW()),
('姓名一', @parentId, 2, 'nameOne', 'database/product/nameOne', 'C', '0', '0', 'database:nameOne:list', 'user', 'admin', NOW()),
('姓名二', @parentId, 3, 'nameTwo', 'database/product/nameTwo', 'C', '0', '0', 'database:nameTwo:list', 'user', 'admin', NOW());
-- 创建按钮权限
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES
('新增', @parentId, 4, '', '', 'F', '0', '0', 'database:product:add', '#', 'admin', NOW()),
('修改', @parentId, 5, '', '', 'F', '0', '0', 'database:product:edit', '#', 'admin', NOW()),
('删除', @parentId, 6, '', '', 'F', '0', '0', 'database:product:remove', '#', 'admin', NOW()),
('导出', @parentId, 7, '', '', 'F', '0', '0', 'database:product:export', '#', 'admin', NOW()),
('查询', @parentId, 8, '', '', 'F', '0', '0', 'database:product:query', '#', 'admin', NOW());
-- 分配权限给管理员角色
INSERT INTO sys_role_menu (role_id, menu_id)
SELECT 1, menu_id FROM sys_menu WHERE perms LIKE 'database:%';

View File

@ -0,0 +1,66 @@
# 数据库产品管理菜单配置总结
## 目标
将"数据库产品管理"模块配置为独立显示在左侧菜单栏的顶级菜单,而非"系统管理"的子菜单。具体菜单结构调整如下:
- 数据库产品管理 ← 新增的顶级菜单
- 郑瑜甜
## 已完成的修改
### 1. 数据库菜单配置
- 创建了新的SQL脚本 `sql/final_database_menu.sql`,包含:
- 删除旧的菜单项
- 插入顶级菜单"数据库产品管理"
- 插入子菜单"郑瑜甜"
- 插入相关按钮权限(查询、新增、修改、删除、导出)
- 将权限分配给管理员角色
### 2. 前端路由配置
- 修改了 `ruoyi-ui/src/router/index.js`
- 更新了顶级菜单"数据库产品管理"的配置
- 将子菜单从原来的三个(数据库产品列表、姓名一、姓名二)改为仅包含"郑瑜甜"
- 更新了权限标识从 `database:product:list``database:zhengyutian:list`
- 更新了重定向路径从 `product``zhengyutian`
### 3. 前端API配置
- 创建了新的API文件 `ruoyi-ui/src/api/database/zhengyutian.js`
- 包含查询、获取详情、新增、修改、删除和导出"郑瑜甜"的API函数
- 所有请求路径均以"/database/product"开头
### 4. 前端页面配置
- 修改了 `ruoyi-ui/src/views/database/product/index.vue`
- 更新了API导入从 `product` 改为 `zhengyutian`
- 更新了组件名称从 `DatabaseProduct` 改为 `Zhengyutian`
- 更新了所有权限标识从 `database:product:*` 改为 `database:zhengyutian:*`
- 更新了所有API调用方法名
- 更新了相关文本描述
### 5. 后端Controller配置
- 修改了 `ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DatabaseProductController.java`
- 更新了所有权限注解从 `@PreAuthorize("@ss.hasPermi('database:product:*')")` 改为 `@PreAuthorize("@ss.hasPermi('database:zhengyutian:*')")`
## 执行步骤
1. 手动执行SQL脚本
```
mysql -u root -p -e "source c:/Users/Administrator/RuoYi-Vue/sql/final_database_menu.sql"
```
或者:
```
mysql -u root -p
source c:/Users/Administrator/RuoYi-Vue/sql/final_database_menu.sql
```
2. 重启后端服务
3. 刷新前端页面
## 预期结果
- "数据库产品管理"将作为独立顶级菜单显示在左侧菜单栏
- 点击"数据库产品管理"将展开显示"郑瑜甜"子菜单
- 点击"郑瑜甜"将显示数据库产品管理页面但使用新的权限标识和API
## 注意事项
- 所有权限标识已从 `database:product:*` 更改为 `database:zhengyutian:*`
- 前端路由、API和页面组件已相应更新
- 后端Controller的权限注解已同步更新
- 数据库中的菜单配置需要手动执行SQL脚本才能生效

View File

@ -0,0 +1,5 @@
@echo off
echo 正在执行数据库菜单配置脚本...
mysql -u root -p < sql/database_menu_new.sql
echo 脚本执行完成!
pause

View File

@ -0,0 +1,11 @@
@echo off
echo 正在执行数据库产品管理模块的SQL脚本...
echo 1. 创建数据库产品表...
mysql -u root -p < sql/database_product.sql
echo 2. 创建菜单和权限配置...
mysql -u root -p < sql/database_product_permission_fixed.sql
echo 执行完成!
pause

View File

@ -0,0 +1,11 @@
@echo off
echo 正在执行数据库产品管理模块的SQL脚本...
echo 1. 创建数据库产品表...
mysql -u root -p -e "source sql/database_product.sql"
echo 2. 创建菜单和权限配置...
mysql -u root -p -e "source sql/database_product_permission_fixed.sql"
echo 执行完成!
pause

View File

@ -0,0 +1,5 @@
@echo off
echo Executing database menu configuration...
mysql -u root -p < sql/final_database_menu.sql
echo Script execution completed!
pause

View File

@ -0,0 +1,10 @@
@echo off
echo Please execute the following SQL commands manually in MySQL:
echo.
echo 1. Connect to MySQL: mysql -u root -p
echo 2. Execute: source c:/Users/Administrator/RuoYi-Vue/sql/final_database_menu.sql
echo.
echo Or run this command directly:
echo mysql -u root -p -e "source c:/Users/Administrator/RuoYi-Vue/sql/final_database_menu.sql"
echo.
pause

5
run_menu_sql.bat 100644
View File

@ -0,0 +1,5 @@
@echo off
echo 请输入MySQL密码后按回车键执行SQL脚本...
mysql -u root -p < create_database_menu.sql
echo 菜单创建完成!
pause

15
run_sql.bat 100644
View File

@ -0,0 +1,15 @@
@echo off
echo 正在设置数据库产品管理模块...
echo.
echo 请输入MySQL root密码:
mysql -u root -p < sql/database_product.sql
echo.
echo 数据库产品表创建完成!
echo.
echo 请输入MySQL root密码:
mysql -u root -p < sql/create_database_menu.sql
echo.
echo 菜单和权限配置创建完成!
echo.
echo 设置完成!请重启后端服务并刷新前端页面以查看更改。
pause

View File

@ -16,7 +16,7 @@ public class RuoYiApplication
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
System.out.println("(♥◠‿◠)ノ゙ 数据资源管理系统启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +

View File

@ -0,0 +1,104 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DatabaseProduct;
import com.ruoyi.system.service.IDatabaseProductService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2024-01-20
*/
@RestController
@RequestMapping("/database/product")
public class DatabaseProductController extends BaseController
{
@Autowired
private IDatabaseProductService databaseProductService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('database:zhengyutian:list')")
@GetMapping("/list")
public TableDataInfo list(DatabaseProduct databaseProduct)
{
startPage();
List<DatabaseProduct> list = databaseProductService.selectDatabaseProductList(databaseProduct);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('database:zhengyutian:export')")
@Log(title = "数据库产品", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DatabaseProduct databaseProduct)
{
List<DatabaseProduct> list = databaseProductService.selectDatabaseProductList(databaseProduct);
ExcelUtil<DatabaseProduct> util = new ExcelUtil<DatabaseProduct>(DatabaseProduct.class);
util.exportExcel(response, list, "数据库产品数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('database:zhengyutian:query')")
@GetMapping(value = "/{productId}")
public AjaxResult getInfo(@PathVariable("productId") Long productId)
{
return AjaxResult.success(databaseProductService.selectDatabaseProductByProductId(productId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('database:zhengyutian:add')")
@Log(title = "数据库产品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DatabaseProduct databaseProduct)
{
return toAjax(databaseProductService.insertDatabaseProduct(databaseProduct));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('database:zhengyutian:edit')")
@Log(title = "数据库产品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DatabaseProduct databaseProduct)
{
return toAjax(databaseProductService.updateDatabaseProduct(databaseProduct));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('database:zhengyutian:remove')")
@Log(title = "数据库产品", businessType = BusinessType.DELETE)
@DeleteMapping("/{productIds}")
public AjaxResult remove(@PathVariable Long[] productIds)
{
return toAjax(databaseProductService.deleteDatabaseProductByProductIds(productIds));
}
}

View File

@ -0,0 +1,83 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* database_product
*
* @author ruoyi
* @date 2024-01-20
*/
public class DatabaseProduct extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 产品ID */
private Long productId;
/** 数据库名称 */
@Excel(name = "数据库名称")
private String databaseName;
/** 图标 */
@Excel(name = "图标")
private String icon;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
public void setProductId(Long productId)
{
this.productId = productId;
}
public Long getProductId()
{
return productId;
}
public void setDatabaseName(String databaseName)
{
this.databaseName = databaseName;
}
public String getDatabaseName()
{
return databaseName;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public String getIcon()
{
return icon;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("productId", getProductId())
.append("databaseName", getDatabaseName())
.append("icon", getIcon())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.DatabaseProduct;
/**
* Mapper
*
* @author ruoyi
* @date 2024-01-20
*/
public interface DatabaseProductMapper
{
/**
*
*
* @param productId
* @return
*/
public DatabaseProduct selectDatabaseProductByProductId(Long productId);
/**
*
*
* @param databaseProduct
* @return
*/
public List<DatabaseProduct> selectDatabaseProductList(DatabaseProduct databaseProduct);
/**
*
*
* @param databaseProduct
* @return
*/
public int insertDatabaseProduct(DatabaseProduct databaseProduct);
/**
*
*
* @param databaseProduct
* @return
*/
public int updateDatabaseProduct(DatabaseProduct databaseProduct);
/**
*
*
* @param productId
* @return
*/
public int deleteDatabaseProductByProductId(Long productId);
/**
*
*
* @param productIds
* @return
*/
public int deleteDatabaseProductByProductIds(Long[] productIds);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.DatabaseProduct;
/**
* Service
*
* @author ruoyi
* @date 2024-01-20
*/
public interface IDatabaseProductService
{
/**
*
*
* @param productId
* @return
*/
public DatabaseProduct selectDatabaseProductByProductId(Long productId);
/**
*
*
* @param databaseProduct
* @return
*/
public List<DatabaseProduct> selectDatabaseProductList(DatabaseProduct databaseProduct);
/**
*
*
* @param databaseProduct
* @return
*/
public int insertDatabaseProduct(DatabaseProduct databaseProduct);
/**
*
*
* @param databaseProduct
* @return
*/
public int updateDatabaseProduct(DatabaseProduct databaseProduct);
/**
*
*
* @param productIds
* @return
*/
public int deleteDatabaseProductByProductIds(Long[] productIds);
/**
*
*
* @param productId
* @return
*/
public int deleteDatabaseProductByProductId(Long productId);
}

View File

@ -0,0 +1,94 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DatabaseProductMapper;
import com.ruoyi.system.domain.DatabaseProduct;
import com.ruoyi.system.service.IDatabaseProductService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author ruoyi
* @date 2024-01-20
*/
@Service
public class DatabaseProductServiceImpl implements IDatabaseProductService
{
@Autowired
private DatabaseProductMapper databaseProductMapper;
/**
*
*
* @param productId
* @return
*/
@Override
public DatabaseProduct selectDatabaseProductByProductId(Long productId)
{
return databaseProductMapper.selectDatabaseProductByProductId(productId);
}
/**
*
*
* @param databaseProduct
* @return
*/
@Override
public List<DatabaseProduct> selectDatabaseProductList(DatabaseProduct databaseProduct)
{
return databaseProductMapper.selectDatabaseProductList(databaseProduct);
}
/**
*
*
* @param databaseProduct
* @return
*/
@Override
public int insertDatabaseProduct(DatabaseProduct databaseProduct)
{
return databaseProductMapper.insertDatabaseProduct(databaseProduct);
}
/**
*
*
* @param databaseProduct
* @return
*/
@Override
public int updateDatabaseProduct(DatabaseProduct databaseProduct)
{
return databaseProductMapper.updateDatabaseProduct(databaseProduct);
}
/**
*
*
* @param productIds
* @return
*/
@Override
public int deleteDatabaseProductByProductIds(Long[] productIds)
{
return databaseProductMapper.deleteDatabaseProductByProductIds(productIds);
}
/**
*
*
* @param productId
* @return
*/
@Override
public int deleteDatabaseProductByProductId(Long productId)
{
return databaseProductMapper.deleteDatabaseProductByProductId(productId);
}
}

View File

@ -0,0 +1,86 @@
<?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.system.mapper.DatabaseProductMapper">
<resultMap type="DatabaseProduct" id="DatabaseProductResult">
<id property="productId" column="product_id"/>
<result property="databaseName" column="database_name"/>
<result property="icon" column="icon"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectDatabaseProductVo">
select product_id, database_name, icon, status, create_by, create_time, update_by, update_time, remark from database_product
</sql>
<select id="selectDatabaseProductByProductId" parameterType="Long" resultMap="DatabaseProductResult">
<include refid="selectDatabaseProductVo"/>
where product_id = #{productId}
</select>
<select id="selectDatabaseProductList" parameterType="DatabaseProduct" resultMap="DatabaseProductResult">
<include refid="selectDatabaseProductVo"/>
<where>
<if test="databaseName != null and databaseName != ''">
AND database_name like concat('%', #{databaseName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
</select>
<insert id="insertDatabaseProduct" parameterType="DatabaseProduct" useGeneratedKeys="true" keyProperty="productId">
insert into database_product
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="databaseName != null and databaseName != ''">database_name,</if>
<if test="icon != null and icon != ''">icon,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="databaseName != null and databaseName != ''">#{databaseName},</if>
<if test="icon != null and icon != ''">#{icon},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateDatabaseProduct" parameterType="DatabaseProduct">
update database_product
<set>
<if test="databaseName != null and databaseName != ''">database_name = #{databaseName},</if>
<if test="icon != null and icon != ''">icon = #{icon},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</set>
where product_id = #{productId}
</update>
<delete id="deleteDatabaseProductByProductId" parameterType="Long">
delete from database_product where product_id = #{productId}
</delete>
<delete id="deleteDatabaseProductByProductIds" parameterType="Long[]">
delete from database_product where product_id in
<foreach item="productId" collection="array" open="(" separator="," close=")">
#{productId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询数据库产品列表
export function listProduct(query) {
return request({
url: '/database/product/list',
method: 'get',
params: query
})
}
// 查询数据库产品详细
export function getProduct(productId) {
return request({
url: '/database/product/' + productId,
method: 'get'
})
}
// 新增数据库产品
export function addProduct(data) {
return request({
url: '/database/product',
method: 'post',
data: data
})
}
// 修改数据库产品
export function updateProduct(data) {
return request({
url: '/database/product',
method: 'put',
data: data
})
}
// 删除数据库产品
export function delProduct(productId) {
return request({
url: '/database/product/' + productId,
method: 'delete'
})
}
// 导出数据库产品
export function exportProduct(query) {
return request({
url: '/database/product/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询郑瑜甜列表
export function listZhengyutian(query) {
return request({
url: '/database/product/list',
method: 'get',
params: query
})
}
// 查询郑瑜甜详细
export function getZhengyutian(id) {
return request({
url: '/database/product/' + id,
method: 'get'
})
}
// 新增郑瑜甜
export function addZhengyutian(data) {
return request({
url: '/database/product',
method: 'post',
data: data
})
}
// 修改郑瑜甜
export function updateZhengyutian(data) {
return request({
url: '/database/product',
method: 'put',
data: data
})
}
// 删除郑瑜甜
export function delZhengyutian(id) {
return request({
url: '/database/product/' + id,
method: 'delete'
})
}
// 导出郑瑜甜
export function exportZhengyutian(query) {
return request({
url: '/database/product/export',
method: 'get',
params: query
})
}

View File

@ -107,6 +107,22 @@ export const dynamicRoutes = [
}
]
},
{
path: '/database',
component: Layout,
alwaysShow: true,
permissions: ['database:zhengyutian:list'],
meta: { title: '数据库产品管理', icon: 'database' },
redirect: 'zhengyutian',
children: [
{
path: 'zhengyutian',
component: () => import('@/views/database/product/index'),
name: 'Zhengyutian',
meta: { title: '郑瑜甜', icon: 'user' }
}
]
},
{
path: '/system/user-auth',
component: Layout,

View File

@ -0,0 +1,230 @@
<template>
<div class="app-container">
<div class="head-container">
<el-form :inline="true" :model="queryParams" ref="queryForm" size="small" label-width="68px">
<el-form-item label="数据库名称" prop="databaseName">
<el-input
v-model="queryParams.databaseName"
placeholder="请输入数据库名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="small" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
</div>
<!-- 工具栏 -->
<div class="toolbar">
<el-button type="success" icon="el-icon-plus" size="small" @click="handleAdd" v-hasPermi="['database:zhengyutian:add']"></el-button>
<el-button type="primary" icon="el-icon-edit" size="small" :disabled="single" @click="handleUpdate" v-hasPermi="['database:zhengyutian:edit']"></el-button>
<el-button type="danger" icon="el-icon-delete" size="small" :disabled="multiple" @click="handleDelete" v-hasPermi="['database:zhengyutian:remove']"></el-button>
<el-button type="info" icon="el-icon-download" size="small" @click="handleExport" v-hasPermi="['database:zhengyutian:export']"></el-button>
</div>
<!-- 数据表格 -->
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="产品ID" prop="productId" width="80" align="center" />
<el-table-column label="数据库名称" prop="databaseName" align="center" />
<el-table-column label="图标" prop="icon" align="center" width="80">
<template slot-scope="scope">
<img :src="scope.row.icon" alt="图标" style="width: 24px; height: 24px;" />
</template>
</el-table-column>
<el-table-column label="关系类型" prop="relationType" align="center" />
<el-table-column label="创建时间" prop="createTime" align="center" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改数据库产品对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="数据库名称" prop="databaseName">
<el-input v-model="form.databaseName" placeholder="请输入数据库名称" />
</el-form-item>
<el-form-item label="图标" prop="icon">
<el-input v-model="form.icon" placeholder="请输入图标URL" />
</el-form-item>
<el-form-item label="关系类型" prop="relationType">
<el-input v-model="form.relationType" placeholder="请输入关系类型" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listZhengyutian, getZhengyutian, addZhengyutian, updateZhengyutian, delZhengyutian, exportZhengyutian } from '@/api/database/zhengyutian'
export default {
name: 'Zhengyutian',
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
total: 0,
//
productList: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
databaseName: undefined
},
//
form: {
productId: undefined,
databaseName: undefined,
icon: undefined,
relationType: undefined
},
//
rules: {
databaseName: [
{ required: true, message: '数据库名称不能为空', trigger: 'blur' }
],
icon: [
{ required: true, message: '图标不能为空', trigger: 'blur' }
],
relationType: [
{ required: true, message: '关系类型不能为空', trigger: 'blur' }
]
}
}
},
created() {
this.getList()
},
methods: {
/** 查询郑瑜甜列表 */
getList() {
this.loading = true
listZhengyutian(this.queryParams).then(response => {
this.productList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.productId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加数据库产品'
},
/** 修改按钮操作 */
handleUpdate() {
const productId = this.ids.length === 1 ? this.ids[0] : undefined
if (productId === undefined) {
this.$modal.msgError('请选择一条记录')
return
}
this.reset()
getZhengyutian(productId).then(response => {
this.form = response.data
this.open = true
this.title = '修改郑瑜甜'
})
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.productId != undefined) {
updateZhengyutian(this.form).then(response => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addZhengyutian(this.form).then(response => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 取消按钮 */
cancel() {
this.open = false
this.reset()
},
/** 重置表单 */
reset() {
this.form = {
productId: undefined,
databaseName: undefined,
icon: undefined,
relationType: undefined
}
this.resetForm('form')
},
/** 删除按钮操作 */
handleDelete() {
if (this.ids.length === 0) {
this.$modal.msgError('请选择要删除的数据')
return
}
this.$modal.confirm('确认要删除选中的郑瑜甜吗?').then(function() {
return delZhengyutian(this.ids)
}.bind(this)).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
this.ids = []
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('database/product/export', { ...this.queryParams }, `zhengyutian_${new Date().getTime()}.xlsx`)
}
}
}
</script>

View File

@ -0,0 +1,230 @@
<template>
<div class="app-container">
<div class="head-container">
<el-form :inline="true" :model="queryParams" ref="queryForm" size="small" label-width="68px">
<el-form-item label="数据库名称" prop="databaseName">
<el-input
v-model="queryParams.databaseName"
placeholder="请输入数据库名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="small" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
</div>
<!-- 工具栏 -->
<div class="toolbar">
<el-button type="success" icon="el-icon-plus" size="small" @click="handleAdd" v-hasPermi="['database:nameOne:add']"></el-button>
<el-button type="primary" icon="el-icon-edit" size="small" :disabled="single" @click="handleUpdate" v-hasPermi="['database:nameOne:edit']"></el-button>
<el-button type="danger" icon="el-icon-delete" size="small" :disabled="multiple" @click="handleDelete" v-hasPermi="['database:nameOne:remove']"></el-button>
<el-button type="info" icon="el-icon-download" size="small" @click="handleExport" v-hasPermi="['database:nameOne:export']"></el-button>
</div>
<!-- 数据表格 -->
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="产品ID" prop="productId" width="80" align="center" />
<el-table-column label="数据库名称" prop="databaseName" align="center" />
<el-table-column label="图标" prop="icon" align="center" width="80">
<template slot-scope="scope">
<img :src="scope.row.icon" alt="图标" style="width: 24px; height: 24px;" />
</template>
</el-table-column>
<el-table-column label="关系类型" prop="relationType" align="center" />
<el-table-column label="创建时间" prop="createTime" align="center" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改数据库产品对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="数据库名称" prop="databaseName">
<el-input v-model="form.databaseName" placeholder="请输入数据库名称" />
</el-form-item>
<el-form-item label="图标" prop="icon">
<el-input v-model="form.icon" placeholder="请输入图标URL" />
</el-form-item>
<el-form-item label="关系类型" prop="relationType">
<el-input v-model="form.relationType" placeholder="请输入关系类型" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProduct, getProduct, addProduct, updateProduct, delProduct, exportProduct } from '@/api/database/product'
export default {
name: 'NameOne',
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
total: 0,
//
productList: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
databaseName: undefined
},
//
form: {
productId: undefined,
databaseName: undefined,
icon: undefined,
relationType: undefined
},
//
rules: {
databaseName: [
{ required: true, message: '数据库名称不能为空', trigger: 'blur' }
],
icon: [
{ required: true, message: '图标不能为空', trigger: 'blur' }
],
relationType: [
{ required: true, message: '关系类型不能为空', trigger: 'blur' }
]
}
}
},
created() {
this.getList()
},
methods: {
/** 查询数据库产品列表 */
getList() {
this.loading = true
listProduct(this.queryParams).then(response => {
this.productList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.productId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加数据库产品'
},
/** 修改按钮操作 */
handleUpdate() {
const productId = this.ids.length === 1 ? this.ids[0] : undefined
if (productId === undefined) {
this.$modal.msgError('请选择一条记录')
return
}
this.reset()
getProduct(productId).then(response => {
this.form = response.data
this.open = true
this.title = '修改数据库产品'
})
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.productId != undefined) {
updateProduct(this.form).then(response => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addProduct(this.form).then(response => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 取消按钮 */
cancel() {
this.open = false
this.reset()
},
/** 重置表单 */
reset() {
this.form = {
productId: undefined,
databaseName: undefined,
icon: undefined,
relationType: undefined
}
this.resetForm('form')
},
/** 删除按钮操作 */
handleDelete() {
if (this.ids.length === 0) {
this.$modal.msgError('请选择要删除的数据')
return
}
this.$modal.confirm('确认要删除选中的数据库产品吗?').then(function() {
return delProduct(this.ids)
}.bind(this)).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
this.ids = []
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('database/product/export', { ...this.queryParams }, `database_product_${new Date().getTime()}.xlsx`)
}
}
}
</script>

View File

@ -0,0 +1,230 @@
<template>
<div class="app-container">
<div class="head-container">
<el-form :inline="true" :model="queryParams" ref="queryForm" size="small" label-width="68px">
<el-form-item label="数据库名称" prop="databaseName">
<el-input
v-model="queryParams.databaseName"
placeholder="请输入数据库名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="small" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
</div>
<!-- 工具栏 -->
<div class="toolbar">
<el-button type="success" icon="el-icon-plus" size="small" @click="handleAdd" v-hasPermi="['database:nameTwo:add']"></el-button>
<el-button type="primary" icon="el-icon-edit" size="small" :disabled="single" @click="handleUpdate" v-hasPermi="['database:nameTwo:edit']"></el-button>
<el-button type="danger" icon="el-icon-delete" size="small" :disabled="multiple" @click="handleDelete" v-hasPermi="['database:nameTwo:remove']"></el-button>
<el-button type="info" icon="el-icon-download" size="small" @click="handleExport" v-hasPermi="['database:nameTwo:export']"></el-button>
</div>
<!-- 数据表格 -->
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="产品ID" prop="productId" width="80" align="center" />
<el-table-column label="数据库名称" prop="databaseName" align="center" />
<el-table-column label="图标" prop="icon" align="center" width="80">
<template slot-scope="scope">
<img :src="scope.row.icon" alt="图标" style="width: 24px; height: 24px;" />
</template>
</el-table-column>
<el-table-column label="关系类型" prop="relationType" align="center" />
<el-table-column label="创建时间" prop="createTime" align="center" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改数据库产品对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="数据库名称" prop="databaseName">
<el-input v-model="form.databaseName" placeholder="请输入数据库名称" />
</el-form-item>
<el-form-item label="图标" prop="icon">
<el-input v-model="form.icon" placeholder="请输入图标URL" />
</el-form-item>
<el-form-item label="关系类型" prop="relationType">
<el-input v-model="form.relationType" placeholder="请输入关系类型" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProduct, getProduct, addProduct, updateProduct, delProduct, exportProduct } from '@/api/database/product'
export default {
name: 'NameTwo',
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
total: 0,
//
productList: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
databaseName: undefined
},
//
form: {
productId: undefined,
databaseName: undefined,
icon: undefined,
relationType: undefined
},
//
rules: {
databaseName: [
{ required: true, message: '数据库名称不能为空', trigger: 'blur' }
],
icon: [
{ required: true, message: '图标不能为空', trigger: 'blur' }
],
relationType: [
{ required: true, message: '关系类型不能为空', trigger: 'blur' }
]
}
}
},
created() {
this.getList()
},
methods: {
/** 查询数据库产品列表 */
getList() {
this.loading = true
listProduct(this.queryParams).then(response => {
this.productList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.productId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加数据库产品'
},
/** 修改按钮操作 */
handleUpdate() {
const productId = this.ids.length === 1 ? this.ids[0] : undefined
if (productId === undefined) {
this.$modal.msgError('请选择一条记录')
return
}
this.reset()
getProduct(productId).then(response => {
this.form = response.data
this.open = true
this.title = '修改数据库产品'
})
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.productId != undefined) {
updateProduct(this.form).then(response => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addProduct(this.form).then(response => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 取消按钮 */
cancel() {
this.open = false
this.reset()
},
/** 重置表单 */
reset() {
this.form = {
productId: undefined,
databaseName: undefined,
icon: undefined,
relationType: undefined
}
this.resetForm('form')
},
/** 删除按钮操作 */
handleDelete() {
if (this.ids.length === 0) {
this.$modal.msgError('请选择要删除的数据')
return
}
this.$modal.confirm('确认要删除选中的数据库产品吗?').then(function() {
return delProduct(this.ids)
}.bind(this)).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
this.ids = []
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('database/product/export', { ...this.queryParams }, `database_product_${new Date().getTime()}.xlsx`)
}
}
}
</script>

View File

@ -0,0 +1,27 @@
# 设置数据库产品管理模块的菜单配置
Write-Host "正在设置数据库产品管理模块的菜单配置..." -ForegroundColor Green
# 提示用户输入MySQL密码
$password = Read-Host "请输入MySQL root用户密码" -AsSecureString
$passwordPlain = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
# 执行SQL脚本
Write-Host "1. 创建数据库产品表..." -ForegroundColor Yellow
$process = Start-Process -FilePath "mysql" -ArgumentList "-u root -p$passwordPlain -e `"source sql/database_product.sql`"" -Wait -PassThru -NoNewWindow
if ($process.ExitCode -eq 0) {
Write-Host "数据库产品表创建成功!" -ForegroundColor Green
} else {
Write-Host "数据库产品表创建失败!" -ForegroundColor Red
}
Write-Host "2. 创建菜单和权限配置..." -ForegroundColor Yellow
$process = Start-Process -FilePath "mysql" -ArgumentList "-u root -p$passwordPlain -e `"source sql/create_database_menu.sql`"" -Wait -PassThru -NoNewWindow
if ($process.ExitCode -eq 0) {
Write-Host "菜单和权限配置创建成功!" -ForegroundColor Green
} else {
Write-Host "菜单和权限配置创建失败!" -ForegroundColor Red
}
Write-Host "设置完成!" -ForegroundColor Green
Write-Host "请重启后端服务并刷新前端页面以查看更改。" -ForegroundColor Yellow
Read-Host "按任意键退出"

View File

@ -0,0 +1,27 @@
# 设置数据库产品管理模块的菜单配置
Write-Host "正在设置数据库产品管理模块的菜单配置..." -ForegroundColor Green
# 提示用户输入MySQL密码
$password = Read-Host "请输入MySQL root用户密码" -AsSecureString
$passwordPlain = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
# 执行SQL脚本
Write-Host "1. 创建数据库产品表..." -ForegroundColor Yellow
$process = Start-Process -FilePath "mysql" -ArgumentList "-u root -p$passwordPlain", "-e", "source sql/database_product.sql" -Wait -PassThru -NoNewWindow
if ($process.ExitCode -eq 0) {
Write-Host "数据库产品表创建成功!" -ForegroundColor Green
} else {
Write-Host "数据库产品表创建失败!" -ForegroundColor Red
}
Write-Host "2. 创建菜单和权限配置..." -ForegroundColor Yellow
$process = Start-Process -FilePath "mysql" -ArgumentList "-u root -p$passwordPlain", "-e", "source sql/create_database_menu.sql" -Wait -PassThru -NoNewWindow
if ($process.ExitCode -eq 0) {
Write-Host "菜单和权限配置创建成功!" -ForegroundColor Green
} else {
Write-Host "菜单和权限配置创建失败!" -ForegroundColor Red
}
Write-Host "设置完成!" -ForegroundColor Green
Write-Host "请重启后端服务并刷新前端页面以查看更改。" -ForegroundColor Yellow
Read-Host "按任意键退出"

View File

@ -0,0 +1,13 @@
@echo off
echo 正在设置数据库产品管理模块...
echo.
echo 1. 创建数据库产品表...
mysql -u root -p -e "source sql/database_product.sql"
echo.
echo 2. 创建菜单和权限配置...
mysql -u root -p -e "source sql/create_database_menu.sql"
echo.
echo 设置完成!
echo.
echo 请重启后端服务并刷新前端页面以查看更改。
pause

View File

@ -0,0 +1,30 @@
-- 删除旧的数据库产品管理菜单(如果存在)
DELETE FROM `sys_role_menu` WHERE menu_id IN (SELECT menu_id FROM sys_menu WHERE menu_name = '数据库产品管理' OR perms LIKE 'database:%');
DELETE FROM `sys_menu` WHERE menu_name = '数据库产品管理' OR perms LIKE 'database:%';
-- 插入数据库产品管理菜单(顶级菜单)
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 ('数据库产品管理', 0, 6, 'database', '', 1, 0, 'M', '0', '0', '', 'database', 'admin', NOW(), 'admin', NOW(), '数据库产品管理菜单');
-- 获取刚插入的数据库产品管理菜单ID
SET @parentId = (SELECT MAX(menu_id) FROM sys_menu WHERE menu_name = '数据库产品管理');
-- 插入郑瑜甜子菜单
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 ('郑瑜甜', @parentId, 1, 'zhengyutian', 'database/product/index', 1, 0, 'C', '0', '0', 'database:zhengyutian:list', 'user', 'admin', NOW(), 'admin', NOW(), '郑瑜甜菜单');
-- 获取刚插入的郑瑜甜菜单ID
SET @childId = (SELECT MAX(menu_id) FROM sys_menu WHERE menu_name = '郑瑜甜');
-- 插入郑瑜甜菜单的按钮权限
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
('新增', @childId, 1, '', '', 0, 0, 'F', '0', '0', 'database:zhengyutian:add', '#', 'admin', NOW(), 'admin', NOW(), '新增按钮'),
('修改', @childId, 2, '', '', 0, 0, 'F', '0', '0', 'database:zhengyutian:edit', '#', 'admin', NOW(), 'admin', NOW(), '修改按钮'),
('删除', @childId, 3, '', '', 0, 0, 'F', '0', '0', 'database:zhengyutian:remove', '#', 'admin', NOW(), 'admin', NOW(), '删除按钮'),
('导出', @childId, 4, '', '', 0, 0, 'F', '0', '0', 'database:zhengyutian:export', '#', 'admin', NOW(), 'admin', NOW(), '导出按钮'),
('查询', @childId, 5, '', '', 0, 0, 'F', '0', '0', 'database:zhengyutian:query', '#', 'admin', NOW(), 'admin', NOW(), '查询按钮');
-- 将权限分配给管理员角色
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT 1, menu_id FROM sys_menu WHERE perms LIKE 'database:%';

View File

@ -0,0 +1,19 @@
-- 创建数据库产品表
CREATE TABLE `database_product` (
`product_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '产品ID',
`database_name` varchar(100) NOT NULL COMMENT '数据库名称',
`icon` varchar(255) DEFAULT NULL COMMENT '图标',
`status` char(1) DEFAULT '0' COMMENT '状态0正常 1停用',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`product_id`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8mb4 COMMENT='数据库产品表';
-- 插入示例数据
INSERT INTO `database_product` VALUES (100, 'mysql', 'https://img.alicdn.com/imgextra/i2/O1CN01QH6qH01uV45a4y8sH_!!6000000006375-2-tps-200-200.png', '0', 'admin', '2024-01-20 10:00:00', 'admin', '2024-01-20 10:00:00', 'MySQL数据库');
INSERT INTO `database_product` VALUES (101, 'oracle', 'https://img.alicdn.com/imgextra/i4/O1CN01Jj1p9J1pU9d0XJ0eI_!!6000000005464-2-tps-200-200.png', '0', 'admin', '2024-01-20 10:00:00', 'admin', '2024-01-20 10:00:00', 'Oracle数据库');
INSERT INTO `database_product` VALUES (102, 'sqlserver', 'https://img.alicdn.com/imgextra/i1/O1CN012U2N5t1q0oE8kMl65_!!6000000005171-2-tps-200-200.png', '0', 'admin', '2024-01-20 10:00:00', 'admin', '2024-01-20 10:00:00', 'SQL Server数据库');

View File

@ -0,0 +1,24 @@
-- 插入数据库产品管理子菜单
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 ('数据库产品列表', (SELECT MAX(menu_id) FROM sys_menu WHERE menu_name = '数据库产品管理'), 1, 'product', 'database/product/index', 1, 0, 'C', '0', '0', 'database:product:list', 'database', 'admin', NOW(), 'admin', NOW(), '数据库产品列表菜单');
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 ('姓名一', (SELECT MAX(menu_id) FROM sys_menu WHERE menu_name = '数据库产品管理'), 2, 'nameOne', 'database/product/nameOne', 1, 0, 'C', '0', '0', 'database:nameOne:list', '#', 'admin', NOW(), 'admin', NOW(), '姓名一菜单');
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 ('姓名二', (SELECT MAX(menu_id) FROM sys_menu WHERE menu_name = '数据库产品管理'), 3, 'nameTwo', 'database/product/nameTwo', 1, 0, 'C', '0', '0', 'database:nameTwo:list', '#', 'admin', NOW(), 'admin', NOW(), '姓名二菜单');
-- 插入数据库产品管理按钮权限
SET @parentId = (SELECT MAX(menu_id) FROM sys_menu WHERE menu_name = '数据库产品管理');
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, '', `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES
('新增', @parentId, 1, '', '', 0, 0, 'F', '0', '0', 'database:product:add', '#', 'admin', NOW(), 'admin', NOW(), '新增按钮'),
('修改', @parentId, 2, '', '', 0, 0, 'F', '0', '0', 'database:product:edit', '#', 'admin', NOW(), 'admin', NOW(), '修改按钮'),
('删除', @parentId, 3, '', '', 0, 0, 'F', '0', '0', 'database:product:remove', '#', 'admin', NOW(), 'admin', NOW(), '删除按钮'),
('导出', @parentId, 4, '', '', 0, 0, 'F', '0', '0', 'database:product:export', '#', 'admin', NOW(), 'admin', NOW(), '导出按钮'),
('查询', @parentId, 5, '', '', 0, 0, 'F', '0', '0', 'database:product:query', '#', 'admin', NOW(), 'admin', NOW(), '查询按钮');
-- 将权限分配给管理员角色
SET @roleId = (SELECT role_id FROM sys_role WHERE role_name = '超级管理员');
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT @roleId, menu_id FROM sys_menu WHERE perms LIKE 'database:%';

View File

@ -0,0 +1,29 @@
-- 插入数据库产品管理菜单(顶级菜单)
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 ('数据库产品管理', 0, 6, 'database', '', 1, 0, 'M', '0', '0', '', 'database', 'admin', NOW(), 'admin', NOW(), '数据库产品管理菜单');
-- 获取刚插入的数据库产品管理菜单ID
SET @parentId = (SELECT MAX(menu_id) FROM sys_menu WHERE menu_name = '数据库产品管理');
-- 插入数据库产品管理子菜单
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 ('数据库产品列表', @parentId, 1, 'product', 'database/product/index', 1, 0, 'C', '0', '0', 'database:product:list', 'database', 'admin', NOW(), 'admin', NOW(), '数据库产品列表菜单');
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 ('姓名一', @parentId, 2, 'nameOne', 'database/product/nameOne', 1, 0, 'C', '0', '0', 'database:nameOne:list', '#', 'admin', NOW(), 'admin', NOW(), '姓名一菜单');
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 ('姓名二', @parentId, 3, 'nameTwo', 'database/product/nameTwo', 1, 0, 'C', '0', '0', 'database:nameTwo:list', '#', 'admin', NOW(), 'admin', NOW(), '姓名二菜单');
-- 插入数据库产品管理按钮权限
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
('新增', @parentId, 4, '', '', 0, 0, 'F', '0', '0', 'database:product:add', '#', 'admin', NOW(), 'admin', NOW(), '新增按钮'),
('修改', @parentId, 5, '', '', 0, 0, 'F', '0', '0', 'database:product:edit', '#', 'admin', NOW(), 'admin', NOW(), '修改按钮'),
('删除', @parentId, 6, '', '', 0, 0, 'F', '0', '0', 'database:product:remove', '#', 'admin', NOW(), 'admin', NOW(), '删除按钮'),
('导出', @parentId, 7, '', '', 0, 0, 'F', '0', '0', 'database:product:export', '#', 'admin', NOW(), 'admin', NOW(), '导出按钮'),
('查询', @parentId, 8, '', '', 0, 0, 'F', '0', '0', 'database:product:query', '#', 'admin', NOW(), 'admin', NOW(), '查询按钮');
-- 将权限分配给管理员角色
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT 1, menu_id FROM sys_menu WHERE perms LIKE 'database:%';

View File

@ -0,0 +1,29 @@
-- 删除旧的菜单项
DELETE FROM sys_menu WHERE menu_name LIKE '%数据库产品%';
-- 插入顶级菜单"数据库产品管理"
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 ('数据库产品管理', 0, 1, 'database', NULL, '', 1, 0, 'M', '0', '0', '', 'database', 'admin', NOW(), '', NULL, '数据库产品管理目录');
-- 获取刚插入的顶级菜单ID
SET @parent_id = LAST_INSERT_ID();
-- 插入子菜单"郑瑜甜"
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 ('郑瑜甜', @parent_id, 1, 'zhengyutian', 'database/product/index', '', 1, 0, 'C', '0', '0', 'database:zhengyutian:list', 'form', 'admin', NOW(), '', NULL, '郑瑜甜菜单');
-- 获取刚插入的子菜单ID
SET @child_id = LAST_INSERT_ID();
-- 插入按钮权限
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
('郑瑜甜查询', @child_id, 1, '#', '', '', 1, 0, 'F', '0', '0', 'database:zhengyutian:query', '#', 'admin', NOW(), '', NULL, ''),
('郑瑜甜新增', @child_id, 2, '#', '', '', 1, 0, 'F', '0', '0', 'database:zhengyutian:add', '#', 'admin', NOW(), '', NULL, ''),
('郑瑜甜修改', @child_id, 3, '#', '', '', 1, 0, 'F', '0', '0', 'database:zhengyutian:edit', '#', 'admin', NOW(), '', NULL, ''),
('郑瑜甜删除', @child_id, 4, '#', '', '', 1, 0, 'F', '0', '0', 'database:zhengyutian:remove', '#', 'admin', NOW(), '', NULL, ''),
('郑瑜甜导出', @child_id, 5, '#', '', '', 1, 0, 'F', '0', '0', 'database:zhengyutian:export', '#', 'admin', NOW(), '', NULL, '');
-- 将权限分配给管理员角色
INSERT INTO sys_role_menu (role_id, menu_id)
SELECT 1, menu_id FROM sys_menu WHERE menu_name LIKE '%郑瑜甜%' OR menu_name = '数据库产品管理';