From 1af14285dffcc2191876d76dfe9bc736419102fb Mon Sep 17 00:00:00 2001 From: ndbs Date: Fri, 24 Nov 2023 18:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=AE=AF=E5=BD=95=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 | 1 + .../AddressBookApi.cs | 116 ++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/AddressBookApi.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 9d30b0df7..6d9d294f2 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 @@ -195,6 +195,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/AddressBookApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/AddressBookApi.cs new file mode 100644 index 000000000..9e607798c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EducationalAdministration/AddressBookApi.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Util; +using Nancy; + +namespace Learun.Application.WebApi.Modules +{ + /// + /// 通讯录 + /// + public class AddressBookApi : BaseApi + { + public AddressBookApi() + : base("/Learun/adms/PersonnelManagement/AddressBook") + { + Get["/pagelist"] = GetPageList; + Get["/list"] = GetList; + Get["/form"] = GetForm; + Post["/delete"] = DeleteForm; + Post["/save"] = SaveForm; + } + + private AddressBookIBLL addressBookIBLL = new AddressBookBLL(); + + #region 获取数据 + + /// + /// 获取页面显示列表分页数据 + /// + /// + /// + public Response GetPageList(dynamic _) + { + ReqPageParam parameter = this.GetReqData(); + var data = addressBookIBLL.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 = addressBookIBLL.GetList(queryJson); + return Success(data); + } + /// + /// 获取表单数据 + /// + /// + /// + public Response GetForm(dynamic _) + { + string keyValue = this.GetReqData(); + var ClassWorkData = addressBookIBLL.GetEntity(keyValue); + var jsonData = new + { + ClassWork = ClassWorkData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// + /// + public Response DeleteForm(dynamic _) + { + string keyValue = this.GetReqData(); + addressBookIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// + /// + public Response SaveForm(dynamic _) + { + ReqFormEntity parameter = this.GetReqData(); + AddressBookEntity entity = parameter.strEntity.ToObject(); + addressBookIBLL.SaveEntity(parameter.keyValue, entity); + return Success("保存成功!"); + } + #endregion + + #region 私有类 + + /// + /// 表单实体类 + /// + private class ReqFormEntity + { + public string keyValue { get; set; } + public string strEntity { get; set; } + } + #endregion + + } +} \ No newline at end of file