From 2a3fd3460d8e32148fc785488c531865c300b9b6 Mon Sep 17 00:00:00 2001 From: ndbs Date: Fri, 11 Oct 2024 17:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=8E=92=E6=9F=A5=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Learun.Application.WebApi.csproj | 4 +- .../SafetyCheckApi.cs | 158 ++++++++++++++++++ .../SafetyCheck/SafetyCheckService.cs | 18 ++ 3 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/SafetyCheckApi.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj index 297ea7b3f..4519a993b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj @@ -22,7 +22,8 @@ ..\ true - false + + @@ -194,6 +195,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/SafetyCheckApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/SafetyCheckApi.cs new file mode 100644 index 000000000..ce208633a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/SafetyCheckApi.cs @@ -0,0 +1,158 @@ +using Nancy; +using Learun.Util; +using System.Collections.Generic; +using System; +using Learun.Application.TwoDevelopment.EducationalAdministration; + +namespace Learun.Application.WebApi +{ + /// + /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 + /// Copyright (c) 2013-2018 北京泉江科技有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-12-25 14:53 + /// 描 述:日程安排 + /// + public class SafetyCheckApi : BaseApi + { + private SafetyCheckIBLL SafetyCheckIBLL = new SafetyCheckBLL(); + + /// + /// 注册接口 + /// + public SafetyCheckApi() + : base("/Learun/adms/EducationalAdministration/SafetyCheck") + { + Get["/pagelist"] = GetPageList; + Get["/form"] = GetForm; + Post["/delete"] = DeleteForm; + Post["/save"] = SaveForm; + Post["/submit"] = SubmitForm; + Post["/department"] = DepartmentForm; + } + #region 获取数据 + + /// + /// 获取页面显示列表分页数据 + /// + /// + /// + public Response GetPageList(dynamic _) + { + ReqPageParam parameter = this.GetReqData(); + var data = SafetyCheckIBLL.GetPageList(parameter.pagination, parameter.queryJson); + var jsonData = new + { + rows = data, + total = parameter.pagination.total, + page = parameter.pagination.page, + records = parameter.pagination.records + }; + return Success(jsonData); + } + ///// + ///// 获取页面显示列表数据 + ///// + ///// + ///// + //public Response GetList(dynamic _) + //{ + // string queryJson = this.GetReqData(); + // var data = SafetyCheckIBLL.GetList(); + // return Success(data); + //} + /// + /// 获取表单数据 + /// + /// + /// + public Response GetForm(dynamic _) + { + string keyValue = this.GetReqData(); + var SafetyCheckData = SafetyCheckIBLL.GetSafetyCheckEntity(keyValue); + + var jsonData = new + { + SafetyCheck = SafetyCheckData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// + /// + public Response DeleteForm(dynamic _) + { + string keyValue = this.GetReqData(); + SafetyCheckIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// + /// + public Response SaveForm(dynamic _) + { + ReqFormEntity parameter = this.GetReqData(); + SafetyCheckEntity entity = parameter.strEntity.ToObject(); + SafetyCheckIBLL.SaveEntity(parameter.keyValue, entity); + return Success("保存成功!"); + } + /// + /// 提交 + /// + /// + /// + public Response SubmitForm(dynamic _) + { + string keyValue = this.GetReqData(); + SafetyCheckIBLL.SubmitEnity(keyValue); + return Success("提交成功!"); + } + /// + /// 部门/分管-安全办 + /// + /// + /// + public Response DepartmentForm(dynamic _) + { + ReqFormEntity parameter = this.GetReqData(); + SafetyCheckEntity entity = parameter.strEntity.ToObject(); + if (entity.Status == 1) + { + entity.Status = 2; + } + else if (entity.Status == 2) + { + entity.Status = 3; + } + else + { + entity.Status = 0; + } + SafetyCheckIBLL.SaveEntity(parameter.keyValue, entity); + return Success("操作成功!"); + } + + #endregion + + #region 私有类 + + /// + /// 表单实体类 + /// + private class ReqFormEntity + { + public string keyValue { get; set; } + public string strEntity { get; set; } + } + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SafetyCheck/SafetyCheckService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SafetyCheck/SafetyCheckService.cs index 7c570f263..b7cf97513 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SafetyCheck/SafetyCheckService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SafetyCheck/SafetyCheckService.cs @@ -90,6 +90,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 获取列表 + /// + /// 返回列表 + public IEnumerable GetList() + { + try + { + return this.BaseRepository().FindList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + throw; + else + throw ExceptionEx.ThrowServiceException(ex); + } + } /// /// 获取SafetyCheck表实体数据 ///