From 6dbc8abef07e0a693dbb5612ca333585f2a56bc9 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Fri, 17 Sep 2021 11:57:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=86=8C=E8=B5=84=E4=BA=A7=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ass_AssetsInfoItemController.cs | 114 +++++++++++++++- .../Views/Ass_AssetsInfoItem/Index.cshtml | 1 + .../Views/Ass_AssetsInfoItem/Index.js | 27 +++- .../SystemModule/DataItem/DataItemBLL.cs | 19 +++ .../SystemModule/DataItem/DataItemIBLL.cs | 1 + .../SystemModule/DataItem/DataItemService.cs | 32 +++++ .../SystemModule/DataSource/DataSourceBLL.cs | 45 +++++++ .../SystemModule/DataSource/DataSourceIBLL.cs | 1 + .../Ass_AssetsInfoItemBLL.cs | 20 +++ .../Ass_AssetsInfoItemIBLL.cs | 1 + .../Ass_AssetsInfoItemService.cs | 127 ++++++++++++++++++ 11 files changed, 386 insertions(+), 2 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/Ass_AssetsInfoItemController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/Ass_AssetsInfoItemController.cs index ddc8063ee..f84ff25c6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/Ass_AssetsInfoItemController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/Ass_AssetsInfoItemController.cs @@ -1,8 +1,12 @@ -using Learun.Util; +using System; +using Learun.Util; using System.Data; using Learun.Application.TwoDevelopment.AssetManagementSystem; using System.Web.Mvc; using System.Collections.Generic; +using System.Linq; +using Learun.Application.Base.SystemModule; +using Learun.Application.Organization; namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers { @@ -16,6 +20,9 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers public class Ass_AssetsInfoItemController : MvcControllerBase { private Ass_AssetsInfoItemIBLL ass_AssetsInfoItemIBLL = new Ass_AssetsInfoItemBLL(); + private DataItemIBLL dataItemIBLL = new DataItemBLL(); + private DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); + private DepartmentIBLL departmentIBLL = new DepartmentBLL(); #region 视图功能 @@ -92,6 +99,111 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers }; return Success(jsonData); } + + /// + /// 导出 + /// + /// 查询参数 + /// + [HttpPost, ValidateInput(false)] + public ActionResult ExportList(string queryJson) + { + var exportTable = ass_AssetsInfoItemIBLL.GetExportList(queryJson); + //exportTable.Columns.Add("REnabledName", typeof(string)); + //exportTable.Columns.Add("AIASSStateName", typeof(string)); + + var dataItem_REnabled = dataItemIBLL.GetDetailList("RoomState"); + var dataItem_sldw = dataItemIBLL.GetDetailList("sldw"); + var dataItem_AssState = dataItemIBLL.GetDetailList("AssState"); + var departmentList = departmentIBLL.GetAllList(); + var dataSourceEntity = dataSourceIBLL.GetEntityByCode("BaseUser"); + for (int i = 0; i < exportTable.Rows.Count; i++) + { + var REnabled = exportTable.Rows[i]["REnabled"]; + if (REnabled != null && !string.IsNullOrEmpty(REnabled.ToString())) + { + exportTable.Rows[i]["renabledname"] = dataItem_REnabled.Where(x => x.F_ItemValue == REnabled.ToString()).FirstOrDefault()?.F_ItemName; + } + + var AIUnits = exportTable.Rows[i]["AIUnits"]; + if (AIUnits != null && !string.IsNullOrEmpty(AIUnits.ToString())) + { + exportTable.Rows[i]["AIUnits"] = dataItem_sldw.FirstOrDefault(x => x.F_ItemValue == AIUnits.ToString())?.F_ItemName; + } + + + var AIASSState = exportTable.Rows[i]["AIASSState"]; + if (AIASSState != null && !string.IsNullOrEmpty(AIASSState.ToString())) + { + exportTable.Rows[i]["AIASSStateName"] = dataItem_AssState.FirstOrDefault(x => x.F_ItemValue == AIASSState.ToString())?.F_ItemName; + } + + var AIDepartment = exportTable.Rows[i]["AIDepartment"]; + if (AIDepartment != null && !string.IsNullOrEmpty(AIDepartment.ToString())) + { + exportTable.Rows[i]["AIDepartment"] = + departmentList.FirstOrDefault(x => x.F_DepartmentId == AIDepartment.ToString())?.F_FullName; + } + + var AIUsePeople = exportTable.Rows[i]["AIUsePeople"]; + if (AIUsePeople != null && !string.IsNullOrEmpty(AIUsePeople.ToString())) + { + exportTable.Rows[i]["AIUsePeople"] = dataSourceIBLL.GetDataTable(dataSourceEntity, + "t.f_userid='" + AIUsePeople.ToString() + "'"); + } + + } + departmentList = null; + + //设置导出格式 + ExcelConfig excelconfig = new ExcelConfig(); + //excelconfig.Title = " 资产数据"; + excelconfig.TitleFont = "微软雅黑"; + excelconfig.TitlePoint = 20; + excelconfig.FileName = "在册登记资产数据导出.xls"; + excelconfig.IsAllSizeColumn = true; + excelconfig.ColumnEntity = new List(); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aicodenumjy", ExcelColumn = "资产编号" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiistoragename", ExcelColumn = "楼宇名称" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "rcode", ExcelColumn = "房间号" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "rfunction", ExcelColumn = "房间功能" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "rarea", ExcelColumn = "房间面积" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "renabledname", ExcelColumn = "房间状态" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiassname", ExcelColumn = "资产名称" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aispecification", ExcelColumn = "资产品牌" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aispecificationtype", ExcelColumn = "规格型号" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiunits", ExcelColumn = "计量单位" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiassstatename", ExcelColumn = "资产状态" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aidepartment", ExcelColumn = "管理部门" }); + + + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiusepeople", ExcelColumn = "使用人" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiplace", ExcelColumn = "存放地点" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiassvalue", ExcelColumn = "资产原价值" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiaddtime", ExcelColumn = "购置日期" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "airemark", ExcelColumn = "备注" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "depreciationmethod", ExcelColumn = "折旧方法" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "depreciationstatus", ExcelColumn = "折旧状态" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "usefullife", ExcelColumn = "折旧年限" }); + + + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "monthlydepreciation", ExcelColumn = "月折旧额" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "monthsofdepreciation", ExcelColumn = "已提折旧月数" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "monthlydepreciationrate", ExcelColumn = "月折旧率" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "accumulateddepreciation", ExcelColumn = "累计折旧" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "networth", ExcelColumn = "净值" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "vehiclelicenseuser", ExcelColumn = "车辆行驶证所有人" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aivehiclenumber", ExcelColumn = "车辆识别号" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiplatenumber", ExcelColumn = "车牌号" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aibuiltarea", ExcelColumn = "面积" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "aiownership", ExcelColumn = "权属证号" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "landusetype", ExcelColumn = "土地使用权类型" }); + excelconfig.ColumnEntity.Add(new ColumnModel() { Column = "landuseuser", ExcelColumn = "土地使用权人/房屋所有权人" }); + //调用导出方法 + ExcelHelper.ExcelDownload(exportTable, excelconfig); + return Success("导出成功"); + } + /// /// 获取左侧树形数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsInfoItem/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsInfoItem/Index.cshtml index 0d694dc94..f5448a3fe 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsInfoItem/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsInfoItem/Index.cshtml @@ -95,6 +95,7 @@  报废  查看出入记录  查看使用人员记录 +  导出 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsInfoItem/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsInfoItem/Index.js index 6c2f81ac6..baf86fe58 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsInfoItem/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsInfoItem/Index.js @@ -9,6 +9,7 @@ var AId = request("AId"); var TreeAIASSClass = ''; var currentUser = request("currentUser");//我的资产需要用到 var IsDelete = request("IsDelete");//报废资产需要使用 +var exportWhere = ''; var bootstrap = function ($, learun) { "use strict"; var page = { @@ -41,6 +42,7 @@ var bootstrap = function ($, learun) { } }); $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + exportWhere = queryJson; page.search(queryJson); }, 500, 400); $('#AIIStorageId').lrselect({ @@ -215,7 +217,11 @@ var bootstrap = function ($, learun) { }); } }); - + + + $('#lr_exportexcel').on('click', function () { + page.exportExcel(); + }); }, // 初始化列表 initGird: function () { @@ -470,6 +476,25 @@ var bootstrap = function ($, learun) { } param.AIIsScrap = false; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + }, + exportExcel: function () { + + var param = exportWhere || {}; + param.AId = AId; + param.AIASSClass = TreeAIASSClass; + if (currentUser) { + var userInfo = top.learun.clientdata.get(['userinfo']); + param.userId = userInfo.userId; + } + param.AIIsScrap = false; + learun.download({ + method: "POST", + url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/ExportList', + param: { + queryJson: JSON.stringify(param) + } + }); + //$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemBLL.cs index 14938f04d..ee81424af 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemBLL.cs @@ -299,6 +299,25 @@ namespace Learun.Application.Base.SystemModule } } + public IEnumerable GetAllDetailList() + { + try + { + return dataItemService.GetAllDetailList(); + } + 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.Base/SystemModule/DataItem/DataItemIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemIBLL.cs index 4dcc185ca..48d312cfc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemIBLL.cs @@ -70,6 +70,7 @@ namespace Learun.Application.Base.SystemModule /// 分类编码 /// List GetDetailList(string itemCode); + IEnumerable GetAllDetailList(); /// /// 获取数据字典明显 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemService.cs index a6284bdf4..dbf42ec92 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemService.cs @@ -149,6 +149,38 @@ namespace Learun.Application.Base.SystemModule #endregion #region 数据字典明细 + + /// + /// 获取数据字典明细 + /// + /// + public IEnumerable GetAllDetailList() + { + try + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("SELECT " + @"t.F_ItemId, + t.F_ParentId, + t2.F_ItemCode, + t.F_ItemName, + t.F_ItemValue " + @" FROM LR_Base_DataItemDetail t + INNER JOIN LR_Base_DataItem t2 ON t.F_ItemId = t2.F_ItemId + WHERE t.F_DeleteMark = 0 and t.F_EnabledMark=1 Order By t.F_SortCode + "); + return this.BaseRepository().FindList(strSql.ToString()); + } + 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.Base/SystemModule/DataSource/DataSourceBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataSource/DataSourceBLL.cs index 0ca30c0a3..12fa281d9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataSource/DataSourceBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataSource/DataSourceBLL.cs @@ -197,6 +197,51 @@ namespace Learun.Application.Base.SystemModule } } } + + + /// + /// 获取数据源的数据 + /// + /// 数据源编码 + /// sql查询条件语句 + /// 查询条件 + /// + public DataTable GetDataTable(DataSourceEntity entity, string strWhere, string queryJson = "{}") + { + try + { + if (entity == null) + { + return new DataTable(); + } + else + { + if (!string.IsNullOrEmpty(strWhere)) + { + strWhere = " where " + strWhere; + } + else + { + strWhere = ""; + } + var queryParam = queryJson.ToJObject(); + string sql = string.Format(" select * From ({0})t {1} ", entity.F_Sql, strWhere); + return databaseLinkIBLL.FindTable(entity.F_DbId, sql, queryParam); + } + } + 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.Base/SystemModule/DataSource/DataSourceIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataSource/DataSourceIBLL.cs index 7080bc42b..fb37de01e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataSource/DataSourceIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataSource/DataSourceIBLL.cs @@ -59,6 +59,7 @@ namespace Learun.Application.Base.SystemModule /// DataTable GetDataTable(string code, string strWhere, string queryJson = "{}"); + DataTable GetDataTable(DataSourceEntity entity, string strWhere, string queryJson = "{}"); /// /// 获取树形数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemBLL.cs index e68a3540d..82fe93d52 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemBLL.cs @@ -139,6 +139,26 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } } + + public DataTable GetExportList(string queryJson) + { + try + { + return ass_AssetsInfoItemService.GetExportList(queryJson); + } + 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/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemIBLL.cs index a7a5ca43d..631023005 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemIBLL.cs @@ -23,6 +23,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem IEnumerable GetPageList(Pagination pagination, string queryJson); object GetList(string queryJson); + DataTable GetExportList(string queryJson); /// /// 获取左侧树形数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemService.cs index ff8e0ac2c..bd82a0d3f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoItem/Ass_AssetsInfoItemService.cs @@ -159,6 +159,133 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } } + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// + public DataTable GetExportList(string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append(@"SELECT t.AICodeNumJY ,storage.sname as AIIStorageName,room.rcode,room.RFunction,room.RArea,'' as REnabledName,t.AIASSName,t.AISpecification, t.AISpecificationtype, t.AIUnits, '' as AIASSStateName,t.AIDepartment, t.AIUsePeople, AIPlace, AIAssValue,AIAddTime, AIRemark, DepreciationMethod, DepreciationStatus, UsefulLife, MonthlyDepreciation, MonthsOfDepreciation, MonthlyDepreciationRate, + AccumulatedDepreciation, NetWorth, VehicleLicenseUser, AIVehicleNumber, AIPlateNumber, AIBuiltArea, AIOwnership, LandUseType, LandUseUser,room.REnabled,t.AIASSState + "); + strSql.Append(" FROM Ass_AssetsInfoItem t "); + strSql.Append(" left join Ass_Storage_Room room on t.AIIStoragePosition=room.rid "); + strSql.Append(" left join Ass_Storage storage on t.AIIStorageId=storage.sid "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["AICode"].IsEmpty()) + { + strSql.Append($" AND t.AICode Like '%{queryParam["AICode"].ToString()}%' "); + } + if (!queryParam["AICodeNumJY"].IsEmpty()) + { + strSql.Append($" AND t.AICodeNumJY Like '%{queryParam["AICodeNumJY"].ToString()}%' "); + } + + if (!queryParam["userId"].IsEmpty()) + { + strSql.Append($" AND t.AIUsePeople = '{queryParam["userId"].ToString()}' "); + } + if (!queryParam["AIAssType"].IsEmpty()) + { + strSql.Append($" AND t.AIAssType = '{queryParam["AIAssType"].ToString()}' "); + } + if (!queryParam["AIUsePeople"].IsEmpty()) + { + strSql.Append($" AND t.AIUsePeople = '{queryParam["AIUsePeople"].ToString()}' "); + } + + if (!queryParam["AIDepartment"].IsEmpty()) + { + strSql.Append($" AND t.AIDepartment Like '%{queryParam["AIDepartment"].ToString()}%' "); + } + if (!queryParam["AIASSState"].IsEmpty()) + { + strSql.Append($" AND t.AIASSState = '{queryParam["AIASSState"].ToString()}' "); + } + if (!queryParam["AIASSClass"].IsEmpty()) + { + strSql.Append($" AND t.AIASSClass = '{queryParam["AIASSClass"].ToString()}' "); + } + if (!queryParam["AIIsScrap"].IsEmpty()) + { + var isScrap = Convert.ToBoolean(queryParam["AIIsScrap"].ToString()); + if (!isScrap) + { + strSql.Append(" AND (t.AIASSState <> 2 or t.AIASSState is null)"); + } + else + { + strSql.Append(" AND t.AIASSState = 2 "); + } + } + + if (!queryParam["AId"].IsEmpty()) + { + strSql.Append($" AND t.AId='{queryParam["AId"].ToString()}' "); + } + if (!queryParam["AIASSName"].IsEmpty()) + { + strSql.Append($" AND t.AIASSName Like '%{queryParam["AIASSName"].ToString()}%' "); + } + if (!queryParam["AIIStorageId"].IsEmpty()) + { + strSql.Append($" AND t.AIIStorageId = '{queryParam["AIIStorageId"].ToString()}' "); + } + if (!queryParam["AIIStoragePosition"].IsEmpty()) + { + strSql.Append($" AND t.AIIStoragePosition Like '%{queryParam["AIIStoragePosition"].ToString()}%' "); + } + //房间功能 + if (!queryParam["RFunction"].IsEmpty()) + { + strSql.Append($" AND room.RFunction Like '{queryParam["RFunction"].ToString()}' "); + } + //房间面积 + if (!queryParam["RArea"].IsEmpty()) + { + strSql.Append($" AND room.RArea Like '%{queryParam["RArea"].ToString()}%' "); + } + //房间状态 + if (!queryParam["REnabled"].IsEmpty()) + { + var REnabled = Convert.ToBoolean(queryParam["REnabled"].ToString()); + if (REnabled) + { + strSql.Append(" AND room.REnabled=1 "); + } + else + { + strSql.Append(" AND room.REnabled=0 "); + } + + } + if (!queryParam["AIAssValue"].IsEmpty()) + { + strSql.Append($" AND t.AIAssValue Like '%{queryParam["AIAssValue"].ToString()}%' "); + } + + return this.BaseRepository().FindTable(strSql.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } /// /// 获取树形数据 ///