From cc5fb50113462de358b056c9ae16e2445fad750b Mon Sep 17 00:00:00 2001 From: dao Date: Fri, 20 Dec 2024 10:35:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8E=A5=E5=8F=A3=E3=80=81?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LessonDevController.cs | 133 +++++++++++ .../Views/LessonDev/Form.cshtml | 19 ++ .../Views/LessonDev/Form.js | 38 ++++ .../Views/LessonDev/Index.cshtml | 34 +++ .../Views/LessonDev/Index.js | 106 +++++++++ .../Learun.Application.Web.csproj | 5 + .../Modules/Device/LessonShow.cs | 16 +- .../EducationalAdministration/LessonDevMap.cs | 29 +++ .../Learun.Application.Mapping.csproj | 1 + .../ArrangeLessonTermService.cs | 4 +- .../ClassInfo/ClassInfoService.cs | 10 +- .../LessonDev/LessonDevBLL.cs | 167 ++++++++++++++ .../LessonDev/LessonDevEntity.cs | 77 +++++++ .../LessonDev/LessonDevIBLL.cs | 56 +++++ .../LessonDev/LessonDevService.cs | 206 ++++++++++++++++++ .../Learun.Application.TwoDevelopment.csproj | 4 + 16 files changed, 893 insertions(+), 12 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/LessonDevController.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Form.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Form.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Index.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Index.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/LessonDevMap.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevEntity.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevIBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevService.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/LessonDevController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/LessonDevController.cs new file mode 100644 index 000000000..2838f9654 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/LessonDevController.cs @@ -0,0 +1,133 @@ +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Util; +using System.Data; +using System.Web.Mvc; + +namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-12-18 10:37 + /// 描 述:课表设备 + /// + public class LessonDevController : MvcControllerBase + { + private LessonDevIBLL lessonDevIBLL = new LessonDevBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取列表数据 + /// + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetList( string queryJson ) + { + var data = lessonDevIBLL.GetList(queryJson); + return Success(data); + } + /// + /// 获取列表分页数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = lessonDevIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var data = lessonDevIBLL.GetEntity(keyValue); + return Success(data); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + lessonDevIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 解邦 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult UnBind(string keyValue) + { + lessonDevIBLL.UnBind(keyValue); + return Success("操作成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue,LessonDevEntity entity) + { + lessonDevIBLL.SaveEntity(keyValue, entity); + return Success("保存成功!"); + } + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Form.cshtml new file mode 100644 index 000000000..3b921cde5 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Form.cshtml @@ -0,0 +1,19 @@ +@{ + ViewBag.Title = "课表设备"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+ @*
+
Id*
+ +
*@ +
+
设备编码*
+ +
+
+
设备备注
+ +
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/LessonDev/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Form.js new file mode 100644 index 000000000..912719622 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Form.js @@ -0,0 +1,38 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2024-12-18 10:37 + * 描 述:课表设备 + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var selectedRow = learun.frameTab.currentIframe().selectedRow; + var page = { + init: function () { + page.initData(); + }, + bind: function () { + }, + initData: function () { + if (!!selectedRow) { + $('#form').lrSetFormData(selectedRow); + } + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('#form').lrValidform()) { + return false; + } + var postData = $('#form').lrGetFormData(); + $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/LessonDev/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Index.cshtml new file mode 100644 index 000000000..f5521d02b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Index.cshtml @@ -0,0 +1,34 @@ +@{ + ViewBag.Title = "课表设备"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
标题
+
+
+
+ +
+
+  查询 +
+
+
+
+ +
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/LessonDev/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Index.js new file mode 100644 index 000000000..f743ab3cf --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonDev/Index.js @@ -0,0 +1,106 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2024-12-18 10:37 + * 描 述:课表设备 + */ +var selectedRow; +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + // 查询 + $('#btn_Search').on('click', function () { + var keyword = $('#txt_Keyword').val(); + page.search({ keyword: keyword }); + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + selectedRow = null; + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/EducationalAdministration/LessonDev/Form', + width: 700, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + selectedRow = $('#gridtable').jfGridGet('rowdata'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/EducationalAdministration/LessonDev/Form?keyValue=' + keyValue, + width: 700, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/LessonDev/DeleteForm', { keyValue: keyValue}, function () { + }); + } + }); + } + }); + //解绑 + $('#lr_unbind').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('DevCode'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认解邦!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/LessonDev/UnBind', { keyValue: keyValue }, function () { + + }); + } + }); + } + }); + }, + initGird: function () { + $('#gridtable').lrAuthorizeJfGrid({ + url: top.$.rootUrl + '/EducationalAdministration/LessonDev/GetPageList', + headData: [ + //{ label: 'Id', name: 'Id', width: 200, align: "left" }, + { label: '设备编号', name: 'DevCode', width: 200, align: "left" }, + { label: '备注', name: 'DevBz', width: 200, align: "left" }, + { label: '邦定班级', name: 'ClassName', width: 200, align: "left" }, + ], + mainId:'Id', + isPage: true + }); + page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 3bbec2182..b499f4673 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -896,6 +896,7 @@ + @@ -6842,6 +6843,10 @@ + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs index 707b9f424..317996b0d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Device/LessonShow.cs @@ -51,10 +51,17 @@ namespace Learun.Application.WebApi.Modules.Device } public class BindDevClass { + /// + /// 班级编号 + /// public string ClassNo { get; set; } - + /// + /// 设备编号 + /// public string DeviceNo { get; set; } - + /// + /// 设备密码 + /// public string DevPwd { get; set; } } /// @@ -65,10 +72,11 @@ namespace Learun.Application.WebApi.Modules.Device public Response GetLesson(dynamic _) { var bj = this.GetReq(); + if (bj.DeviceNo.IsNullOrWhiteSpace()) return Fail($"设备码不正确({bj.DeviceNo});"); var classInfo = classInfoIBLL.GetClassNoByDevice(bj.DeviceNo); if (classInfo == null) return Fail("未找到班级"); var lesson = arrangeLessonTermIBLL.GetLessonDay(DateTime.Today, classInfo.ClassNo, ""); - return Success(lesson); + return Success(new { Lesson=lesson,classInfo.ClassName}); } /// /// 验证密码 @@ -83,7 +91,7 @@ namespace Learun.Application.WebApi.Modules.Device { return Fail("密码错误!"); } - return Success("lesson"); + return Success("验证通过"); } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/LessonDevMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/LessonDevMap.cs new file mode 100644 index 000000000..8e1ecb7f2 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/LessonDevMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.EducationalAdministration; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-12-18 10:37 + /// 描 述:课表设备 + /// + public class LessonDevMap : EntityTypeConfiguration + { + public LessonDevMap() + { + #region 表、主键 + //表 + this.ToTable("LESSONDEV"); + //主键 + this.HasKey(t => t.Id); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index acd8457fa..f93bea470 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -626,6 +626,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index f5ac12536..e98ce982f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -1790,7 +1790,7 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les { var startDate = lessonDate; var endDate = lessonDate.AddDays(1); - string sql = @"select b.AltId,b.F_SchoolId,b.DeptNo,b.MajorNo,b.AcademicYearNo as AcademicYear,b.LessonNo,b.LessonName,b.LessonTime,b.LessonDate,b.EmpNo,b.Empname EmpName,replace (b.TeachClassNo,b.LessonName,'') TeachClassNo, b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName,f.LessonTypeName,f.LessonTypeCode + string sql = @"select b.AltId,b.F_SchoolId,b.DeptNo,b.MajorNo,b.AcademicYearNo as AcademicYear,d.ClassName,b.LessonNo,b.LessonName,b.LessonTime,b.LessonDate,b.EmpNo,b.Empname EmpName,replace (b.TeachClassNo,b.LessonName,'') TeachClassNo, b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName,f.LessonTypeName,f.LessonTypeCode from ArrangeLessonTerm b left join ClassInfo d on replace(b.TeachClassNo,b.LessonName,'')=d.ClassNo left join LessonInfo e on b.LessonNo=e.LessonNo @@ -2337,7 +2337,7 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les public string LessonTypeName { get; set; } public string LessonTypeCode { get; set; } - + public string LessonOrder { get { return LessonTime.Substring(1); } } } public class Common diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs index 366e8bede..811cdd440 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs @@ -357,15 +357,14 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration public void BindDevice(string classno, string dev) { - var db = this.BaseRepository("CollegeMIS"); try { - var cn = db.FindEntity(x => x.ClassNo == classno); + var cn = this.BaseRepository("CollegeMIS").FindEntity(x => x.ClassNo == classno); if (cn == null) throw new Exception("未找到班级"); if(!cn.DeviceCode.IsEmpty()) throw new Exception("请勿重复邦定!"); cn.DeviceCode = dev; - db.Update(cn); - + this.BaseRepository("CollegeMIS").Update(cn); + } catch (Exception ex) { @@ -382,10 +381,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration public ClassInfoEntity GetClassNoByDevice(string dev) { - var db = this.BaseRepository("CollegeMIS"); try { - var cn = db.FindEntity(x => x.DeviceCode == dev); + var cn = this.BaseRepository("CollegeMIS").FindEntity(x => x.DeviceCode == dev); if (cn == null) throw new Exception("未找到班级"); return cn; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevBLL.cs new file mode 100644 index 000000000..e8b932e6e --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevBLL.cs @@ -0,0 +1,167 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-12-18 10:37 + /// 描 述:课表设备 + /// + public class LessonDevBLL : LessonDevIBLL + { + private LessonDevService lessonDevService = new LessonDevService(); + + #region 获取数据 + + /// + /// 获取列表数据 + /// + /// 查询参数 + /// + public IEnumerable GetList( string queryJson ) + { + try + { + return lessonDevService.GetList(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取列表分页数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return lessonDevService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取实体数据 + /// + /// 主键 + /// + public LessonDevEntity GetEntity(string keyValue) + { + try + { + return lessonDevService.GetEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + lessonDevService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, LessonDevEntity entity) + { + try + { + lessonDevService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public void UnBind(string keyValue) + { + try + { + lessonDevService.UnBind(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevEntity.cs new file mode 100644 index 000000000..32237a0ed --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevEntity.cs @@ -0,0 +1,77 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; +namespace Learun.Application.TwoDevelopment.EducationalAdministration + +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-12-18 10:37 + /// 描 述:课表设备 + /// + public class LessonDevEntity + { + #region 实体成员 + /// + /// Id + /// + /// + [Column("ID")] + public string Id { get; set; } + /// + /// DevCode + /// + /// + [Column("DEVCODE")] + public string DevCode { get; set; } + /// + /// DevBz + /// + /// + [Column("DEVBZ")] + public string DevBz { get; set; } + + [Column("DevPwd")] + public string DevPwd { get; set; } + #endregion + + [NotMapped] + public string ClassNo { get; set; } + + [NotMapped] + public string ClassName { get; set; } + + + + + + + + + + + + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.Id = Guid.NewGuid().ToString(); + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.Id = keyValue; + } + #endregion + + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevIBLL.cs new file mode 100644 index 000000000..d0faf785b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevIBLL.cs @@ -0,0 +1,56 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-12-18 10:37 + /// 描 述:课表设备 + /// + public interface LessonDevIBLL + { + #region 获取数据 + + /// + /// 获取列表数据 + /// + /// 查询参数 + /// + IEnumerable GetList( string queryJson ); + /// + /// 获取列表分页数据 + /// + /// 分页参数 + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取实体数据 + /// + /// 主键 + /// + LessonDevEntity GetEntity(string keyValue); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, LessonDevEntity entity); + #endregion + + void UnBind(string keyValue); + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevService.cs new file mode 100644 index 000000000..b0ad497db --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonDev/LessonDevService.cs @@ -0,0 +1,206 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Text; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2024-12-18 10:37 + /// 描 述:课表设备 + /// + public class LessonDevService : RepositoryFactory + { + #region 构造函数和属性 + + private string fieldSql; + /// + /// 构造方法 + /// + public LessonDevService() + { + fieldSql=@" + t.Id, + t.DevCode, + t.DevBz + "; + } + #endregion + + #region 获取数据 + + /// + /// 获取列表数据 + /// + /// 条件参数 + /// + public IEnumerable GetList( string queryJson ) + { + try + { + //参考写法 + //var queryParam = queryJson.ToJObject(); + // 虚拟参数 + //var dp = new DynamicParameters(new { }); + //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(fieldSql); + strSql.Append(" FROM LessonDev t "); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取列表分页数据 + /// + /// 分页参数 + /// 条件参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT t.*,c.ClassNo,c.ClassName "); + strSql.Append(" FROM LessonDev t left join ClassInfo c on t.DevCode=c.DeviceCode"); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取实体数据 + /// + /// 主键 + /// + public LessonDevEntity GetEntity(string keyValue) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + this.BaseRepository("CollegeMIS").Delete(t=>t.Id == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// 实体 + /// + public void SaveEntity(string keyValue, LessonDevEntity entity) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + this.BaseRepository("CollegeMIS").Update(entity); + } + else + { + entity.Create(); + this.BaseRepository("CollegeMIS").Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + public void UnBind(string keyValue) + { + try + { + var entity= this.BaseRepository("CollegeMIS").FindEntity(x => x.DeviceCode == keyValue); + if (entity == null) throw new Exception("参数错误"); + entity.DeviceCode = string.Empty; + this.BaseRepository("CollegeMIS").Update(entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index f88f256c5..27d78ed4b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -1929,6 +1929,10 @@ + + + +