调整数据库表的单复数

This commit is contained in:
2026-02-19 10:39:38 +08:00
parent 736a41a718
commit d310a29c03
56 changed files with 45577 additions and 506 deletions

View File

@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
// 管理员表
Schema::create('auth_users', function (Blueprint $table) {
Schema::create('auth_user', function (Blueprint $table) {
$table->id();
$table->string('username', 50)->unique()->comment('用户名');
$table->string('password')->comment('密码');
@@ -32,7 +32,7 @@ return new class extends Migration
});
// 部门表
Schema::create('auth_departments', function (Blueprint $table) {
Schema::create('auth_department', function (Blueprint $table) {
$table->id();
$table->string('name', 100)->comment('部门名称');
$table->unsignedBigInteger('parent_id')->default(0)->comment('父部门ID');
@@ -48,7 +48,7 @@ return new class extends Migration
});
// 角色表
Schema::create('auth_roles', function (Blueprint $table) {
Schema::create('auth_role', function (Blueprint $table) {
$table->id();
$table->string('name', 50)->unique()->comment('角色名称');
$table->string('code', 50)->unique()->comment('角色编码');
@@ -62,7 +62,7 @@ return new class extends Migration
});
// 权限表
Schema::create('auth_permissions', function (Blueprint $table) {
Schema::create('auth_permission', function (Blueprint $table) {
$table->id();
$table->string('title', 100)->comment('权限标题');
$table->string('name', 100)->unique()->comment('权限编码');
@@ -114,9 +114,9 @@ return new class extends Migration
{
Schema::dropIfExists('auth_role_permission');
Schema::dropIfExists('auth_user_role');
Schema::dropIfExists('auth_permissions');
Schema::dropIfExists('auth_roles');
Schema::dropIfExists('auth_departments');
Schema::dropIfExists('auth_users');
Schema::dropIfExists('auth_permission');
Schema::dropIfExists('auth_role');
Schema::dropIfExists('auth_department');
Schema::dropIfExists('auth_user');
}
};

View File

@@ -9,7 +9,7 @@ return new class extends Migration
public function up()
{
// 系统配置表
Schema::create('system_configs', function (Blueprint $table) {
Schema::create('system_setting', function (Blueprint $table) {
$table->comment('系统配置表');
$table->id();
$table->string('group')->comment('配置分组');
@@ -32,7 +32,7 @@ return new class extends Migration
});
// 系统日志表
Schema::create('system_logs', function (Blueprint $table) {
Schema::create('system_log', function (Blueprint $table) {
$table->comment('系统日志表');
$table->id();
$table->unsignedBigInteger('user_id')->nullable()->comment('用户ID');
@@ -58,7 +58,7 @@ return new class extends Migration
});
// 系统字典表
Schema::create('system_dictionaries', function (Blueprint $table) {
Schema::create('system_dictionary', function (Blueprint $table) {
$table->comment('系统字典表');
$table->id();
$table->string('name')->comment('字典名称');
@@ -72,7 +72,7 @@ return new class extends Migration
});
// 系统字典项表
Schema::create('system_dictionary_items', function (Blueprint $table) {
Schema::create('system_dictionary_item', function (Blueprint $table) {
$table->comment('系统字典项表');
$table->id();
$table->unsignedBigInteger('dictionary_id')->comment('字典ID');
@@ -85,12 +85,12 @@ return new class extends Migration
$table->integer('sort')->default(0)->comment('排序');
$table->timestamps();
$table->foreign('dictionary_id')->references('id')->on('system_dictionaries')->onDelete('cascade');
$table->foreign('dictionary_id')->references('id')->on('system_dictionary')->onDelete('cascade');
$table->index('dictionary_id');
});
// 系统任务表
Schema::create('system_tasks', function (Blueprint $table) {
Schema::create('system_task', function (Blueprint $table) {
$table->comment('系统任务表');
$table->id();
$table->string('name')->comment('任务名称');
@@ -115,32 +115,54 @@ return new class extends Migration
});
// 系统城市表
Schema::create('system_cities', function (Blueprint $table) {
Schema::create('system_city', function (Blueprint $table) {
$table->comment('系统城市表');
$table->id();
$table->unsignedBigInteger('parent_id')->default(0)->comment('父级ID');
$table->string('name')->comment('城市名称');
$table->string('title')->comment('城市名称');
$table->string('code')->unique()->comment('城市编码');
$table->string('pinyin')->nullable()->comment('拼音');
$table->string('pinyin_short')->nullable()->comment('拼音首字母');
$table->integer('level')->default(1)->comment('级别1=省2=市3=区/县');
$table->integer('sort')->default(0)->comment('排序');
$table->boolean('status')->default(true)->comment('状态');
$table->string('parent_code')->nullable()->comment('父级编码');
$table->timestamps();
$table->index('parent_id');
$table->index('code');
$table->index('level');
$table->index('parent_code');
});
// 系统通知表
Schema::create('system_notification', function (Blueprint $table) {
$table->comment('系统通知表');
$table->id();
$table->unsignedBigInteger('user_id')->comment('用户ID');
$table->string('title')->comment('通知标题');
$table->text('content')->comment('通知内容');
$table->string('type')->default('info')->comment('通知类型info, success, warning, error, task, system');
$table->string('category')->nullable()->comment('通知分类system, task, message, reminder, announcement');
$table->json('data')->nullable()->comment('附加数据(JSON格式)');
$table->string('action_type')->nullable()->comment('操作类型link, modal, none');
$table->text('action_data')->nullable()->comment('操作数据');
$table->boolean('is_read')->default(false)->comment('是否已读');
$table->timestamp('read_at')->nullable()->comment('阅读时间');
$table->boolean('sent_via_websocket')->default(false)->comment('是否已通过WebSocket发送');
$table->timestamp('sent_at')->nullable()->comment('发送时间');
$table->integer('retry_count')->default(0)->comment('重试次数');
$table->timestamps();
$table->softDeletes();
$table->index('user_id');
$table->index('is_read');
$table->index('type');
$table->index('category');
$table->index('created_at');
});
}
public function down()
{
Schema::dropIfExists('system_dictionary_items');
Schema::dropIfExists('system_dictionaries');
Schema::dropIfExists('system_configs');
Schema::dropIfExists('system_logs');
Schema::dropIfExists('system_tasks');
Schema::dropIfExists('system_cities');
Schema::dropIfExists('system_notification');
Schema::dropIfExists('system_dictionary_item');
Schema::dropIfExists('system_dictionary');
Schema::dropIfExists('system_setting');
Schema::dropIfExists('system_log');
Schema::dropIfExists('system_task');
Schema::dropIfExists('system_city');
}
};

View File

@@ -1,43 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
// 系统通知表
Schema::create('system_notifications', function (Blueprint $table) {
$table->comment('系统通知表');
$table->id();
$table->unsignedBigInteger('user_id')->comment('用户ID');
$table->string('title')->comment('通知标题');
$table->text('content')->comment('通知内容');
$table->string('type')->default('info')->comment('通知类型info, success, warning, error, task, system');
$table->string('category')->nullable()->comment('通知分类system, task, message, reminder, announcement');
$table->json('data')->nullable()->comment('附加数据(JSON格式)');
$table->string('action_type')->nullable()->comment('操作类型link, modal, none');
$table->text('action_data')->nullable()->comment('操作数据');
$table->boolean('is_read')->default(false)->comment('是否已读');
$table->timestamp('read_at')->nullable()->comment('阅读时间');
$table->boolean('sent_via_websocket')->default(false)->comment('是否已通过WebSocket发送');
$table->timestamp('sent_at')->nullable()->comment('发送时间');
$table->integer('retry_count')->default(0)->comment('重试次数');
$table->timestamps();
$table->softDeletes();
$table->index('user_id');
$table->index('is_read');
$table->index('type');
$table->index('category');
$table->index('created_at');
});
}
public function down()
{
Schema::dropIfExists('system_notifications');
}
};

View File

@@ -161,8 +161,8 @@ class AuthSeeder extends Seeder
'name' => 'auth.users',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为权限菜单的ID
'path' => '/auth/users',
'component' => 'auth/users/index',
'path' => '/auth/user',
'component' => 'auth/user/index',
'meta' => json_encode([
'icon' => 'UserOutlined',
'hidden' => false,
@@ -176,7 +176,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.users.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为用户管理菜单的ID
'path' => 'admin.users.index',
'path' => 'admin.user.index',
'component' => null,
'meta' => null,
'sort' => 1,
@@ -187,7 +187,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.users.create',
'type' => 'button',
'parent_id' => 0, // 稍后更新为用户管理菜单的ID
'path' => 'admin.users.store',
'path' => 'admin.user.store',
'component' => null,
'meta' => null,
'sort' => 2,
@@ -198,7 +198,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.users.update',
'type' => 'button',
'parent_id' => 0, // 稍后更新为用户管理菜单的ID
'path' => 'admin.users.update',
'path' => 'admin.user.update',
'component' => null,
'meta' => null,
'sort' => 3,
@@ -209,7 +209,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.users.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为用户管理菜单的ID
'path' => 'admin.users.destroy',
'path' => 'admin.user.destroy',
'component' => null,
'meta' => null,
'sort' => 4,
@@ -220,7 +220,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.users.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为用户管理菜单的ID
'path' => 'admin.users.batch-delete',
'path' => 'admin.user.batch-delete',
'component' => null,
'meta' => null,
'sort' => 5,
@@ -231,7 +231,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.users.export',
'type' => 'button',
'parent_id' => 0, // 稍后更新为用户管理菜单的ID
'path' => 'admin.users.export',
'path' => 'admin.user.export',
'component' => null,
'meta' => null,
'sort' => 6,
@@ -242,7 +242,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.users.import',
'type' => 'button',
'parent_id' => 0, // 稍后更新为用户管理菜单的ID
'path' => 'admin.users.import',
'path' => 'admin.user.import',
'component' => null,
'meta' => null,
'sort' => 7,
@@ -254,8 +254,8 @@ class AuthSeeder extends Seeder
'name' => 'auth.roles',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为权限菜单的ID
'path' => '/auth/roles',
'component' => 'auth/roles/index',
'path' => '/auth/role',
'component' => 'auth/role/index',
'meta' => json_encode([
'icon' => 'UserFilled',
'hidden' => false,
@@ -269,7 +269,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.roles.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为角色管理菜单的ID
'path' => 'admin.roles.index',
'path' => 'admin.role.index',
'component' => null,
'meta' => null,
'sort' => 1,
@@ -280,7 +280,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.roles.create',
'type' => 'button',
'parent_id' => 0, // 稍后更新为角色管理菜单的ID
'path' => 'admin.roles.store',
'path' => 'admin.role.store',
'component' => null,
'meta' => null,
'sort' => 2,
@@ -291,7 +291,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.roles.update',
'type' => 'button',
'parent_id' => 0, // 稍后更新为角色管理菜单的ID
'path' => 'admin.roles.update',
'path' => 'admin.role.update',
'component' => null,
'meta' => null,
'sort' => 3,
@@ -302,7 +302,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.roles.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为角色管理菜单的ID
'path' => 'admin.roles.destroy',
'path' => 'admin.role.destroy',
'component' => null,
'meta' => null,
'sort' => 4,
@@ -313,7 +313,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.roles.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为角色管理菜单的ID
'path' => 'admin.roles.batch-delete',
'path' => 'admin.role.batch-delete',
'component' => null,
'meta' => null,
'sort' => 5,
@@ -324,7 +324,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.roles.assign-permissions',
'type' => 'button',
'parent_id' => 0, // 稍后更新为角色管理菜单的ID
'path' => 'admin.roles.assign-permissions',
'path' => 'admin.role.assign-permissions',
'component' => null,
'meta' => null,
'sort' => 6,
@@ -336,8 +336,8 @@ class AuthSeeder extends Seeder
'name' => 'auth.permissions',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为权限菜单的ID
'path' => '/auth/permissions',
'component' => 'auth/permissions/index',
'path' => '/auth/permission',
'component' => 'auth/permission/index',
'meta' => json_encode([
'icon' => 'Lock',
'hidden' => false,
@@ -351,7 +351,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.permissions.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为权限管理菜单的ID
'path' => 'admin.permissions.index',
'path' => 'admin.permission.index',
'component' => null,
'meta' => null,
'sort' => 1,
@@ -362,7 +362,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.permissions.create',
'type' => 'button',
'parent_id' => 0, // 稍后更新为权限管理菜单的ID
'path' => 'admin.permissions.store',
'path' => 'admin.permission.store',
'component' => null,
'meta' => null,
'sort' => 2,
@@ -373,7 +373,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.permissions.update',
'type' => 'button',
'parent_id' => 0, // 稍后更新为权限管理菜单的ID
'path' => 'admin.permissions.update',
'path' => 'admin.permission.update',
'component' => null,
'meta' => null,
'sort' => 3,
@@ -384,7 +384,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.permissions.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为权限管理菜单的ID
'path' => 'admin.permissions.destroy',
'path' => 'admin.permission.destroy',
'component' => null,
'meta' => null,
'sort' => 4,
@@ -395,7 +395,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.permissions.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为权限管理菜单的ID
'path' => 'admin.permissions.batch-delete',
'path' => 'admin.permission.batch-delete',
'component' => null,
'meta' => null,
'sort' => 5,
@@ -407,8 +407,8 @@ class AuthSeeder extends Seeder
'name' => 'auth.departments',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为权限菜单的ID
'path' => '/auth/departments',
'component' => 'auth/departments/index',
'path' => '/auth/department',
'component' => 'auth/department/index',
'meta' => json_encode([
'icon' => 'OfficeBuilding',
'hidden' => false,
@@ -422,7 +422,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.departments.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为部门管理菜单的ID
'path' => 'admin.departments.index',
'path' => 'admin.department.index',
'component' => null,
'meta' => null,
'sort' => 1,
@@ -433,7 +433,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.departments.create',
'type' => 'button',
'parent_id' => 0, // 稍后更新为部门管理菜单的ID
'path' => 'admin.departments.store',
'path' => 'admin.department.store',
'component' => null,
'meta' => null,
'sort' => 2,
@@ -444,7 +444,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.departments.update',
'type' => 'button',
'parent_id' => 0, // 稍后更新为部门管理菜单的ID
'path' => 'admin.departments.update',
'path' => 'admin.department.update',
'component' => null,
'meta' => null,
'sort' => 3,
@@ -455,7 +455,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.departments.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为部门管理菜单的ID
'path' => 'admin.departments.destroy',
'path' => 'admin.department.destroy',
'component' => null,
'meta' => null,
'sort' => 4,
@@ -466,7 +466,7 @@ class AuthSeeder extends Seeder
'name' => 'auth.departments.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为部门管理菜单的ID
'path' => 'admin.departments.batch-delete',
'path' => 'admin.department.batch-delete',
'component' => null,
'meta' => null,
'sort' => 5,

View File

@@ -67,11 +67,11 @@ class SystemSeeder extends Seeder
// 系统配置
[
'title' => '系统配置',
'name' => 'system.config',
'name' => 'system.setting',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为系统菜单的ID
'path' => '/system/config',
'component' => 'system/config/index',
'path' => '/system/setting',
'component' => 'system/setting/index',
'meta' => json_encode([
'icon' => 'SettingFilled',
'hidden' => false,
@@ -82,10 +82,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '查看配置',
'name' => 'system.config.view',
'name' => 'system.setting.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统配置菜单的ID
'path' => 'admin.config.index',
'path' => 'admin.setting.index',
'component' => null,
'meta' => null,
'sort' => 1,
@@ -93,10 +93,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '创建配置',
'name' => 'system.config.create',
'name' => 'system.setting.create',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统配置菜单的ID
'path' => 'admin.config.store',
'path' => 'admin.setting.store',
'component' => null,
'meta' => null,
'sort' => 2,
@@ -104,10 +104,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '编辑配置',
'name' => 'system.config.update',
'name' => 'system.setting.update',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统配置菜单的ID
'path' => 'admin.config.update',
'path' => 'admin.setting.update',
'component' => null,
'meta' => null,
'sort' => 3,
@@ -115,10 +115,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '删除配置',
'name' => 'system.config.delete',
'name' => 'system.setting.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统配置菜单的ID
'path' => 'admin.config.destroy',
'path' => 'admin.setting.destroy',
'component' => null,
'meta' => null,
'sort' => 4,
@@ -126,10 +126,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '批量删除配置',
'name' => 'system.config.batch-delete',
'name' => 'system.setting.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统配置菜单的ID
'path' => 'admin.config.batch-delete',
'path' => 'admin.setting.batch-delete',
'component' => null,
'meta' => null,
'sort' => 5,
@@ -139,11 +139,11 @@ class SystemSeeder extends Seeder
// 系统日志
[
'title' => '系统日志',
'name' => 'system.logs',
'name' => 'system.log',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为系统菜单的ID
'path' => '/system/logs',
'component' => 'system/logs/index',
'path' => '/system/log',
'component' => 'system/log/index',
'meta' => json_encode([
'icon' => 'DocumentCopy',
'hidden' => false,
@@ -154,10 +154,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '查看日志',
'name' => 'system.logs.view',
'name' => 'system.log.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统日志菜单的ID
'path' => 'admin.logs.index',
'path' => 'admin.log.index',
'component' => null,
'meta' => null,
'sort' => 1,
@@ -165,10 +165,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '删除日志',
'name' => 'system.logs.delete',
'name' => 'system.log.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统日志菜单的ID
'path' => 'admin.logs.destroy',
'path' => 'admin.log.destroy',
'component' => null,
'meta' => null,
'sort' => 2,
@@ -176,10 +176,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '批量删除日志',
'name' => 'system.logs.batch-delete',
'name' => 'system.log.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统日志菜单的ID
'path' => 'admin.logs.batch-delete',
'path' => 'admin.log.batch-delete',
'component' => null,
'meta' => null,
'sort' => 3,
@@ -187,10 +187,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '导出日志',
'name' => 'system.logs.export',
'name' => 'system.log.export',
'type' => 'button',
'parent_id' => 0, // 稍后更新为系统日志菜单的ID
'path' => 'admin.logs.export',
'path' => 'admin.log.export',
'component' => null,
'meta' => null,
'sort' => 4,
@@ -200,11 +200,11 @@ class SystemSeeder extends Seeder
// 数据字典
[
'title' => '数据字典',
'name' => 'system.dictionaries',
'name' => 'system.dictionary',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为系统菜单的ID
'path' => '/system/dictionaries',
'component' => 'system/dictionaries/index',
'path' => '/system/dictionary',
'component' => 'system/dictionary/index',
'meta' => json_encode([
'icon' => 'Notebook',
'hidden' => false,
@@ -215,10 +215,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '查看字典',
'name' => 'system.dictionaries.view',
'name' => 'system.dictionary.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为数据字典菜单的ID
'path' => 'admin.dictionaries.index',
'path' => 'admin.dictionary.index',
'component' => null,
'meta' => null,
'sort' => 1,
@@ -226,10 +226,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '创建字典',
'name' => 'system.dictionaries.create',
'name' => 'system.dictionary.create',
'type' => 'button',
'parent_id' => 0, // 稍后更新为数据字典菜单的ID
'path' => 'admin.dictionaries.store',
'path' => 'admin.dictionary.store',
'component' => null,
'meta' => null,
'sort' => 2,
@@ -237,10 +237,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '编辑字典',
'name' => 'system.dictionaries.update',
'name' => 'system.dictionary.update',
'type' => 'button',
'parent_id' => 0, // 稍后更新为数据字典菜单的ID
'path' => 'admin.dictionaries.update',
'path' => 'admin.dictionary.update',
'component' => null,
'meta' => null,
'sort' => 3,
@@ -248,10 +248,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '删除字典',
'name' => 'system.dictionaries.delete',
'name' => 'system.dictionary.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为数据字典菜单的ID
'path' => 'admin.dictionaries.destroy',
'path' => 'admin.dictionary.destroy',
'component' => null,
'meta' => null,
'sort' => 4,
@@ -259,10 +259,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '批量删除字典',
'name' => 'system.dictionaries.batch-delete',
'name' => 'system.dictionary.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为数据字典菜单的ID
'path' => 'admin.dictionaries.batch-delete',
'path' => 'admin.dictionary.batch-delete',
'component' => null,
'meta' => null,
'sort' => 5,
@@ -272,11 +272,11 @@ class SystemSeeder extends Seeder
// 定时任务
[
'title' => '定时任务',
'name' => 'system.tasks',
'name' => 'system.task',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为系统菜单的ID
'path' => '/system/tasks',
'component' => 'system/tasks/index',
'path' => '/system/task',
'component' => 'system/task/index',
'meta' => json_encode([
'icon' => 'Timer',
'hidden' => false,
@@ -287,10 +287,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '查看任务',
'name' => 'system.tasks.view',
'name' => 'system.task.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为定时任务菜单的ID
'path' => 'admin.tasks.index',
'path' => 'admin.task.index',
'component' => null,
'meta' => null,
'sort' => 1,
@@ -298,10 +298,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '创建任务',
'name' => 'system.tasks.create',
'name' => 'system.task.create',
'type' => 'button',
'parent_id' => 0, // 稍后更新为定时任务菜单的ID
'path' => 'admin.tasks.store',
'path' => 'admin.task.store',
'component' => null,
'meta' => null,
'sort' => 2,
@@ -309,10 +309,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '编辑任务',
'name' => 'system.tasks.update',
'name' => 'system.task.update',
'type' => 'button',
'parent_id' => 0, // 稍后更新为定时任务菜单的ID
'path' => 'admin.tasks.update',
'path' => 'admin.task.update',
'component' => null,
'meta' => null,
'sort' => 3,
@@ -320,10 +320,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '删除任务',
'name' => 'system.tasks.delete',
'name' => 'system.task.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为定时任务菜单的ID
'path' => 'admin.tasks.destroy',
'path' => 'admin.task.destroy',
'component' => null,
'meta' => null,
'sort' => 4,
@@ -331,10 +331,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '批量删除任务',
'name' => 'system.tasks.batch-delete',
'name' => 'system.task.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为定时任务菜单的ID
'path' => 'admin.tasks.batch-delete',
'path' => 'admin.task.batch-delete',
'component' => null,
'meta' => null,
'sort' => 5,
@@ -342,10 +342,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '执行任务',
'name' => 'system.tasks.execute',
'name' => 'system.task.execute',
'type' => 'button',
'parent_id' => 0, // 稍后更新为定时任务菜单的ID
'path' => 'admin.tasks.execute',
'path' => 'admin.task.execute',
'component' => null,
'meta' => null,
'sort' => 6,
@@ -353,10 +353,10 @@ class SystemSeeder extends Seeder
],
[
'title' => '启用任务',
'name' => 'system.tasks.enable',
'name' => 'system.task.enable',
'type' => 'button',
'parent_id' => 0, // 稍后更新为定时任务菜单的ID
'path' => 'admin.tasks.enable',
'path' => 'admin.task.enable',
'component' => null,
'meta' => null,
'sort' => 7,
@@ -364,15 +364,87 @@ class SystemSeeder extends Seeder
],
[
'title' => '禁用任务',
'name' => 'system.tasks.disable',
'name' => 'system.task.disable',
'type' => 'button',
'parent_id' => 0, // 稍后更新为定时任务菜单的ID
'path' => 'admin.tasks.disable',
'path' => 'admin.task.disable',
'component' => null,
'meta' => null,
'sort' => 8,
'status' => 1,
],
// 城市管理
[
'title' => '城市管理',
'name' => 'system.city',
'type' => 'menu',
'parent_id' => 0, // 稍后更新为系统菜单的ID
'path' => '/system/city',
'component' => 'system/city/index',
'meta' => json_encode([
'icon' => 'EnvironmentOutlined',
'hidden' => false,
'hiddenBreadcrumb' => false,
]),
'sort' => 5,
'status' => 1,
],
[
'title' => '查看城市',
'name' => 'system.city.view',
'type' => 'button',
'parent_id' => 0, // 稍后更新为城市管理菜单的ID
'path' => 'admin.city.index',
'component' => null,
'meta' => null,
'sort' => 1,
'status' => 1,
],
[
'title' => '创建城市',
'name' => 'system.city.create',
'type' => 'button',
'parent_id' => 0, // 稍后更新为城市管理菜单的ID
'path' => 'admin.city.store',
'component' => null,
'meta' => null,
'sort' => 2,
'status' => 1,
],
[
'title' => '编辑城市',
'name' => 'system.city.update',
'type' => 'button',
'parent_id' => 0, // 稍后更新为城市管理菜单的ID
'path' => 'admin.city.update',
'component' => null,
'meta' => null,
'sort' => 3,
'status' => 1,
],
[
'title' => '删除城市',
'name' => 'system.city.delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为城市管理菜单的ID
'path' => 'admin.city.destroy',
'component' => null,
'meta' => null,
'sort' => 4,
'status' => 1,
],
[
'title' => '批量删除城市',
'name' => 'system.city.batch-delete',
'type' => 'button',
'parent_id' => 0, // 稍后更新为城市管理菜单的ID
'path' => 'admin.city.batch-delete',
'component' => null,
'meta' => null,
'sort' => 5,
'status' => 1,
],
];
foreach ($permissions as $permission) {
@@ -394,128 +466,156 @@ class SystemSeeder extends Seeder
$systemMenu = $permissions->where('name', 'system')->first();
// 获取系统子菜单ID
$configMenu = $permissions->where('name', 'system.config')->first();
$logsMenu = $permissions->where('name', 'system.logs')->first();
$dictionariesMenu = $permissions->where('name', 'system.dictionaries')->first();
$tasksMenu = $permissions->where('name', 'system.tasks')->first();
$settingMenu = $permissions->where('name', 'system.setting')->first();
$logMenu = $permissions->where('name', 'system.log')->first();
$dictionaryMenu = $permissions->where('name', 'system.dictionary')->first();
$taskMenu = $permissions->where('name', 'system.task')->first();
$cityMenu = $permissions->where('name', 'system.city')->first();
// 更新系统子菜单的parent_id
if ($systemMenu) {
if ($configMenu) {
$configMenu->update(['parent_id' => $systemMenu->id]);
if ($settingMenu) {
$settingMenu->update(['parent_id' => $systemMenu->id]);
}
if ($logsMenu) {
$logsMenu->update(['parent_id' => $systemMenu->id]);
if ($logMenu) {
$logMenu->update(['parent_id' => $systemMenu->id]);
}
if ($dictionariesMenu) {
$dictionariesMenu->update(['parent_id' => $systemMenu->id]);
if ($dictionaryMenu) {
$dictionaryMenu->update(['parent_id' => $systemMenu->id]);
}
if ($tasksMenu) {
$tasksMenu->update(['parent_id' => $systemMenu->id]);
if ($taskMenu) {
$taskMenu->update(['parent_id' => $systemMenu->id]);
}
if ($cityMenu) {
$cityMenu->update(['parent_id' => $systemMenu->id]);
}
}
// 更新按钮权限的parent_id - 系统配置
$configViewBtn = $permissions->where('name', 'system.config.view')->first();
$configCreateBtn = $permissions->where('name', 'system.config.create')->first();
$configUpdateBtn = $permissions->where('name', 'system.config.update')->first();
$configDeleteBtn = $permissions->where('name', 'system.config.delete')->first();
$configBatchDeleteBtn = $permissions->where('name', 'system.config.batch-delete')->first();
if ($configMenu) {
if ($configViewBtn) {
$configViewBtn->update(['parent_id' => $configMenu->id]);
$settingViewBtn = $permissions->where('name', 'system.setting.view')->first();
$settingCreateBtn = $permissions->where('name', 'system.setting.create')->first();
$settingUpdateBtn = $permissions->where('name', 'system.setting.update')->first();
$settingDeleteBtn = $permissions->where('name', 'system.setting.delete')->first();
$settingBatchDeleteBtn = $permissions->where('name', 'system.setting.batch-delete')->first();
if ($settingMenu) {
if ($settingViewBtn) {
$settingViewBtn->update(['parent_id' => $settingMenu->id]);
}
if ($configCreateBtn) {
$configCreateBtn->update(['parent_id' => $configMenu->id]);
if ($settingCreateBtn) {
$settingCreateBtn->update(['parent_id' => $settingMenu->id]);
}
if ($configUpdateBtn) {
$configUpdateBtn->update(['parent_id' => $configMenu->id]);
if ($settingUpdateBtn) {
$settingUpdateBtn->update(['parent_id' => $settingMenu->id]);
}
if ($configDeleteBtn) {
$configDeleteBtn->update(['parent_id' => $configMenu->id]);
if ($settingDeleteBtn) {
$settingDeleteBtn->update(['parent_id' => $settingMenu->id]);
}
if ($configBatchDeleteBtn) {
$configBatchDeleteBtn->update(['parent_id' => $configMenu->id]);
if ($settingBatchDeleteBtn) {
$settingBatchDeleteBtn->update(['parent_id' => $settingMenu->id]);
}
}
// 更新按钮权限的parent_id - 系统日志
$logsViewBtn = $permissions->where('name', 'system.logs.view')->first();
$logsDeleteBtn = $permissions->where('name', 'system.logs.delete')->first();
$logsBatchDeleteBtn = $permissions->where('name', 'system.logs.batch-delete')->first();
$logsExportBtn = $permissions->where('name', 'system.logs.export')->first();
if ($logsMenu) {
if ($logsViewBtn) {
$logsViewBtn->update(['parent_id' => $logsMenu->id]);
$logViewBtn = $permissions->where('name', 'system.log.view')->first();
$logDeleteBtn = $permissions->where('name', 'system.log.delete')->first();
$logBatchDeleteBtn = $permissions->where('name', 'system.log.batch-delete')->first();
$logExportBtn = $permissions->where('name', 'system.log.export')->first();
if ($logMenu) {
if ($logViewBtn) {
$logViewBtn->update(['parent_id' => $logMenu->id]);
}
if ($logsDeleteBtn) {
$logsDeleteBtn->update(['parent_id' => $logsMenu->id]);
if ($logDeleteBtn) {
$logDeleteBtn->update(['parent_id' => $logMenu->id]);
}
if ($logsBatchDeleteBtn) {
$logsBatchDeleteBtn->update(['parent_id' => $logsMenu->id]);
if ($logBatchDeleteBtn) {
$logBatchDeleteBtn->update(['parent_id' => $logMenu->id]);
}
if ($logsExportBtn) {
$logsExportBtn->update(['parent_id' => $logsMenu->id]);
if ($logExportBtn) {
$logExportBtn->update(['parent_id' => $logMenu->id]);
}
}
// 更新按钮权限的parent_id - 数据字典
$dictViewBtn = $permissions->where('name', 'system.dictionaries.view')->first();
$dictCreateBtn = $permissions->where('name', 'system.dictionaries.create')->first();
$dictUpdateBtn = $permissions->where('name', 'system.dictionaries.update')->first();
$dictDeleteBtn = $permissions->where('name', 'system.dictionaries.delete')->first();
$dictBatchDeleteBtn = $permissions->where('name', 'system.dictionaries.batch-delete')->first();
if ($dictionariesMenu) {
$dictViewBtn = $permissions->where('name', 'system.dictionary.view')->first();
$dictCreateBtn = $permissions->where('name', 'system.dictionary.create')->first();
$dictUpdateBtn = $permissions->where('name', 'system.dictionary.update')->first();
$dictDeleteBtn = $permissions->where('name', 'system.dictionary.delete')->first();
$dictBatchDeleteBtn = $permissions->where('name', 'system.dictionary.batch-delete')->first();
if ($dictionaryMenu) {
if ($dictViewBtn) {
$dictViewBtn->update(['parent_id' => $dictionariesMenu->id]);
$dictViewBtn->update(['parent_id' => $dictionaryMenu->id]);
}
if ($dictCreateBtn) {
$dictCreateBtn->update(['parent_id' => $dictionariesMenu->id]);
$dictCreateBtn->update(['parent_id' => $dictionaryMenu->id]);
}
if ($dictUpdateBtn) {
$dictUpdateBtn->update(['parent_id' => $dictionariesMenu->id]);
$dictUpdateBtn->update(['parent_id' => $dictionaryMenu->id]);
}
if ($dictDeleteBtn) {
$dictDeleteBtn->update(['parent_id' => $dictionariesMenu->id]);
$dictDeleteBtn->update(['parent_id' => $dictionaryMenu->id]);
}
if ($dictBatchDeleteBtn) {
$dictBatchDeleteBtn->update(['parent_id' => $dictionariesMenu->id]);
$dictBatchDeleteBtn->update(['parent_id' => $dictionaryMenu->id]);
}
}
// 更新按钮权限的parent_id - 定时任务
$taskViewBtn = $permissions->where('name', 'system.tasks.view')->first();
$taskCreateBtn = $permissions->where('name', 'system.tasks.create')->first();
$taskUpdateBtn = $permissions->where('name', 'system.tasks.update')->first();
$taskDeleteBtn = $permissions->where('name', 'system.tasks.delete')->first();
$taskBatchDeleteBtn = $permissions->where('name', 'system.tasks.batch-delete')->first();
$taskExecuteBtn = $permissions->where('name', 'system.tasks.execute')->first();
$taskEnableBtn = $permissions->where('name', 'system.tasks.enable')->first();
$taskDisableBtn = $permissions->where('name', 'system.tasks.disable')->first();
if ($tasksMenu) {
$taskViewBtn = $permissions->where('name', 'system.task.view')->first();
$taskCreateBtn = $permissions->where('name', 'system.task.create')->first();
$taskUpdateBtn = $permissions->where('name', 'system.task.update')->first();
$taskDeleteBtn = $permissions->where('name', 'system.task.delete')->first();
$taskBatchDeleteBtn = $permissions->where('name', 'system.task.batch-delete')->first();
$taskExecuteBtn = $permissions->where('name', 'system.task.execute')->first();
$taskEnableBtn = $permissions->where('name', 'system.task.enable')->first();
$taskDisableBtn = $permissions->where('name', 'system.task.disable')->first();
if ($taskMenu) {
if ($taskViewBtn) {
$taskViewBtn->update(['parent_id' => $tasksMenu->id]);
$taskViewBtn->update(['parent_id' => $taskMenu->id]);
}
if ($taskCreateBtn) {
$taskCreateBtn->update(['parent_id' => $tasksMenu->id]);
$taskCreateBtn->update(['parent_id' => $taskMenu->id]);
}
if ($taskUpdateBtn) {
$taskUpdateBtn->update(['parent_id' => $tasksMenu->id]);
$taskUpdateBtn->update(['parent_id' => $taskMenu->id]);
}
if ($taskDeleteBtn) {
$taskDeleteBtn->update(['parent_id' => $tasksMenu->id]);
$taskDeleteBtn->update(['parent_id' => $taskMenu->id]);
}
if ($taskBatchDeleteBtn) {
$taskBatchDeleteBtn->update(['parent_id' => $tasksMenu->id]);
$taskBatchDeleteBtn->update(['parent_id' => $taskMenu->id]);
}
if ($taskExecuteBtn) {
$taskExecuteBtn->update(['parent_id' => $tasksMenu->id]);
$taskExecuteBtn->update(['parent_id' => $taskMenu->id]);
}
if ($taskEnableBtn) {
$taskEnableBtn->update(['parent_id' => $tasksMenu->id]);
$taskEnableBtn->update(['parent_id' => $taskMenu->id]);
}
if ($taskDisableBtn) {
$taskDisableBtn->update(['parent_id' => $tasksMenu->id]);
$taskDisableBtn->update(['parent_id' => $taskMenu->id]);
}
}
// 更新按钮权限的parent_id - 城市管理
$cityViewBtn = $permissions->where('name', 'system.city.view')->first();
$cityCreateBtn = $permissions->where('name', 'system.city.create')->first();
$cityUpdateBtn = $permissions->where('name', 'system.city.update')->first();
$cityDeleteBtn = $permissions->where('name', 'system.city.delete')->first();
$cityBatchDeleteBtn = $permissions->where('name', 'system.city.batch-delete')->first();
if ($cityMenu) {
if ($cityViewBtn) {
$cityViewBtn->update(['parent_id' => $cityMenu->id]);
}
if ($cityCreateBtn) {
$cityCreateBtn->update(['parent_id' => $cityMenu->id]);
}
if ($cityUpdateBtn) {
$cityUpdateBtn->update(['parent_id' => $cityMenu->id]);
}
if ($cityDeleteBtn) {
$cityDeleteBtn->update(['parent_id' => $cityMenu->id]);
}
if ($cityBatchDeleteBtn) {
$cityBatchDeleteBtn->update(['parent_id' => $cityMenu->id]);
}
}
}
@@ -526,7 +626,7 @@ class SystemSeeder extends Seeder
private function createSystemDictionaries(): void
{
// 创建字典类型
$dictionaries = [
$dictionary = [
[
'name' => '用户状态',
'code' => 'user_status',
@@ -593,7 +693,7 @@ class SystemSeeder extends Seeder
],
];
foreach ($dictionaries as $dictionary) {
foreach ($dictionary as $dictionary) {
$dict = Dictionary::create($dictionary);
$this->createDictionaryItems($dict);
}

File diff suppressed because it is too large Load Diff