From dd5d10a534487ed0a08897663806c35cd52ddda0 Mon Sep 17 00:00:00 2001 From: LLL <15374889135@163.com> Date: Sat, 17 May 2025 20:02:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/departments/Departments.php | 4 + .../LessonCourseTeaching.php | 718 ++++++++++++++++++ niucloud/app/adminapi/route/departments.php | 24 + .../adminapi/route/lesson_course_teaching.php | 122 +++ .../app/model/departments/Departments.php | 22 +- .../LessonCourseTeaching.php | 124 +++ .../model/personnel_data/PersonnelData.php | 55 ++ .../admin/departments/DepartmentsService.php | 14 +- .../LessonCourseTeachingService.php | 634 ++++++++++++++++ .../LessonCourseTeaching.php | 35 + 10 files changed, 1744 insertions(+), 8 deletions(-) create mode 100644 niucloud/app/adminapi/controller/lesson_course_teaching/LessonCourseTeaching.php create mode 100644 niucloud/app/adminapi/route/lesson_course_teaching.php create mode 100644 niucloud/app/model/lesson_course_teaching/LessonCourseTeaching.php create mode 100644 niucloud/app/model/personnel_data/PersonnelData.php create mode 100644 niucloud/app/service/admin/lesson_course_teaching/LessonCourseTeachingService.php create mode 100644 niucloud/app/validate/lesson_course_teaching/LessonCourseTeaching.php diff --git a/niucloud/app/adminapi/controller/departments/Departments.php b/niucloud/app/adminapi/controller/departments/Departments.php index d0912fe4..66bd8e7f 100644 --- a/niucloud/app/adminapi/controller/departments/Departments.php +++ b/niucloud/app/adminapi/controller/departments/Departments.php @@ -85,4 +85,8 @@ class Departments extends BaseAdminController } + public function getDepartmentsAll(){ + return success(( new DepartmentsService())->getDepartmentsAll()); + } + } diff --git a/niucloud/app/adminapi/controller/lesson_course_teaching/LessonCourseTeaching.php b/niucloud/app/adminapi/controller/lesson_course_teaching/LessonCourseTeaching.php new file mode 100644 index 00000000..fda2fa88 --- /dev/null +++ b/niucloud/app/adminapi/controller/lesson_course_teaching/LessonCourseTeaching.php @@ -0,0 +1,718 @@ +request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",1] + ]); + return success((new LessonCourseTeachingService())->getPage($data)); + } + + + /** + * 添加教研管理 + * @return \think\Response + */ + public function add(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",1] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->add($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 教研管理编辑 + * @param $id 教研管理id + * @return \think\Response + */ + public function edit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->edit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 获取跳绳教案库列表 + * @return \think\Response + */ + public function jumpLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",2] + ]); + return success((new LessonCourseTeachingService())->jumpPetPage($data)); + } + + + /** + * 添加跳绳教案库 + * @return \think\Response + */ + public function jumpAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",2] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->jumpAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 跳绳教案库编辑 + * @param $id 教研管理id + * @return \think\Response + */ + public function jumpEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->jumpEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + + /** + * 获取增高教案库列表 + * @return \think\Response + */ + public function enLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",3] + ]); + return success((new LessonCourseTeachingService())->enPetPage($data)); + } + + + /** + * 添加增高教案库 + * @return \think\Response + */ + public function enAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",3] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->enAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 跳绳增高教案库 + * @param $id 教研管理id + * @return \think\Response + */ + public function enEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->enEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + + /** + * 获取篮球教案库列表 + * @return \think\Response + */ + public function basketballLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",4] + ]); + return success((new LessonCourseTeachingService())->basketballPetPage($data)); + } + + + /** + * 添加篮球教案库 + * @return \think\Response + */ + public function basketballAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",4] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->basketballAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 跳绳篮球教案库 + * @param $id 教研管理id + * @return \think\Response + */ + public function basketballEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->basketballEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + + /** + * 获取强化教案库列表 + * @return \think\Response + */ + public function strengLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",5] + ]); + return success((new LessonCourseTeachingService())->strengPetPage($data)); + } + + + /** + * 添加强化教案库 + * @return \think\Response + */ + public function strengAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",5] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->strengAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 跳绳强化教案库 + * @param $id 教研管理id + * @return \think\Response + */ + public function strengEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->strengEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 获取空中忍者教案库列表 + * @return \think\Response + */ + public function ninjaLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",6] + ]); + return success((new LessonCourseTeachingService())->ninjaPetPage($data)); + } + + + /** + * 添加空中忍者教案库 + * @return \think\Response + */ + public function ninjaAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",6] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->ninjaAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 跳绳空中忍者教案库 + * @param $id 教研管理id + * @return \think\Response + */ + public function ninjaEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->ninjaEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 获取空中忍者教案库列表 + * @return \think\Response + */ + public function securityLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",7] + ]); + return success((new LessonCourseTeachingService())->securityPetPage($data)); + } + + + /** + * 添加空中忍者教案库 + * @return \think\Response + */ + public function securityAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",7] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->securityAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 跳绳空中忍者教案库 + * @param $id 教研管理id + * @return \think\Response + */ + public function securityEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->securityEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + + /** + * 获取体能教案库列表 + * @return \think\Response + */ + public function physicalLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",8] + ]); + return success((new LessonCourseTeachingService())->physicalPetPage($data)); + } + + + /** + * 添加体能教案库 + * @return \think\Response + */ + public function physicalAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",8] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->physicalAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 跳绳体能教案库 + * @param $id 教研管理id + * @return \think\Response + */ + public function physicalEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->physicalEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 获取体能教案库列表 + * @return \think\Response + */ + public function actionLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",9] + ]); + return success((new LessonCourseTeachingService())->actionPetPage($data)); + } + + + /** + * 热身动作 + * @return \think\Response + */ + public function actionAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",9] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->actionAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 热身动作 + * @param $id 教研管理id + * @return \think\Response + */ + public function actionEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->actionEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 获取体能教案库列表 + * @return \think\Response + */ + public function fitnessLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",10] + ]); + return success((new LessonCourseTeachingService())->fitnessPetPage($data)); + } + + + /** + * 热身动作 + * @return \think\Response + */ + public function fitnessAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",10] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->fitnessAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 热身动作 + * @param $id 教研管理id + * @return \think\Response + */ + public function fitnessEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->fitnessEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 获取体能教案库列表 + * @return \think\Response + */ + public function gamesLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",11] + ]); + return success((new LessonCourseTeachingService())->gamesPetPage($data)); + } + + + /** + * 热身动作 + * @return \think\Response + */ + public function gamesAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",11] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->gamesAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 热身动作 + * @param $id 教研管理id + * @return \think\Response + */ + public function gamesEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->gamesEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + + /** + * 获取体能教案库列表 + * @return \think\Response + */ + public function relaxationLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",12] + ]); + return success((new LessonCourseTeachingService())->relaxationPetPage($data)); + } + + /** + * 热身动作 + * @return \think\Response + */ + public function relaxationAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",12] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->relaxationAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 热身动作 + * @param $id 教研管理id + * @return \think\Response + */ + public function relaxationEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->relaxationEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + + + public function publicLists(){ + $data = $this->request->params([ + ["title",""], + ["status",""], + ["create_time",["",""]], + ["update_time",["",""]], + ["table_type",0], + ]); + return success((new LessonCourseTeachingService())->publicPetPage($data)); + } + public function publicAdd(){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ["table_type",0] + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); + $id = (new LessonCourseTeachingService())->publicAdd($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + public function publicEdit(int $id){ + $data = $this->request->params([ + ["title",""], + ["image",""], + ["type",0], + ["content",""], + ["status",0], + ]); + $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); + (new LessonCourseTeachingService())->publicEdit($id, $data); + return success('EDIT_SUCCESS'); + } + + + + /** + * 教研管理详情 + * @param int $id + * @return \think\Response + */ + public function info(int $id){ + return success((new LessonCourseTeachingService())->getInfo($id)); + } + + + /** + * 教研管理删除 + * @param $id 教研管理id + * @return \think\Response + */ + public function del(int $id){ + (new LessonCourseTeachingService())->del($id); + return success('DELETE_SUCCESS'); + } + + + public function getPersonnelDataAll(){ + return success(( new LessonCourseTeachingService())->getPersonnelDataAll()); + } + +} diff --git a/niucloud/app/adminapi/route/departments.php b/niucloud/app/adminapi/route/departments.php index 2e9a4c1f..2301021a 100644 --- a/niucloud/app/adminapi/route/departments.php +++ b/niucloud/app/adminapi/route/departments.php @@ -35,3 +35,27 @@ Route::group('departments', function () { AdminLog::class ]); // USER_CODE_END -- departments + +// USER_CODE_BEGIN -- departments + +Route::group('departments', function () { + + //部门列表 + Route::get('departments', 'departments.Departments/lists'); + //部门详情 + Route::get('departments/:id', 'departments.Departments/info'); + //添加部门 + Route::post('departments', 'departments.Departments/add'); + //编辑部门 + Route::put('departments/:id', 'departments.Departments/edit'); + //删除部门 + Route::delete('departments/:id', 'departments.Departments/del'); + + Route::get('departments_all','departments.Departments/getDepartmentsAll'); + +})->middleware([ + AdminCheckToken::class, + AdminCheckRole::class, + AdminLog::class +]); +// USER_CODE_END -- departments diff --git a/niucloud/app/adminapi/route/lesson_course_teaching.php b/niucloud/app/adminapi/route/lesson_course_teaching.php new file mode 100644 index 00000000..4e23c846 --- /dev/null +++ b/niucloud/app/adminapi/route/lesson_course_teaching.php @@ -0,0 +1,122 @@ +middleware([ + AdminCheckToken::class, + AdminCheckRole::class, + AdminLog::class +]); +// USER_CODE_END -- lesson_course_teaching diff --git a/niucloud/app/model/departments/Departments.php b/niucloud/app/model/departments/Departments.php index ef6f3d72..a990e5a1 100644 --- a/niucloud/app/model/departments/Departments.php +++ b/niucloud/app/model/departments/Departments.php @@ -16,6 +16,8 @@ use think\model\concern\SoftDelete; use think\model\relation\HasMany; use think\model\relation\HasOne; +use app\model\departments\Departments; + /** * 部门模型 * Class Departments @@ -24,7 +26,7 @@ use think\model\relation\HasOne; class Departments extends BaseModel { - + use SoftDelete; /** * 数据表主键 @@ -38,9 +40,17 @@ class Departments extends BaseModel */ protected $name = 'departments'; - + /** + * 定义软删除标记字段. + * @var string + */ + protected $deleteTime = 'deleted_at'; - + /** + * 定义软删除字段的默认值. + * @var int + */ + protected $defaultSoftDelete = 0; /** * 搜索器:部门部门编号 @@ -67,7 +77,7 @@ class Departments extends BaseModel } /** - * 搜索器:部门上级部门 + * 搜索器:部门上级部门ID * @param $value * @param $data */ @@ -83,4 +93,8 @@ class Departments extends BaseModel + public function departments(){ + return $this->hasOne(Departments::class, 'id', 'parent_department_id')->joinType('left')->withField('department_name,id')->bind(['parent_department_id_name'=>'department_name']); + } + } diff --git a/niucloud/app/model/lesson_course_teaching/LessonCourseTeaching.php b/niucloud/app/model/lesson_course_teaching/LessonCourseTeaching.php new file mode 100644 index 00000000..33533667 --- /dev/null +++ b/niucloud/app/model/lesson_course_teaching/LessonCourseTeaching.php @@ -0,0 +1,124 @@ +where("title", "like", "%".$value."%"); + } + } + + /** + * 搜索器:教研管理状态 + * @param $value + * @param $data + */ + public function searchStatusAttr($query, $value, $data) + { + if ($value) { + $query->where("status", $value); + } + } + + /** + * 搜索器:教研管理创建时间 + * @param $value + * @param $data + */ + public function searchCreateTimeAttr($query, $value, $data) + { + $start = empty($value[0]) ? 0 : strtotime($value[0]); + $end = empty($value[1]) ? 0 : strtotime($value[1]); + if ($start > 0 && $end > 0) { + $query->where([["create_time", "between", [$start, $end]]]); + } else if ($start > 0 && $end == 0) { + $query->where([["create_time", ">=", $start]]); + } else if ($start == 0 && $end > 0) { + $query->where([["create_time", "<=", $end]]); + } + } + + /** + * 搜索器:教研管理修改时间 + * @param $value + * @param $data + */ + public function searchUpdateTimeAttr($query, $value, $data) + { + $start = empty($value[0]) ? 0 : strtotime($value[0]); + $end = empty($value[1]) ? 0 : strtotime($value[1]); + if ($start > 0 && $end > 0) { + $query->where([["update_time", "between", [$start, $end]]]); + } else if ($start > 0 && $end == 0) { + $query->where([["update_time", ">=", $start]]); + } else if ($start == 0 && $end > 0) { + $query->where([["update_time", "<=", $end]]); + } + } + + + + + + + public function personnelData(){ + return $this->hasOne(PersonnelData::class, 'sys_user_id', 'user_permission')->joinType('left')->withField('name,sys_user_id')->bind(['user_permission_name'=>'name']); + } + +} diff --git a/niucloud/app/model/personnel_data/PersonnelData.php b/niucloud/app/model/personnel_data/PersonnelData.php new file mode 100644 index 00000000..4cb7dcec --- /dev/null +++ b/niucloud/app/model/personnel_data/PersonnelData.php @@ -0,0 +1,55 @@ +model->withSearch(["id","department_name","parent_department_id"], $where)->field($field)->order($order); + $search_model = $this->model->withSearch(["id","department_name","parent_department_id"], $where)->with(['departments'])->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } @@ -51,9 +52,9 @@ class DepartmentsService extends BaseAdminService */ public function getInfo(int $id) { - $field = 'id,department_name,parent_department_id,created_at,updated_at'; + $field = 'id,department_name,parent_department_id,created_at,updated_at,deleted_at'; - $info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); + $info = $this->model->field($field)->where([['id', "=", $id]])->with(['departments'])->findOrEmpty()->toArray(); return $info; } @@ -95,5 +96,10 @@ class DepartmentsService extends BaseAdminService } + public function getDepartmentsAll(){ + $departmentsModel = new Departments(); + return $departmentsModel->select()->toArray(); + } + } diff --git a/niucloud/app/service/admin/lesson_course_teaching/LessonCourseTeachingService.php b/niucloud/app/service/admin/lesson_course_teaching/LessonCourseTeachingService.php new file mode 100644 index 00000000..d320b945 --- /dev/null +++ b/niucloud/app/service/admin/lesson_course_teaching/LessonCourseTeachingService.php @@ -0,0 +1,634 @@ +model = new LessonCourseTeaching(); + } + + /** + * 获取课程教学大纲列表 + * @param array $where + * @return array + */ + public function getPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + + /** + * 添加课程教学大纲 + * @param array $data + * @return mixed + */ + public function add(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 课程教学大纲编辑 + * @param int $id + * @param array $data + * @return bool + */ + public function edit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + + /** + * 获取跳绳教案库列表 + * @param array $where + * @return array + */ + public function jumpPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加跳绳教案库 + * @param array $data + * @return mixed + */ + public function jumpAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 跳绳教案库编辑 + * @param int $id + * @param array $data + * @return bool + */ + public function jumpEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + /** + * 获取增高教案库列表 + * @param array $where + * @return array + */ + public function enPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加增高教案库 + * @param array $data + * @return mixed + */ + public function enAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 跳绳增高教案库 + * @param int $id + * @param array $data + * @return bool + */ + public function enEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + + /** + * 获取跳高教案库列表 + * @param array $where + * @return array + */ + public function basketballPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加跳高教案库 + * @param array $data + * @return mixed + */ + public function basketballAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 跳绳跳高教案库 + * @param int $id + * @param array $data + * @return bool + */ + public function basketballEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + /** + * 获取跳高教案库列表 + * @param array $where + * @return array + */ + public function strengPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加跳高教案库 + * @param array $data + * @return mixed + */ + public function strengAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 跳绳跳高教案库 + * @param int $id + * @param array $data + * @return bool + */ + public function strengEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + /** + * 获取跳高教案库列表 + * @param array $where + * @return array + */ + public function ninjaPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加跳高教案库 + * @param array $data + * @return mixed + */ + public function ninjaAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 跳绳跳高教案库 + * @param int $id + * @param array $data + * @return bool + */ + public function ninjaEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + /** + * 获取跳高教案库列表 + * @param array $where + * @return array + */ + public function securityPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加跳高教案库 + * @param array $data + * @return mixed + */ + public function securityAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 跳绳跳高教案库 + * @param int $id + * @param array $data + * @return bool + */ + public function securityEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + /** + * 获取体能教案库列表 + * @param array $where + * @return array + */ + public function physicalPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加体能教案库 + * @param array $data + * @return mixed + */ + public function physicalAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 跳绳体能教案库 + * @param int $id + * @param array $data + * @return bool + */ + public function physicalEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + + + + + /** + * 获取热身动做列表 + * @param array $where + * @return array + */ + public function actionPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加热身动做 + * @param array $data + * @return mixed + */ + public function actionAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 热身动做 + * @param int $id + * @param array $data + * @return bool + */ + public function actionEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + + /** + * 获取趣味游戏列表 + * @param array $where + * @return array + */ + public function gamesPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加趣味游戏 + * @param array $data + * @return mixed + */ + public function gamesAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 趣味游戏 + * @param int $id + * @param array $data + * @return bool + */ + public function gamesEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + + + /** + * 获取趣味游戏列表 + * @param array $where + * @return array + */ + public function fitnessPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加趣味游戏 + * @param array $data + * @return mixed + */ + public function fitnessAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 趣味游戏 + * @param int $id + * @param array $data + * @return bool + */ + public function fitnessEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + + /** + * 获取趣味游戏列表 + * @param array $where + * @return array + */ + public function relaxationPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 添加趣味游戏 + * @param array $data + * @return mixed + */ + public function relaxationAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 趣味游戏 + * @param int $id + * @param array $data + * @return bool + */ + public function relaxationEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + + public function publicPetPage(array $where = []) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + $order = 'id desc'; + $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + public function publicAdd(array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $res = $this->model->create($data); + return $res->id; + + } + public function publicEdit(int $id, array $data) + { + if (isset($data['user_permission']) && is_array($data['user_permission'])) { + $data['user_permission'] = implode(',', $data['user_permission']); + } + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + + /** + * 获取教研管理信息 + * @param int $id + * @return array + */ + public function getInfo(int $id) + { + $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; + + $info = $this->model->field($field)->where([['id', "=", $id]])->with(['personnelData'])->findOrEmpty()->toArray(); + $info['status'] = strval($info['status']); + return $info; + } + + /** + * 删除教研管理 + * @param int $id + * @return bool + */ + public function del(int $id) + { + $model = $this->model->where([['id', '=', $id]])->find(); + $res = $model->delete(); + return $res; + } + + + public function getPersonnelDataAll(){ + $personnelDataModel = new PersonnelData(); + return $personnelDataModel->where('is_sys_user',1)->select()->toArray(); + } + + +} diff --git a/niucloud/app/validate/lesson_course_teaching/LessonCourseTeaching.php b/niucloud/app/validate/lesson_course_teaching/LessonCourseTeaching.php new file mode 100644 index 00000000..1c589ac9 --- /dev/null +++ b/niucloud/app/validate/lesson_course_teaching/LessonCourseTeaching.php @@ -0,0 +1,35 @@ + ['title', 'image', 'type', 'content', 'status'], + "edit" => ['title', 'image', 'type', 'content', 'status'] + ]; + +}