From dd323d64df44fde0f7e4bdbe831bb45c321bd1c6 Mon Sep 17 00:00:00 2001 From: ndbs Date: Wed, 9 Aug 2023 12:08:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=85=9A=E5=8A=9E=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PartyManageController.cs | 25 +++ .../Views/PartyManage/StatsIndex.cshtml | 51 +++++ .../Views/PartyManage/StatsIndex.js | 186 ++++++++++++++++++ .../Learun.Application.Web.csproj | 2 + .../PartyManage/PartyManageBLL.cs | 18 ++ .../PartyManage/PartyManageEntity.cs | 5 +- .../PartyManage/PartyManageIBLL.cs | 1 + .../PartyManage/PartyManageService.cs | 53 +++++ 8 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyManageController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyManageController.cs index bdad1fee1..b556d0e91 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyManageController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyManageController.cs @@ -37,6 +37,12 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { return View(); } + + [HttpGet] + public ActionResult StatsIndex() + { + return View(); + } #endregion #region 获取数据 @@ -90,6 +96,25 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers var data = partyManageIBLL.GetTree(CType); return Success(data); } + /// + /// 统计数据 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetStatsList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = partyManageIBLL.GetStatsList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.cshtml new file mode 100644 index 000000000..a1a43a5cf --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.cshtml @@ -0,0 +1,51 @@ +@{ + ViewBag.Title = "统计"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
树形列表
+
+
+
+
+
+
+ 列表信息 +
+
+
+
+
+
+
+
+
+
+
标题
+ +
+
+
学年
+
+
+
+
学期
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+@Html.AppendJsFile("/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js new file mode 100644 index 000000000..2064dfd33 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js @@ -0,0 +1,186 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-11-07 14:25 + * 描 述:经费开支申报 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var startTime; + var endTime; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + if (!CType) { + CType = 1; + } + // 初始化左侧树形数据 + $('#dataTree').lrtree({ + url: top.$.rootUrl + '/PersonnelManagement/PartyManage/GetTree?CType=' + CType, + nodeClick: function (item) { + selectedId = item.value; + page.search({ CateId: item.value }); + } + }); + // 时间搜索框 + $('#datesearch').lrdate({ + dfdata: [ + { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } + ], + // 月 + mShow: false, + premShow: false, + // 季度 + jShow: false, + prejShow: false, + // 年 + ysShow: false, + yxShow: false, + preyShow: false, + yShow: false, + // 默认 + dfvalue: '1', + selectfn: function (begin, end) { + startTime = begin; + endTime = end; + if (selectedId) { + page.search({ CateId: selectedId }); + } + } + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + if (selectedId) { + queryJson.CateId = selectedId; + page.search(queryJson); + } + }, 220, 400); + $('#Year').lrselect({ + placeholder: "学年", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', + value: 'value', + text: 'text', + maxHeight: 200, + }); + //学期 + $('#Semester').lrselect({ + placeholder: "学期", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', + value: 'value', + text: 'text' + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/AssetManagementSystem/PartyManage/GetStatsList', + headData: [ + { label: "日期", name: "ApplyTime", width: 150, align: "left" }, + { + label: "申报部门", name: "DeclarationDept", width: 200, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('department', { + key: value, + callback: function (_data) { + callback(_data.name); + } + }); + } + }, + { + label: "申报类别", name: "DeclarationType", width: 200, align: "left" + , formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'DeclarationType', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + { label: "项目内容", name: "ProjectContent", width: 200, align: "left" }, + { label: "数量", name: "Number", width: 200, align: "left" }, + { + label: '单位', name: 'Unit', width: 150, align: 'left', + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'sldw', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + { + label: "单价(元)", name: "Price", width: 200, align: "left", + formatter: function (cellvalue) { + return cellvalue != null && cellvalue != "" && cellvalue != undefined ? cellvalue.toFixed(2) : "0.00"; + } + }, + { + label: "金额(元)", name: "Amount", width: 200, align: "left", statistics: true, + formatter: function (cellvalue) { + return cellvalue != null && cellvalue != "" && cellvalue != undefined ? cellvalue.toFixed(2) : "0.00"; + } + }, + { + label: "固定资产", name: "IsFixedAssets", width: 100, align: "left" + , formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'YesOrNoInt', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + ], + mainId: 'Id', + isPage: true, + sidx: 'ApplyTime desc' + }); + //page.search(); + }, + search: function (param) { + param = param || {}; + param.StartTime = startTime; + param.EndTime = endTime; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + if (selectedId) { + page.search({ CateId: selectedId }); + } + //if (!!res) { + // if (res.code == 200) { + // // 发起流程 + // var postData = { + // schemeCode: 'LC_FundsApply',// 填写流程对应模板编号 + // processId: processId, + // level: '1', + // }; + // learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) { + // learun.loading(false); + // }); + // } + // page.search(); + //} + }; + 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 cab64889d..b9be0e89f 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 @@ -1874,6 +1874,7 @@ + @@ -8180,6 +8181,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageBLL.cs index 13221646a..bea0a0384 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageBLL.cs @@ -42,6 +42,24 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } } + public IEnumerable GetStatsList(Pagination pagination, string queryJson) + { + try + { + return partyManageService.GetStatsList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } /// /// 获取PartyManage表实体数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs index f464658cc..2904d9169 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs @@ -53,9 +53,10 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement public string CType { get; set; } [Column("YEAR")] public string Year { get; set; } - [Column("SEMESTER")] public string Semester { get; set; } + [Column("DEPARTMENT")] + public string Department { get; set; } #endregion @@ -68,6 +69,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement this.ID = Guid.NewGuid().ToString(); this.Createtime = DateTime.Now; this.Creator = LoginUserInfo.Get().userId; + this.Department = LoginUserInfo.Get().departmentId; } /// /// 编辑调用 @@ -76,6 +78,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement public void Modify(string keyValue) { this.ID = keyValue; + this.Updatetime = DateTime.Now; } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageIBLL.cs index 3f92140b6..bd8d2f3dc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageIBLL.cs @@ -21,6 +21,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 查询参数 /// IEnumerable GetPageList(Pagination pagination, string queryJson); + IEnumerable GetStatsList(Pagination pagination, string queryJson); /// /// 获取PartyManage表实体数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs index 3088e069f..651298a39 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs @@ -78,6 +78,59 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + public IEnumerable GetStatsList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@"t.* "); + strSql.Append(" FROM PartyManage t"); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["Year"].IsEmpty()) + { + dp.Add("Year", queryParam["Year"].ToString(), DbType.String); + strSql.Append(" AND t.Year = @Year "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" AND t.Semester = @Semester "); + } + if (!queryParam["Creator"].IsEmpty()) + { + dp.Add("Creator", queryParam["Creator"].ToString(), DbType.String); + strSql.Append(" AND t.Creator = @Creator "); + } + if (!queryParam["CateId"].IsEmpty()) + { + dp.Add("CateId", queryParam["CateId"].ToString(), DbType.String); + strSql.Append(" AND t.CateId = @CateId "); + } + if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) + { + dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); + strSql.Append(" AND ( t.Createtime >= @startTime AND t.Createtime <= @endTime ) "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 获取PartyManage表实体数据 /// From 7a3c5474da6cd64a433f07327d5cf2050c52cfeb Mon Sep 17 00:00:00 2001 From: ndbs Date: Wed, 9 Aug 2023 17:04:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=85=9A=E6=94=BF=E5=8A=9E=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=8A=9F=E8=83=BD=20=E5=B7=B2=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/PartyManage/StatsIndex.cshtml | 4 +- .../Views/PartyManage/StatsIndex.js | 110 +++++------------- .../PartyManage/PartyManageEntity.cs | 7 +- .../PartyManage/PartyManageService.cs | 41 +++---- 4 files changed, 58 insertions(+), 104 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.cshtml index a1a43a5cf..fc14c1551 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.cshtml @@ -19,7 +19,7 @@
-
+ @*
@@ -36,7 +36,7 @@
-
+
*@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js index 2064dfd33..b04fc7b15 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/StatsIndex.js @@ -5,6 +5,8 @@ * 描 述:经费开支申报 */ var refreshGirdData; +var selectedId; +var CType = request('CType'); var bootstrap = function ($, learun) { "use strict"; var startTime; @@ -59,37 +61,36 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); - $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { - if (selectedId) { - queryJson.CateId = selectedId; - page.search(queryJson); - } - }, 220, 400); - $('#Year').lrselect({ - placeholder: "学年", - allowSearch: false, - url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', - value: 'value', - text: 'text', - maxHeight: 200, - }); - //学期 - $('#Semester').lrselect({ - placeholder: "学期", - allowSearch: false, - url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', - value: 'value', - text: 'text' - }); + //$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + // if (selectedId) { + // queryJson.CateId = selectedId; + // page.search(queryJson); + // } + //}, 220, 400); + //$('#Year').lrselect({ + // placeholder: "学年", + // allowSearch: false, + // url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', + // value: 'value', + // text: 'text', + // maxHeight: 200, + //}); + ////学期 + //$('#Semester').lrselect({ + // placeholder: "学期", + // allowSearch: false, + // url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', + // value: 'value', + // text: 'text' + //}); }, // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ - url: top.$.rootUrl + '/AssetManagementSystem/PartyManage/GetStatsList', + url: top.$.rootUrl + '/PersonnelManagement/PartyManage/GetStatsList', headData: [ - { label: "日期", name: "ApplyTime", width: 150, align: "left" }, { - label: "申报部门", name: "DeclarationDept", width: 200, align: "left", + label: "申报部门", name: "Department", width: 200, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('department', { key: value, @@ -99,62 +100,15 @@ var bootstrap = function ($, learun) { }); } }, - { - label: "申报类别", name: "DeclarationType", width: 200, align: "left" - , formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('dataItem', { - key: value, - code: 'DeclarationType', - callback: function (_data) { - callback(_data.text); - } - }); - } - }, - { label: "项目内容", name: "ProjectContent", width: 200, align: "left" }, - { label: "数量", name: "Number", width: 200, align: "left" }, - { - label: '单位', name: 'Unit', width: 150, align: 'left', - formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('dataItem', { - key: value, - code: 'sldw', - callback: function (_data) { - callback(_data.text); - } - }); - } - }, - { - label: "单价(元)", name: "Price", width: 200, align: "left", - formatter: function (cellvalue) { - return cellvalue != null && cellvalue != "" && cellvalue != undefined ? cellvalue.toFixed(2) : "0.00"; - } - }, - { - label: "金额(元)", name: "Amount", width: 200, align: "left", statistics: true, - formatter: function (cellvalue) { - return cellvalue != null && cellvalue != "" && cellvalue != undefined ? cellvalue.toFixed(2) : "0.00"; - } - }, - { - label: "固定资产", name: "IsFixedAssets", width: 100, align: "left" - , formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('dataItem', { - key: value, - code: 'YesOrNoInt', - callback: function (_data) { - callback(_data.text); - } - }); - } - }, + { label: "总人数", name: "Num", width: 200, align: "left", statistics: true }, + { label: "上传人数", name: "Number", width: 200, align: "left", statistics: true }, + { label: '未上传人数', name: 'Unit', width: 150, align: 'left', statistics: true }, ], - mainId: 'Id', + mainId: 'Department', isPage: true, - sidx: 'ApplyTime desc' + sidx: 'Department desc' }); - //page.search(); + page.search(); }, search: function (param) { param = param || {}; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs index 2904d9169..d2cdb88d2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs @@ -59,7 +59,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement public string Department { get; set; } #endregion - + [NotMapped] + public int Num { get; set; } + [NotMapped] + public int Number { get; set; } + [NotMapped] + public int cha { get; set; } #region 扩展操作 /// /// 新增调用 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs index 651298a39..6c33b869d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs @@ -82,41 +82,36 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { try { + var baseDataName = this.BaseRepository().getDbConnection().Database; + var baseDataName1 = this.BaseRepository("CollegeMIS").getDbConnection().Database; + var strSql = new StringBuilder(); - strSql.Append("SELECT "); - strSql.Append(@"t.* "); - strSql.Append(" FROM PartyManage t"); - strSql.Append(" WHERE 1=1 "); + strSql.Append($" select zb.F_DepartmentId as Department, COALESCE (aa.num, 0) num ,COALESCE (bb.number, 0) number from (select* from {baseDataName}.dbo.LR_Base_Department where f_companyid ='06890807-2106-4e6d-9f99-484527503be9') zb "); + strSql.Append($" left join(select F_DepartmentId,count(*) as num from {baseDataName}.dbo.LR_Base_User group by F_DepartmentId ) aa on aa.F_DepartmentId =zb.F_DepartmentId"); + strSql.Append($" left join (select Department,count(*) as number from {baseDataName1}.dbo.PartyManage where 1=1 "); var queryParam = queryJson.ToJObject(); - // 虚拟参数 var dp = new DynamicParameters(new { }); - if (!queryParam["Year"].IsEmpty()) - { - dp.Add("Year", queryParam["Year"].ToString(), DbType.String); - strSql.Append(" AND t.Year = @Year "); - } - if (!queryParam["Semester"].IsEmpty()) - { - dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); - strSql.Append(" AND t.Semester = @Semester "); - } - if (!queryParam["Creator"].IsEmpty()) - { - dp.Add("Creator", queryParam["Creator"].ToString(), DbType.String); - strSql.Append(" AND t.Creator = @Creator "); - } if (!queryParam["CateId"].IsEmpty()) { dp.Add("CateId", queryParam["CateId"].ToString(), DbType.String); - strSql.Append(" AND t.CateId = @CateId "); + strSql.Append(" AND CateId = @CateId "); } if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) { dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); - strSql.Append(" AND ( t.Createtime >= @startTime AND t.Createtime <= @endTime ) "); + strSql.Append(" AND ( Createtime >= @startTime AND Createtime <= @endTime ) "); } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + strSql.Append($" group by Department) bb on bb.Department= zb.F_DepartmentId "); + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + if (data != null) + { + foreach (var item in data) + { + item.cha = item.Num - item.Number; + } + } + return data; } catch (Exception ex) {