parent
81afdcd68f
commit
c9ea33d4e2
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class ScheduleOverviewLocation extends SoftDeletesModel
|
||||
{
|
||||
protected $table = 'schedule_overview_locations';
|
||||
|
||||
public function modules()
|
||||
{
|
||||
return $this->hasMany(ScheduleOverviewScheduleModule::class, 'location_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class ScheduleOverviewOwner extends SoftDeletesModel
|
||||
{
|
||||
protected $table = 'schedule_overview_owners';
|
||||
|
||||
public function modules()
|
||||
{
|
||||
return $this->hasMany(ScheduleOverviewScheduleModule::class, 'owner_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class ScheduleOverviewScheduleGroup extends SoftDeletesModel
|
||||
{
|
||||
protected $table = 'schedule_overview_schedule_groups';
|
||||
|
||||
public function system()
|
||||
{
|
||||
return $this->belongsTo(ScheduleOverviewSystem::class, 'system_id', 'id');
|
||||
}
|
||||
|
||||
public function course()
|
||||
{
|
||||
return $this->belongsTo(ScheduleOverviewCourse::class, 'course_id', 'id');
|
||||
}
|
||||
|
||||
public function modules()
|
||||
{
|
||||
return $this->hasMany(ScheduleOverviewScheduleModule::class, 'group_id', 'id')->orderBy('month')->orderBy('sort')->orderBy('id');
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class ScheduleOverviewScheduleModule extends SoftDeletesModel
|
||||
{
|
||||
protected $table = 'schedule_overview_schedule_modules';
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo(ScheduleOverviewScheduleGroup::class, 'group_id', 'id');
|
||||
}
|
||||
|
||||
public function location()
|
||||
{
|
||||
return $this->belongsTo(ScheduleOverviewLocation::class, 'location_id', 'id');
|
||||
}
|
||||
|
||||
public function owner()
|
||||
{
|
||||
return $this->belongsTo(ScheduleOverviewOwner::class, 'owner_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (!Schema::hasTable('schedule_overview_courses')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('schedule_overview_courses', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('schedule_overview_courses', 'course_type_id')) {
|
||||
$table->unsignedBigInteger('course_type_id')->nullable()->after('system_id')->comment('课程类别ID');
|
||||
$table->index('course_type_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (!Schema::hasTable('schedule_overview_courses') || !Schema::hasColumn('schedule_overview_courses', 'course_type_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('schedule_overview_courses', function (Blueprint $table) {
|
||||
$table->dropIndex(['course_type_id']);
|
||||
$table->dropColumn('course_type_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('schedule_overview_schedule_groups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('year', 4)->comment('年份');
|
||||
$table->unsignedBigInteger('system_id')->comment('计划体系ID');
|
||||
$table->unsignedBigInteger('course_id')->comment('课程体系ID');
|
||||
$table->string('title')->comment('带班标题');
|
||||
$table->bigInteger('admin_id')->nullable()->comment('创建管理员');
|
||||
$table->bigInteger('department_id')->nullable()->comment('部门ID');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['year', 'system_id']);
|
||||
$table->index(['system_id', 'course_id']);
|
||||
});
|
||||
|
||||
Schema::create('schedule_overview_schedule_modules', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('group_id')->comment('带班组ID');
|
||||
$table->string('name')->nullable()->comment('模块/期数名称');
|
||||
$table->unsignedTinyInteger('month')->comment('月份');
|
||||
$table->unsignedBigInteger('location_id')->comment('地点ID');
|
||||
$table->unsignedBigInteger('owner_id')->comment('负责人ID');
|
||||
$table->string('count_text')->nullable()->comment('显示说明');
|
||||
$table->integer('sort')->default(0)->comment('排序');
|
||||
$table->bigInteger('admin_id')->nullable()->comment('创建管理员');
|
||||
$table->bigInteger('department_id')->nullable()->comment('部门ID');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['group_id', 'month']);
|
||||
$table->index('location_id');
|
||||
$table->index('owner_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('schedule_overview_schedule_modules');
|
||||
Schema::dropIfExists('schedule_overview_schedule_groups');
|
||||
}
|
||||
};
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('schedule_overview_locations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->comment('地点名称');
|
||||
$table->integer('sort')->default(0)->comment('排序');
|
||||
$table->tinyInteger('status')->default(1)->comment('状态0禁用1启用');
|
||||
$table->bigInteger('admin_id')->nullable()->comment('创建管理员');
|
||||
$table->bigInteger('department_id')->nullable()->comment('部门ID');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['status', 'sort']);
|
||||
$table->unique(['name'], 'uniq_schedule_overview_locations_name');
|
||||
});
|
||||
|
||||
Schema::create('schedule_overview_owners', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->comment('负责人名称');
|
||||
$table->integer('sort')->default(0)->comment('排序');
|
||||
$table->tinyInteger('status')->default(1)->comment('状态0禁用1启用');
|
||||
$table->bigInteger('admin_id')->nullable()->comment('创建管理员');
|
||||
$table->bigInteger('department_id')->nullable()->comment('部门ID');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['status', 'sort']);
|
||||
$table->unique(['name'], 'uniq_schedule_overview_owners_name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('schedule_overview_owners');
|
||||
Schema::dropIfExists('schedule_overview_locations');
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue