diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextBookInfoController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextBookInfoController.cs new file mode 100644 index 000000000..409f87055 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextBookInfoController.cs @@ -0,0 +1,166 @@ +using System; +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using System.Web.Mvc; +using System.Collections.Generic; +using NPOI.SS.Util; + +namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-01-24 12:19 + /// 描 述:教材信息管理 + /// + public class TextBookInfoController : MvcControllerBase + { + private TextBookInfoIBLL textBookInfoIBLL = new TextBookInfoBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = textBookInfoIBLL.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 TextBookInfoData = textBookInfoIBLL.GetTextBookInfoEntity(keyValue); + var jsonData = new + { + TextBookInfo = TextBookInfoData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + textBookInfoIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue, string strEntity) + { + TextBookInfoEntity entity = strEntity.ToObject(); + + if (string.IsNullOrEmpty(keyValue)) + { + entity.IsValid = true; + entity.IsDel = 0; + } + else + { + entity.UpdateUserID = LoginUserInfo.Get().userId; + entity.Updatetime = DateTime.Now; + } + + var RepetitionList = textBookInfoIBLL.GetRepetitions(keyValue, entity.TextBookNo, entity.TextBookName, entity.PublishNo, entity.DeptNo, entity.Publisher, entity.TextBookNature, entity.TextBookType, entity.Edition, entity.Impression); + + if (RepetitionList != null) + { + return Fail("保存失败请检查数据有重复项!"); + } + else + { + textBookInfoIBLL.SaveEntity(keyValue, entity); + return Success("保存成功!"); + } + } + #endregion + + #region 扩展数据 + + /// + /// 启用 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult EnableEntity(string keyValue, string IsValid) + { + textBookInfoIBLL.EnabOrDisabEntity(keyValue, IsValid); + return Success("启用成功!"); + } + + /// + /// 禁用 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DisableEntity(string keyValue, string IsValid) + { + textBookInfoIBLL.EnabOrDisabEntity(keyValue, IsValid); + return Success("禁用成功!"); + } + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Form.cshtml new file mode 100644 index 000000000..916f95168 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Form.cshtml @@ -0,0 +1,79 @@ +@{ + ViewBag.Title = "教材信息管理"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
教材号*
+ +
+
+
教材名称
+ +
+
+
出版号*
+ +
+
+
专业部*
+
+
+
+
第一作者*
+ +
+
+
其他作者
+ +
+
+
出版日期*
+ +
+
+
出版社*
+ +
+
+
教材类型*
+
+
+
+
教材性质*
+
+
+
+
价格
+ +
+
+
版次
+ +
+
+
印次
+ +
+
+
是否有练习册
+
+
+
+
是否有教参教辅
+
+
+
+
内容简介
+ +
+ + +
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookInfo/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Form.js new file mode 100644 index 000000000..8a332f07e --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Form.js @@ -0,0 +1,58 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-01-24 12:19 + * 描 述:教材信息管理 + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); + $('#TextBookType').lrDataItemSelect({ code: 'TextBookType' }); + $('#TextBookNature').lrDataItemSelect({ code: 'TextBookNature' }); + $('#IsWorkBook').lrDataItemSelect({ code: 'YesOrNoBit' }); + $('#IsTeachConsult').lrDataItemSelect({ code: 'YesOrNoBit' }); + $('#CreateUserID')[0].lrvalue = learun.clientdata.get(['userinfo']).userId; + $('#CreateUserID').val(learun.clientdata.get(['userinfo']).realName); + $('#Createdate').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/GetFormData?keyValue=' + keyValue, function (data) { + for (var id in data) { + if (!!data[id].length && data[id].length > 0) { + $('#' + id).jfGridSet('refreshdata', data[id]); + } + else { + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var postData = { + strEntity: JSON.stringify($('body').lrGetFormData()) + }; + $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Index.cshtml new file mode 100644 index 000000000..c7da16f10 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Index.cshtml @@ -0,0 +1,50 @@ +@{ + ViewBag.Title = "教材信息管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
教材名称
+ +
+
+
专业部
+
+
+
+
教材类型
+
+
+
+
教材性质
+
+
+
+
+
+
+ +
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookInfo/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Index.js new file mode 100644 index 000000000..68db657bc --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TextBookInfo/Index.js @@ -0,0 +1,243 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-01-24 12:19 + * 描 述:教材信息管理 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); + $('#TextBookType').lrDataItemSelect({ code: 'TextBookType' }); + $('#TextBookNature').lrDataItemSelect({ code: 'TextBookNature' }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/Form', + width: 800, + height: 500, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + if (keyValue.indexOf(',') != -1) { + learun.alert.warning("只能选择一条记录进行编辑!"); + return; + } + var IsValid = $('#gridtable').jfGridValue('IsValid'); + if (IsValid == "true") { + learun.alert.warning("选中记录中包含已启用项目,已启用项不可编辑!"); + return; + } + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/Form?keyValue=' + keyValue, + width: 800, + height: 500, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + var IsValid = $('#gridtable').jfGridValue('IsValid'); + if (IsValid.indexOf('true') != -1) { + learun.alert.warning("选中记录中包含已启用项目,已启用项不能删除!"); + return; + } + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + //启用 + $('#lr_enabled').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + var IsValid = $('#gridtable').jfGridValue('IsValid'); + if (IsValid.indexOf('true') != -1) { + learun.alert.warning("选中记录中包含已启用项!"); + return; + } + learun.layerConfirm('是否确认启用选中项?', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/EnableEntity', { keyValue: keyValue, IsValid: '1' }, function () { + refreshGirdData(); + }); + } + }); + } + }); + //禁用 + $('#lr_disabled').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + var IsValid = $('#gridtable').jfGridValue('IsValid'); + if (IsValid.indexOf('false') != -1) { + learun.alert.warning("选中记录中包含已启用项!"); + return; + } + learun.layerConfirm('是否确认禁用选中项?', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/DisableEntity', { keyValue: keyValue, IsValid: '0' }, function () { + refreshGirdData(); + }); + } + }); + } + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').lrAuthorizeJfGrid({ + url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/GetPageList', + headData: [ + { label: "教材号", name: "TextBookNo", width: 150, align: "left" }, + { label: "教材名称", name: "TextBookName", width: 150, align: "left" }, + { label: "出版号", name: "PublishNo", width: 100, align: "left" }, + { + label: "专业部", name: "DeptNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + key: value, + keyId: 'deptno', + callback: function (_data) { + callback(_data['deptname']); + } + }); + } + }, + { label: "第一作者", name: "FirstAuthor", width: 100, align: "left" }, + { label: "其他作者", name: "OtherAuthor", width: 100, align: "left" }, + { + label: "出版日期", name: "Pubdate", width: 80, align: "left", + formatter: function (value) { + return learun.formatDate(value, 'yyyy-MM-dd'); + } + }, + { label: "出版社", name: "Publisher", width: 100, align: "left" }, + { + label: "教材类型", name: "TextBookType", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'TextBookType', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + { + label: "教材性质", name: "TextBookNature", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'TextBookNature', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + { label: "价格", name: "Price", width: 60, align: "left" }, + { label: "版次", name: "Edition", width: 100, align: "left" }, + { label: "印次", name: "Impression", width: 100, align: "left" }, + { + label: "是否有练习册", name: "IsWorkBook", width: 100, align: "left", + formatter: function (cellvalue) { + return cellvalue == true ? "" : + ""; + } + }, + { + label: "是否有教参教辅", name: "IsTeachConsult", width: 100, align: "left", + formatter: function (cellvalue) { + return cellvalue == true ? "" : + ""; + } + }, + { label: "内容简介", name: "Description", width: 100, align: "left" }, + { + label: "录入用户", name: "CreateUserID", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('user', { + key: value, + callback: function (_data) { + callback(_data.name); + } + }); + } + }, + { label: "录入时间", name: "Createdate", width: 100, align: "left" }, + { + label: "修改用户", name: "UpdateUserID", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('user', { + key: value, + callback: function (_data) { + callback(_data.name); + } + }); + } + }, + { label: "修改时间", name: "Updatetime", width: 100, align: "left" }, + { + label: "是否有效", name: "IsValid", width: 80, align: "center", + formatter: function (cellvalue) { + return cellvalue == true ? "" : ""; + } + } + ], + mainId: 'ID', + isPage: true, + isMultiselect: true, + sidx: 'Createdate desc' + }); + page.search(); + }, + search: function (param) { + param = param || {}; + param.SqlParameter = " and Isdel = '0' "; + $('#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 004135c32..2f97830e9 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 @@ -836,6 +836,7 @@ + @@ -6630,6 +6631,10 @@ + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextBookInfoMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextBookInfoMap.cs new file mode 100644 index 000000000..c746a0501 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/EducationalAdministration/TextBookInfoMap.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 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-01-24 12:19 + /// 描 述:教材信息管理 + /// + public class TextBookInfoMap : EntityTypeConfiguration + { + public TextBookInfoMap() + { + #region 表、主键 + //表 + this.ToTable("TEXTBOOKINFO"); + //主键 + 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 f285e3c01..063196420 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 @@ -590,6 +590,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoBLL.cs new file mode 100644 index 000000000..6bca1c47c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoBLL.cs @@ -0,0 +1,169 @@ +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 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-01-24 12:19 + /// 描 述:教材信息管理 + /// + public class TextBookInfoBLL : TextBookInfoIBLL + { + private TextBookInfoService textBookInfoService = new TextBookInfoService(); + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return textBookInfoService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取TextBookInfo表实体数据 + /// + /// 主键 + /// + public TextBookInfoEntity GetTextBookInfoEntity(string keyValue) + { + try + { + return textBookInfoService.GetTextBookInfoEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + textBookInfoService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveEntity(string keyValue, TextBookInfoEntity entity) + { + try + { + textBookInfoService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 扩展数据 + /// + /// 启用或禁用 + /// + /// 主键 + /// 状态 + public void EnabOrDisabEntity(string keyValue, string IsValid) + { + try + { + textBookInfoService.EnabOrDisabEntity(keyValue, IsValid); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion + + public TextBookInfoEntity GetRepetitions(string keyValue, string TextBookNo, string TextBookName, string PublishNo, string DeptNo, string Publisher, string TextBookNature, string TextBookType, string Edition, string Impression) + { + try + { + return textBookInfoService.GetRepetitions(keyValue, TextBookNo, TextBookName, PublishNo, DeptNo, Publisher, TextBookNature, TextBookType, Edition, Impression); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoEntity.cs new file mode 100644 index 000000000..de827f00f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoEntity.cs @@ -0,0 +1,155 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-01-24 12:19 + /// 描 述:教材信息管理 + /// + public class TextBookInfoEntity + { + #region 实体成员 + /// + /// ID + /// + [Column("ID")] + public string ID { get; set; } + /// + /// 专业部 + /// + [Column("DEPTNO")] + public string DeptNo { get; set; } + /// + /// 教材号 + /// + [Column("TEXTBOOKNO")] + public string TextBookNo { get; set; } + /// + /// 教材名称 + /// + [Column("TEXTBOOKNAME")] + public string TextBookName { get; set; } + /// + /// 出版号 + /// + [Column("PUBLISHNO")] + public string PublishNo { get; set; } + /// + /// 第一作者 + /// + [Column("FIRSTAUTHOR")] + public string FirstAuthor { get; set; } + /// + /// 其他作者 + /// + [Column("OTHERAUTHOR")] + public string OtherAuthor { get; set; } + /// + /// 出版日期 + /// + [Column("PUBDATE")] + public DateTime? Pubdate { get; set; } + /// + /// 出版社 + /// + [Column("PUBLISHER")] + public string Publisher { get; set; } + /// + /// 教材类型 + /// + [Column("TEXTBOOKTYPE")] + public string TextBookType { get; set; } + /// + /// 教材性质 + /// + [Column("TEXTBOOKNATURE")] + public string TextBookNature { get; set; } + /// + /// 价格 + /// + [Column("PRICE")] + public decimal? Price { get; set; } + /// + /// 版次 + /// + [Column("EDITION")] + public string Edition { get; set; } + /// + /// 印次 + /// + [Column("IMPRESSION")] + public string Impression { get; set; } + /// + /// 是否有练习册 + /// + [Column("ISWORKBOOK")] + public bool? IsWorkBook { get; set; } + /// + /// 是否有教参教辅 + /// + [Column("ISTEACHCONSULT")] + public bool? IsTeachConsult { get; set; } + /// + /// 内容简介 + /// + [Column("DESCRIPTION")] + public string Description { get; set; } + /// + /// 是否有效 + /// + [Column("ISVALID")] + public bool? IsValid { get; set; } + /// + /// Createdate + /// + [Column("CREATEDATE")] + public DateTime? Createdate { get; set; } + /// + /// Updatetime + /// + [Column("UPDATETIME")] + public DateTime? Updatetime { get; set; } + /// + /// CreateUserID + /// + [Column("CREATEUSERID")] + public string CreateUserID { get; set; } + /// + /// UpdateUserID + /// + [Column("UPDATEUSERID")] + public string UpdateUserID { get; set; } + /// + /// 删除 0 1 + /// + public int? IsDel { get; set; } + + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.ID = Guid.NewGuid().ToString(); + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.ID = keyValue; + } + #endregion + #region 扩展字段 + #endregion + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoIBLL.cs new file mode 100644 index 000000000..4754bc473 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoIBLL.cs @@ -0,0 +1,69 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-01-24 12:19 + /// 描 述:教材信息管理 + /// + public interface TextBookInfoIBLL + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取TextBookInfo表实体数据 + /// + /// 主键 + /// + TextBookInfoEntity GetTextBookInfoEntity(string keyValue); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, TextBookInfoEntity entity); + #endregion + + #region 扩展数据 + /// + /// 启用或禁用 + /// + /// + /// + void EnabOrDisabEntity(string keyValue, string IsValid); + /// + /// + /// + /// 名称 + /// 出版号 + /// 专业部 + /// + /// + /// + /// 版次 + /// + TextBookInfoEntity GetRepetitions(string keyValue,string TextBookNo, string TextBookName, string PublishNo, string DeptNo, string Publisher, string TextBookNature, string TextBookType, string Edition, string Impression); + + #endregion + } +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoService.cs new file mode 100644 index 000000000..5d78e1ce4 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextBookInfo/TextBookInfoService.cs @@ -0,0 +1,255 @@ +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 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-01-24 12:19 + /// 描 述:教材信息管理 + /// + public class TextBookInfoService : RepositoryFactory + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" * "); + strSql.Append(" FROM TextBookInfo t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["TextBookName"].IsEmpty()) + { + dp.Add("TextBookName", "%" + queryParam["TextBookName"].ToString() + "%", DbType.String); + strSql.Append(" AND t.TextBookName Like @TextBookName "); + } + if (!queryParam["DeptNo"].IsEmpty()) + { + dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String); + strSql.Append(" AND t.DeptNo = @DeptNo "); + } + if (!queryParam["TextBookType"].IsEmpty()) + { + dp.Add("TextBookType", queryParam["TextBookType"].ToString(), DbType.String); + strSql.Append(" AND t.TextBookType = @TextBookType "); + } + if (!queryParam["TextBookNature"].IsEmpty()) + { + dp.Add("TextBookNature", queryParam["TextBookNature"].ToString(), DbType.String); + strSql.Append(" AND t.TextBookNature = @TextBookNature "); + } + + if (!queryParam["SqlParameter"].IsEmpty()) + { + strSql.Append(queryParam["SqlParameter"].ToString()); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取TextBookInfo表实体数据 + /// + /// 主键 + /// + public TextBookInfoEntity GetTextBookInfoEntity(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) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + var keyValueArr = keyValue.Split(','); + foreach (var item in keyValueArr) + { + var entity = BaseRepository("CollegeMIS").FindEntity(x => x.ID == item); + entity.IsDel = 1; + db.Update(entity); + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, TextBookInfoEntity 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 + + #region 扩展数据 + /// + /// 启用或禁用 + /// + /// + public void EnabOrDisabEntity(string keyValue, string IsValid) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + var keyValueArr = keyValue.Split(','); + foreach (var item in keyValueArr) + { + var entity = BaseRepository("CollegeMIS").FindEntity(x => x.ID == item); + entity.IsValid = IsValid.ToString() == "1" ? true : false; + db.Update(entity); + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// + /// 去重 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public TextBookInfoEntity GetRepetitions(string keyValue, string TextBookNo, string TextBookName, string PublishNo, string DeptNo, string Publisher, string TextBookNature, string TextBookType, string Edition, string Impression) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + return this.BaseRepository("CollegeMIS").FindEntity( + x => x.ID != keyValue && x.TextBookNo == TextBookNo && x.TextBookName == TextBookName && x.PublishNo == PublishNo && + x.DeptNo == DeptNo && x.PublishNo == Publisher && x.TextBookNature == TextBookNature && x.TextBookType == TextBookType + && x.Edition == Edition && x.Impression == Impression && x.IsDel == 0); + } + else + { + return this.BaseRepository("CollegeMIS").FindEntity( + x => x.TextBookNo == TextBookNo && x.TextBookName == TextBookName && x.PublishNo == PublishNo && + x.DeptNo == DeptNo && x.PublishNo == Publisher && x.TextBookNature == TextBookNature && x.TextBookType == TextBookType + && x.Edition == Edition && x.Impression == Impression && x.IsDel == 0); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + } +} 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 4da072d09..66eff34c6 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 @@ -1790,6 +1790,10 @@ + + + +