@@ -0,0 +1,212 @@ | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Application.OA.StampPersonal; | |||
using Learun.Util; | |||
using System; | |||
using System.IO; | |||
using System.Web; | |||
using System.Web.Mvc; | |||
namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V6.1.6.0 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2017 上海力软信息技术有限公司 | |||
/// 创建人:力软-框架开发组(王飞) | |||
/// 日 期:2022.12.05 | |||
/// 描 述:个人印章管理 | |||
/// </summary> | |||
public class StampPersonalController : MvcControllerBase | |||
{ | |||
private StampPersonalIBLL stampPersonalIBLL = new StampPersonalBLL(); | |||
private ImgIBLL imgIBLL = new ImgBLL(); | |||
#region 视图功能 | |||
/// <summary> | |||
/// 管理页面 | |||
/// </summary> | |||
/// <returns></returns> | |||
public ActionResult Index() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页面 | |||
/// </summary> | |||
/// <returns></returns> | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
} | |||
public ActionResult StampDetailIndex() | |||
{ | |||
return View(); | |||
} | |||
public ActionResult EqualForm() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
/// <summary> | |||
/// 分页 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetPageList(string pagination, string queryJson) | |||
{ | |||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||
var data = stampPersonalIBLL.GetPageList(paginationobj, queryJson); | |||
var jsonData = new | |||
{ | |||
rows = data, | |||
total = paginationobj.total, | |||
page = paginationobj.page, | |||
records = paginationobj.records | |||
}; | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 获取所有的印章信息 | |||
/// </summary> | |||
/// <param name="keyword"></param> | |||
/// <param name="category"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetList(string keyword, string userId) | |||
{ | |||
var data = stampPersonalIBLL.GetList(keyword, userId); | |||
return Success(data); | |||
} | |||
/// <summary> | |||
/// 获取图片 | |||
/// </summary> | |||
/// <param name="parentId"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult GetImg(string keyValue) | |||
{ | |||
stampPersonalIBLL.GetImg(keyValue); | |||
return Success("获取成功!"); | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 保存印章 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, StampPersonalEntity entity) | |||
{ | |||
stampPersonalIBLL.SaveEntity(keyValue, entity); | |||
return Success("保存成功。"); | |||
} | |||
/// <summary> | |||
/// 删除印章 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult DeleteForm(string keyValue) | |||
{ | |||
stampPersonalIBLL.DeleteEntity(keyValue); | |||
return Success("删除成功!"); | |||
} | |||
#endregion | |||
#region 扩展方法 | |||
/// <summary> | |||
/// 图片上传 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">印章实体</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public ActionResult UploadFile(string keyValue, StampPersonalEntity entity) | |||
{ | |||
HttpFileCollection files = System.Web.HttpContext.Current.Request.Files; | |||
if (files[0].ContentLength == 0 || string.IsNullOrEmpty(files[0].FileName)) | |||
{ | |||
stampPersonalIBLL.SaveEntity(keyValue, entity); | |||
} | |||
else | |||
{ | |||
string FileEextension = Path.GetExtension(files[0].FileName); | |||
ImgEntity imgEntity = null; | |||
if (string.IsNullOrEmpty(entity.F_ImgFile)) | |||
{ | |||
imgEntity = new ImgEntity(); | |||
} | |||
else | |||
{ | |||
imgEntity = imgIBLL.GetEntity(entity.F_ImgFile); | |||
} | |||
imgEntity.F_Name = files[0].FileName; | |||
imgEntity.F_ExName = FileEextension; | |||
byte[] bytes = new byte[files[0].InputStream.Length]; | |||
files[0].InputStream.Read(bytes, 0, bytes.Length); | |||
imgEntity.F_Content = Convert.ToBase64String(bytes); | |||
imgIBLL.SaveEntity(entity.F_ImgFile, imgEntity); | |||
entity.F_ImgFile = imgEntity.F_Id; | |||
stampPersonalIBLL.SaveEntity(keyValue, entity); | |||
} | |||
return Success("保存成功。"); | |||
} | |||
/// <summary> | |||
/// 启用/停用 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="state">状态 1启用 0禁用</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult UpDateSate(string keyValue, int state) | |||
{ | |||
stampPersonalIBLL.UpdateState(keyValue, state); | |||
return Success((state == 1 ? "启用" : "禁用") + "成功!"); | |||
} | |||
/// <summary> | |||
/// 密码验证 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="Password">密码</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult EqualForm(string keyValue, string Password) | |||
{ | |||
var result = stampPersonalIBLL.EqualPassword(keyValue, Password); | |||
if (result) | |||
{ | |||
return Success("密码验证成功!"); | |||
} | |||
else | |||
{ | |||
return Fail("密码不正确!"); | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
@{ | |||
ViewBag.Title = "印章密码"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">密码<font face="宋体">*</font></div> | |||
<input id="F_Password" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/LR_NewWorkFlow/Views/StampPersonal/EqualForm.js") |
@@ -0,0 +1,35 @@ | |||
/* * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2018 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2022-12-05 | |||
* 描 述:密码验证 | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var selectedRow = learun.frameTab.currentIframe().selectedRow; | |||
var page = { | |||
init: function () { | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
} | |||
}; | |||
// 保存数据 | |||
acceptClick = function (callBack) { | |||
if (!$('#form').lrValidform()) { | |||
return false; | |||
} | |||
var postData = $('#form').lrGetFormData(); | |||
var F_Password = $.md5(postData.F_Password); | |||
learun.postForm(top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/EqualForm', { keyValue: keyValue, Password: F_Password }, function (res) { | |||
// 正确之后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
}); | |||
}; | |||
page.init(); | |||
} |
@@ -0,0 +1,43 @@ | |||
| |||
@{ | |||
ViewBag.Title = "个人印章操作"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
@Html.AppendCssFile("/Areas/LR_NewWorkFlow/Views/StampPersonal/Form.css") | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">印章名称<font face="宋体">*</font></div> | |||
<input id="F_StampName" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">印章分类<font face="宋体">*</font></div> | |||
<div id="F_StampType" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">密码<font face="宋体">*</font></div> | |||
<input id="F_Password" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item"> | |||
<div class="lr-form-item-title">排序<font face="宋体">*</font></div> | |||
<input id="F_Sort" type="text" class="form-control" isvalid="yes" checkexpession="Num" /> | |||
</div> | |||
<div class="col-xs-12" style="padding-left:100px;"> | |||
<div class="lr-form-item-title">图片文件</div> | |||
<div class="fileEx"> | |||
<input type="file" name="uploadFile" id="uploadFile"> | |||
</div> | |||
<div class="text"> | |||
上传图片尺寸为200x200,大小不超过1M。 | |||
</div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">备注</div> | |||
<textarea id="F_Description" type="text" class="form-control" style="height:140px;"></textarea> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Views/LR_Content/script/lr-fileupload.js", "/Areas/LR_NewWorkFlow/Views/StampPersonal/Form.js") | |||
@@ -0,0 +1,21 @@ | |||
.fileEx { | |||
width: 100%; | |||
height: 120px; | |||
position: relative; | |||
overflow: hidden; | |||
} | |||
.fileEx input { | |||
position: absolute; | |||
font-size: 120px; | |||
right: 0; | |||
top: 0; | |||
opacity: 0; | |||
cursor: pointer !important; | |||
} | |||
.fileEx img { | |||
width: 120px; | |||
height: 120px; | |||
cursor: pointer; | |||
} |
@@ -0,0 +1,86 @@ | |||
/* | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2018 上海力软信息技术有限公司 | |||
* 创建人:力软-前端开发组 | |||
* 日 期:2022.12.05 | |||
* 描 述:个人印章管理 | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var selectedRow = learun.frameTab.currentIframe().selectedRow; | |||
function uploadImg() { | |||
var f = document.getElementById("uploadFile").files[0];//获取文件 | |||
var src = window.URL.createObjectURL(f); | |||
document.getElementById('uploadPreview').src = src; | |||
} | |||
var page = { | |||
init: function () { | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
// 印章分类 | |||
$('#F_StampType').lrDataItemSelect({ code: 'StampType' }); | |||
//图片显示 | |||
$('#uploadFile').on('change', uploadImg); | |||
$('.fileEx').prepend('<img id="uploadPreview" src="' + top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/GetImg?keyValue=' + keyValue + '" >'); | |||
}, | |||
initData: function () { | |||
if (!!selectedRow) { | |||
selectedRow.F_Password = '*****'; | |||
$('#form').lrSetFormData(selectedRow); | |||
} | |||
} | |||
}; | |||
// 保存数据 | |||
acceptClick = function (callBack) { | |||
if (!$('#form').lrValidform()) { | |||
return false; | |||
} | |||
var postData = $('#form').lrGetFormData(keyValue); | |||
if (postData.F_Password != '*****' || !keyValue) { | |||
postData.F_Password = $.md5(postData.F_Password); | |||
} | |||
else { | |||
delete postData.F_Password; | |||
} | |||
if (!keyValue && !postData.uploadFile) { | |||
learun.alert.error("请选择图片"); | |||
return false; | |||
} | |||
var f = document.getElementById('uploadFile').files[0]; | |||
//是否上传图片 | |||
if (!!f) { | |||
learun.loading(true, '正在保存...'); | |||
$.ajaxFileUpload({ | |||
data: postData, | |||
url: top.$.rootUrl + "/LR_NewWorkFlow/StampPersonal/UploadFile?keyValue=" + keyValue, | |||
secureuri: false, | |||
fileElementId: 'uploadFile', | |||
dataType: 'json', | |||
success: function (data) { | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
learun.loading(false); | |||
learun.layerClose(window.name); | |||
} | |||
}); | |||
} | |||
else { | |||
$.lrSaveForm(top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
}); | |||
} | |||
}; | |||
page.init(); | |||
} |
@@ -0,0 +1,61 @@ | |||
| |||
@{ | |||
ViewBag.Title = "个人印章管理"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<div class="lr-layout lr-layout-left-center" id="lr_layout"> | |||
<div class="lr-layout-left"> | |||
<div class="lr-layout-wrap"> | |||
<div class="lr-layout-title lrlg ">印章分类信息</div> | |||
<div id="lr_left_tree" class="lr-layout-body"></div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-center"> | |||
<div class="lr-layout-wrap"> | |||
<div class="lr-layout-title"> | |||
<span class="lrlg">印章管理</span> - <span id="titleinfo" class="lrlg">未选择分类</span> | |||
</div> | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item" style="margin-top:-4px;margin-right:8px;"> | |||
<div class="radio"> | |||
<label><input name="isEnabled" id="isEnable" type="radio" value="1" />启用</label> | |||
<label><input name="isEnabled" id="isDisable" type="radio" value="0" />禁用</label> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入印章名称" /> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> <span class="lrlg">查询</span></a> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class="btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
</div> | |||
<div class="btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> <span class="lrlg">新增</span></a> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> <span class="lrlg">编辑</span></a> | |||
<a id="lr_more" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> | |||
<i class="fa fa-reorder"></i> <span class="lrlg">更多</span><span class="caret"></span> | |||
</a> | |||
<ul class="dropdown-menu pull-right"> | |||
<li id="lr_delete"><a><i></i> <span class="lrlg">删除</span></a></li> | |||
<li id="lr_enable"><a><i></i> <span class="lrlg">启用</span></a></li> | |||
<li id="lr_disabled"><a><i></i> <span class="lrlg">停用</span></a></li> | |||
</ul> | |||
</div> | |||
<div class="btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_category" class="btn btn-default"><i class="fa fa-tags"></i> <span class="lrlg">分类管理</span></a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/LR_NewWorkFlow/Views/StampPersonal/Index.js") | |||
@@ -0,0 +1,209 @@ | |||
/* | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2018 上海力软信息技术有限公司 | |||
* 创建人: | |||
* 日 期:2022.12.05 | |||
* 描 述:个人印章管理 | |||
*/ | |||
var selectedRow; | |||
var refreshGirdData; | |||
var F_StampType; | |||
var F_StampName; | |||
var F_EnabledMark; | |||
var acceptClick; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
init: function () { | |||
page.initGrid(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
// 左侧数据加载 | |||
$('#lr_left_tree').lrtree({ | |||
url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailTree', | |||
param: { itemCode: 'StampType' }, | |||
nodeClick: function (item) { | |||
F_StampType = item.value; | |||
F_StampName = null;//将文本框数据设置为null,如果不设置,那么不能按照左侧分类查询 | |||
F_EnabledMark = null;//将文本框数据设置为null,如果不设置,那么不能按照左侧分类查询 | |||
$('#titleinfo').text(item.text); | |||
page.search(); | |||
} | |||
}); | |||
//查询 | |||
$('#btn_Search').on('click', function () { | |||
var keyword = $('#txt_Keyword').val(); | |||
F_StampType = null; | |||
page.search({ F_StampName: keyword }); | |||
}); | |||
$('[name="isEnabled"]').on('click', function () { | |||
var value = $(this).val(); //状态查询 | |||
if (value == 1) { | |||
F_EnabledMark = value; | |||
page.search(); | |||
} | |||
else { | |||
F_EnabledMark = value; | |||
page.search(); | |||
} | |||
}); | |||
//刷新 | |||
$("#lr_refresh").on('click', function () { | |||
location.reload(); | |||
}); | |||
//新增 | |||
$("#lr_add").on('click', function () { | |||
selectedRow = null; | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '添加印章', | |||
url: top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/Form', | |||
width: 700, | |||
height: 500, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
//编辑 | |||
$("#lr_edit").on("click", function () { | |||
selectedRow = $("#gridtable").jfGridGet("rowdata");//获取选中的当前行数据 | |||
var keyValue = $("#gridtable").jfGridValue("F_StampId");//获取当前选中的主键值 | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'Form', | |||
title: '编辑印章', | |||
url: top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/Form?keyValue=' + keyValue, | |||
width: 750, | |||
height: 500, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
}); | |||
//删除 | |||
$("#lr_delete").on("click", function () { | |||
var keyValue = $('#gridtable').jfGridValue('F_StampId'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/DeleteForm', { keyValue: keyValue }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
// 启用 | |||
$('#lr_enable').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('F_StampId'); | |||
var enabledMark = $('#gridtable').jfGridValue('F_EnabledMark'); | |||
if (learun.checkrow(keyValue)) { | |||
if (enabledMark != 1) { | |||
learun.layerConfirm('是否确认启用该项!', function (res) { | |||
if (res) { | |||
learun.postForm(top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/UpDateSate', { keyValue: keyValue, state: 1 }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
else { | |||
learun.alert.warning('该项已启用!'); | |||
} | |||
} | |||
}); | |||
// 禁用 | |||
$('#lr_disabled').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('F_StampId'); | |||
var enabledMark = $('#gridtable').jfGridValue('F_EnabledMark'); | |||
if (learun.checkrow(keyValue)) { | |||
if (enabledMark == 1) { | |||
learun.layerConfirm('是否确认禁用该项!', function (res) { | |||
if (res) { | |||
learun.postForm(top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/UpDateSate', { keyValue: keyValue, state: 0 }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
else { | |||
learun.alert.warning('该项已禁用!'); | |||
} | |||
} | |||
}); | |||
/*分类管理*/ | |||
$('#lr_category').on('click', function () { | |||
learun.layerForm({ | |||
id: 'ClassifyIndex', | |||
title: '分类管理', | |||
url: top.$.rootUrl + '/LR_SystemModule/DataItem/DetailIndex?itemCode=StampType', | |||
width: 800, | |||
height: 500, | |||
maxmin: true, | |||
btn: null, | |||
end: function () { | |||
learun.clientdata.update('dataItem'); | |||
location.reload(); | |||
} | |||
}); | |||
}); | |||
}, | |||
initGrid: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/GetPageList', | |||
headData: [ | |||
{ label: '印章名称', name: 'F_StampName', width: 150, align: "center" }, | |||
{ | |||
label: '印章分类', name: 'F_StampType', width: 100, align: "center", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('dataItem', { | |||
key: value, | |||
code: 'StampType', | |||
callback: function (_data) { | |||
callback(_data.text); | |||
} | |||
}); | |||
} | |||
}, | |||
{ | |||
label: '图片', name: 'F_ImgFile', width: 110, align: "center", | |||
formatter: function (value, row, op, $cell) { | |||
return '<img src="' + top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/GetImg?keyValue=' + row.F_StampId + '" style="position: absolute;height:100px;width:100px;top:5px;left:5px;" >'; | |||
} | |||
}, | |||
{ | |||
label: '状态', name: 'F_EnabledMark', width: 60, align: "center", formatter: function (value, row, op, $cell) { | |||
if (value == 1) { | |||
return '<span class=\"label label-success\" style=\"cursor: pointer;\">启用</span>'; | |||
} else if (value == 0) { | |||
return '<span class=\"label label-default\" style=\"cursor: pointer;\">禁用</span>'; | |||
} | |||
} | |||
}, | |||
{ label: '备注', name: 'F_Description', width: 200, align: "left" } | |||
], | |||
mainId: 'F_StampId', | |||
isPage: true, | |||
rowHeight: 110, | |||
sidx: 'F_EnabledMark Desc,F_Sort ASC' | |||
}); | |||
page.search(); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.F_StampType = F_StampType; | |||
param.F_EnabledMark = F_EnabledMark; | |||
param.F_CreateUserId = learun.clientdata.get(['userinfo']).userId; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
} | |||
refreshGirdData = function () { | |||
page.search(); | |||
}; | |||
page.init(); | |||
} |
@@ -0,0 +1,64 @@ | |||
@{ | |||
ViewBag.Title = "个人印章管理"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-layout"> | |||
<div class="lr-form-layout-top"> | |||
<div class="lr-item"> | |||
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width:240px;" /> | |||
</div> | |||
<div class="lr-item"> | |||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> 查询</a> | |||
</div> | |||
<div class="lr-item" style="float:right;width:200px;margin-right:10px;"> | |||
<input id="F_Password" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请输入密码"/> | |||
</div> | |||
</div> | |||
<div id="datagird"></div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/LR_NewWorkFlow/Views/StampPersonal/StampDetailIndex.js") | |||
<style> | |||
.lr-form-layout { | |||
padding: 44px 0 0 0; | |||
} | |||
.lr-form-layout-top { | |||
position: absolute; | |||
top: 0; | |||
left: 0; | |||
border-bottom: 1px solid #ddd; | |||
height: 44px; | |||
width: 100%; | |||
padding-left: 3px; | |||
z-index: 4; | |||
} | |||
.lr-item { | |||
position: relative; | |||
float: left; | |||
padding-top: 8px; | |||
padding-left: 5px; | |||
line-height: 28px; | |||
} | |||
.lr-item .btn { | |||
position: relative; | |||
display: inline-block; | |||
height: 28px; | |||
margin-bottom: 1px; | |||
line-height: 14px; | |||
} | |||
.lr-item .lr-select { | |||
width: 170px; | |||
} | |||
.lr-item .lr-field-error-info { | |||
top: 9px; | |||
height: 26px; | |||
} | |||
</style> | |||
@@ -0,0 +1,71 @@ | |||
/* | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2018 上海力软信息技术有限公司 | |||
* 创建人: | |||
* 日 期:2022.12.05 | |||
* 描 述:个人印章管理 | |||
*/ | |||
var keyword; | |||
var acceptClick; | |||
var path = ''; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
// 保存数据 | |||
var page = { | |||
init: function () { | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
// 订单产品信息 | |||
$('#datagird').jfGrid({ | |||
headData: [ | |||
{ label: '名称', name: 'F_StampName', width: 150, align: "center" }, | |||
{ | |||
label: '印章', name: 'F_ImgFile', width: 110, align: "left", | |||
formatter: function (value, row, op, $cell) { | |||
return '<img src="' + top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/GetImg?keyValue=' + row.F_StampId + '" style="position: absolute;height:100px;width:100px;top:5px;left:5px;" >'; | |||
} | |||
} | |||
], | |||
mainId: 'F_StampId', | |||
rowHeight: 110, | |||
}); | |||
//查询 | |||
$('#btn_Search').on('click', function () { | |||
keyword = $('#txt_Keyword').val(); | |||
page.search({ keyword: keyword }); | |||
}); | |||
}, | |||
initData: function () { | |||
$.lrSetForm(top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/GetList?keyword=' + '' + '&userId=' + learun.clientdata.get(['userinfo']).userId, function (data) { | |||
$('.lr-layout-wrap').lrSetFormData(data.data); | |||
$('#datagird').jfGridSet('refreshdata', data); | |||
}); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
$.lrSetForm(top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/GetList?keyword=' + keyword + '&userId=' + learun.clientdata.get(['userinfo']).userId, function (data) { | |||
$('.lr-layout-wrap').lrSetFormData(data.data); | |||
$('#datagird').jfGridSet('refreshdata', data); | |||
}); | |||
} | |||
}; | |||
acceptClick = function (callBack) { | |||
var keyValue = $("#datagird").jfGridValue("F_StampId"); | |||
if (!$('.lr-item').lrValidform()) { | |||
return false; | |||
} | |||
var postData = $('.lr-item').lrGetFormData(); | |||
var F_Password = $.md5(postData.F_Password); | |||
if (!keyValue) { | |||
learun.alert.error("请选择印章!"); | |||
return false; | |||
} | |||
learun.postForm(top.$.rootUrl + '/LR_NewWorkFlow/StampPersonal/EqualForm', { keyValue: keyValue, Password: F_Password }, function (res) { | |||
callBack(keyValue); | |||
}); | |||
}; | |||
page.init(); | |||
} |
@@ -453,6 +453,7 @@ | |||
<Compile Include="Areas\LR_NewWorkFlow\Controllers\NWFDelegateController.cs" /> | |||
<Compile Include="Areas\LR_NewWorkFlow\Controllers\NWFProcessController.cs" /> | |||
<Compile Include="Areas\LR_NewWorkFlow\Controllers\NWFSchemeController.cs" /> | |||
<Compile Include="Areas\LR_NewWorkFlow\Controllers\StampPersonalController.cs" /> | |||
<Compile Include="Areas\LR_NewWorkFlow\Controllers\StampInfoController.cs" /> | |||
<Compile Include="Areas\LR_NewWorkFlow\LR_NewWorkFlowAreaRegistration.cs" /> | |||
<Compile Include="Areas\LR_OAModule\Controllers\EmailController.cs" /> | |||
@@ -1722,6 +1723,11 @@ | |||
<Content Include="Areas\LR_NewWorkFlow\Views\NWFProcess\SelectUserForm.js" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\NWFProcess\SignForm.js" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\NWFProcess\StatisticTimeForm.js" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\EqualForm.js" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\Form.css" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\Form.js" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\Index.js" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\StampDetailIndex.js" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampInfo\EqualForm.js" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampInfo\Form.css" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampInfo\Form.js" /> | |||
@@ -8003,6 +8009,10 @@ | |||
<Content Include="Areas\LogisticsManagement\Views\Acc_DailyAssess\Index.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Acc_DailyAssess\IndexDorm.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Acc_DailyAssess\IndexAll.cshtml" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\EqualForm.cshtml" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\Form.cshtml" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\Index.cshtml" /> | |||
<Content Include="Areas\LR_NewWorkFlow\Views\StampPersonal\StampDetailIndex.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -0,0 +1,27 @@ | |||
using Learun.Application.OA.StampPersonal; | |||
using System.Data.Entity.ModelConfiguration; | |||
namespace Learun.Application.Mapping | |||
{/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2018 上海力软信息技术有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2022-12-05 09:57 | |||
/// 描 述:个人印章管理 | |||
/// </summary> | |||
public class StampPersonalMap : EntityTypeConfiguration<StampPersonalEntity> | |||
{ | |||
public StampPersonalMap() | |||
{ | |||
#region 表、主键 | |||
//表 | |||
this.ToTable("LR_BASE_STAMPPERSONAL"); | |||
//主键 | |||
this.HasKey(s =>s.F_StampId); | |||
#endregion | |||
#region 配置关系 | |||
#endregion | |||
} | |||
} | |||
} |
@@ -196,6 +196,7 @@ | |||
<Compile Include="LR_OA\JQueryGanttMap.cs" /> | |||
<Compile Include="LR_OA\ScheduleMap.cs" /> | |||
<Compile Include="LR_OA\NewsMap.cs" /> | |||
<Compile Include="LR_OA\StampPersonalMap.cs" /> | |||
<Compile Include="LR_OA\StampMap.cs" /> | |||
<Compile Include="LR_Organization\CompanyMap.cs" /> | |||
<Compile Include="LR_Organization\DepartmentMap.cs" /> | |||
@@ -140,6 +140,10 @@ | |||
<Compile Include="LostArticleInfo\LostArticleInfoEntity.cs" /> | |||
<Compile Include="LostArticleInfo\LostArticleInfoIBLL.cs" /> | |||
<Compile Include="LostArticleInfo\LostArticleInfoService.cs" /> | |||
<Compile Include="StampPersonal\StampPersonalBLL.cs" /> | |||
<Compile Include="StampPersonal\StampPersonalEntity.cs" /> | |||
<Compile Include="StampPersonal\StampPersonalIBLL.cs" /> | |||
<Compile Include="StampPersonal\StampPersonalService.cs" /> | |||
<Compile Include="LR_StampManage\LR_StampManageBLL.cs" /> | |||
<Compile Include="LR_StampManage\LR_StampManageEntity.cs" /> | |||
<Compile Include="LR_StampManage\LR_StampManageIBLL.cs" /> | |||
@@ -0,0 +1,217 @@ | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
namespace Learun.Application.OA.StampPersonal | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V6.1.6.0 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2017 上海力软信息技术有限公司 | |||
/// 创建人:力软-框架开发组(王飞) | |||
/// 日 期:2022.12.05 | |||
/// 描 述:个人印章管理 | |||
/// </summary> | |||
public class StampPersonalBLL : StampPersonalIBLL | |||
{ | |||
private StampPersonalService stampPersonalService = new StampPersonalService(); | |||
private ImgIBLL imgIBLL = new ImgBLL(); | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取所有的印章信息/模糊查询(根据名称/状态(启用或者停用)) | |||
/// </summary> | |||
/// <param name="keyWord">查询的关键字</param> | |||
/// <returns></returns> | |||
public IEnumerable<StampPersonalEntity> GetList(string keyWord, string userId) | |||
{ | |||
try | |||
{ | |||
return stampPersonalService.GetList(keyWord, userId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取列表分页数据 | |||
/// <param name="pagination">分页参数</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public IEnumerable<StampPersonalEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
return stampPersonalService.GetPageList(pagination, queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取实体 | |||
/// </summary> | |||
/// <param name="parentId">主键</param> | |||
/// <returns></returns> | |||
public StampPersonalEntity GetEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return stampPersonalService.GetEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 保存印章信息(新增/编辑) | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="stampEntity"></param> | |||
public void SaveEntity(string keyValue, StampPersonalEntity entity) | |||
{ | |||
try | |||
{ | |||
stampPersonalService.SaveEntity(keyValue, entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 删除印章信息 | |||
/// </summary> | |||
/// <param name="keyVlaue"></param> | |||
public void DeleteEntity(string keyVlaue) | |||
{ | |||
try | |||
{ | |||
stampPersonalService.DeleteEntity(keyVlaue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 扩展方法 | |||
/// <summary> | |||
/// 获取图片 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void GetImg(string keyValue) | |||
{ | |||
//首先获取实体 | |||
StampPersonalEntity entity = GetEntity(keyValue); | |||
string img = ""; | |||
//实体是否存在 | |||
if (entity != null && !string.IsNullOrEmpty(entity.F_ImgFile)) | |||
{ | |||
ImgEntity imgEntity = imgIBLL.GetEntity(entity.F_ImgFile); | |||
if (imgEntity != null && !string.IsNullOrEmpty(imgEntity.F_Content)) | |||
{ | |||
FileDownHelper.DownLoadBase64(imgEntity.F_Content, imgEntity.F_Name); | |||
return; | |||
} | |||
} | |||
else | |||
{ | |||
img = "/Content/images/add.jpg"; | |||
} | |||
if (string.IsNullOrEmpty(img)) | |||
{ | |||
img = "/Content/images/add.jpg"; | |||
} | |||
FileDownHelper.DownLoad(img); | |||
} | |||
/// <summary> | |||
/// 更新数据状态 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="state">状态 1启用 0禁用</param> | |||
public void UpdateState(string keyValue, int state) | |||
{ | |||
StampPersonalEntity entity = new StampPersonalEntity(); | |||
entity.F_EnabledMark = state; | |||
SaveEntity(keyValue, entity); | |||
} | |||
/// <summary> | |||
/// 密码验证 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="password">密码</param> | |||
/// <returns></returns> | |||
public bool EqualPassword(string keyValue, string password) | |||
{ | |||
StampPersonalEntity entity = GetEntity(keyValue); | |||
if (entity.F_Password.Equals(password))//加密后进行对比 | |||
{ | |||
return true; | |||
} | |||
else | |||
{ | |||
return false; | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,94 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.ComponentModel.DataAnnotations.Schema; | |||
namespace Learun.Application.OA.StampPersonal | |||
{ | |||
public class StampPersonalEntity | |||
{ | |||
/// <summary> | |||
/// 印章编号 | |||
/// </summary> | |||
[Column("F_STAMPID")] | |||
public string F_StampId { get; set; } | |||
/// <summary> | |||
/// 印章名称 | |||
/// </summary> | |||
[Column("F_STAMPNAME")] | |||
public string F_StampName { get; set; } | |||
/// <summary> | |||
/// 印章备注 | |||
/// </summary> | |||
[Column("F_DESCRIPTION")] | |||
public string F_Description { get; set; } | |||
/// <summary> | |||
/// 印章分类 | |||
/// </summary> | |||
[Column("F_STAMPTYPE")] | |||
public string F_StampType { get; set; } | |||
/// <summary> | |||
/// 密码 | |||
/// </summary> | |||
[Column("F_PASSWORD")] | |||
public string F_Password { get; set; } | |||
/// <summary> | |||
/// 图片文件 | |||
/// </summary> | |||
[Column("F_IMGFILE")] | |||
public string F_ImgFile { get; set; } | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
[Column("F_SORT")] | |||
public string F_Sort { get; set; } | |||
/// <summary> | |||
/// 印章状态 | |||
/// </summary> | |||
[Column("F_ENABLEDMARK")] | |||
public int? F_EnabledMark { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
[Column("F_CREATEUSERID")] | |||
public string F_CreateUserId { get; set; } | |||
/// <summary> | |||
/// 时间 | |||
/// </summary> | |||
[Column("F_CREATETIME")] | |||
public DateTime? F_CreateTime { get; set; } | |||
#region 扩展方法 | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.F_StampId = keyValue; | |||
this.F_CreateUserId = LoginUserInfo.Get().userId; //创建人 | |||
this.F_CreateTime = DateTime.Now; | |||
} | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.F_StampId = Guid.NewGuid().ToString(); //产生印章编号 | |||
this.F_EnabledMark = 1;//默认状态为启用 | |||
this.F_CreateUserId = LoginUserInfo.Get().userId; //创建人 | |||
this.F_CreateTime = DateTime.Now; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,75 @@ | |||
using Learun.Util; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.OA.StampPersonal | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V6.1.6.0 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2017 上海力软信息技术有限公司 | |||
/// 创建人:力软-框架开发组(王飞) | |||
/// 日 期:2022.12.05 | |||
/// 描 述:个人印章管理 | |||
/// </summary> | |||
public interface StampPersonalIBLL | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
/// 模糊查询(根据名称/状态(启用或者停用)) | |||
/// </summary> | |||
/// <param name="keyWord"></param> | |||
/// <returns></returns> | |||
IEnumerable<StampPersonalEntity> GetList(string keyWord, string userId); | |||
/// <summary> | |||
/// 获取列表分页数据 | |||
/// <param name="pagination">分页参数</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
IEnumerable<StampPersonalEntity> GetPageList(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// 获取印章树形数据 | |||
/// </summary> | |||
/// <param name="parentId">父级节点</param> | |||
/// <returns></returns> | |||
StampPersonalEntity GetEntity(string keyValue); | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 保存印章信息(新增/编辑) | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="stampEntity"></param> | |||
void SaveEntity(string keyValue, StampPersonalEntity stampEntity); | |||
/// <summary> | |||
/// 删除印章信息 | |||
/// </summary> | |||
/// <param name="keyVlaue"></param> | |||
void DeleteEntity(string keyVlaue); | |||
/// <summary> | |||
/// 更新数据状态 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="state">状态 1启用 0禁用</param> | |||
void UpdateState(string keyValue, int state); | |||
#endregion | |||
#region 扩展方法 | |||
/// <summary> | |||
/// 获取图片 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
void GetImg(string keyValue); | |||
/// <summary> | |||
/// 密码匹配 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="password">密码</param> | |||
/// <returns></returns> | |||
bool EqualPassword(string keyValue, string Password); | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,214 @@ | |||
using Dapper; | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Text; | |||
namespace Learun.Application.OA.StampPersonal | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V6.1.6.0 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2017 上海力软信息技术有限公司 | |||
/// 创建人:力软-框架开发组(王飞) | |||
/// 日 期:2022.12.05 | |||
/// 描 述:个人印章管理 | |||
/// </summary> | |||
public class StampPersonalService : RepositoryFactory | |||
{ | |||
#region 构造函数和属性 | |||
private string fieldSql; | |||
public StampPersonalService() | |||
{ | |||
//sql字段 | |||
fieldSql = @" | |||
* | |||
"; | |||
} | |||
#endregion | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取印章信息(根据名称/状态:启用或停用模糊查询) | |||
/// </summary> | |||
/// <param name="keyWord">名称/状态</param> | |||
/// <returns></returns> | |||
public IEnumerable<StampPersonalEntity> GetList(string keyWord, string userId) | |||
{ | |||
try | |||
{ | |||
StringBuilder Sql = new StringBuilder(); | |||
Sql.Append("SELECT"); | |||
Sql.Append(this.fieldSql); | |||
Sql.Append("FROM LR_Base_StampPersonal s where 1=1 "); | |||
Sql.Append("and s.F_EnabledMark =1 "); | |||
if (!string.IsNullOrEmpty(keyWord)) | |||
{// cbb 如果没有查询条件则不需要输入 | |||
Sql.AppendFormat(" and s.F_StampName LIKE '%{0}%'", keyWord); | |||
} | |||
if (!string.IsNullOrEmpty(userId)) | |||
{ | |||
Sql.AppendFormat(" and s.F_CreateUserId = '{0}'", userId); | |||
} | |||
Sql.Append(" Order by F_Sort"); | |||
return this.BaseRepository().FindList<StampPersonalEntity>(Sql.ToString()); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取列表分页数据 | |||
/// <param name="pagination">分页参数</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public IEnumerable<StampPersonalEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
var queryParam = queryJson.ToJObject(); | |||
var dp = new DynamicParameters(new { }); | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(fieldSql); | |||
strSql.Append(" FROM LR_Base_StampPersonal s Where 1=1 "); | |||
if (queryParam.HasValues) | |||
{ | |||
if (!queryParam["F_StampName"].IsEmpty()) | |||
{ | |||
dp.Add("F_StampName", "%" + queryParam["F_StampName"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND s.F_StampName like @F_StampName "); | |||
} | |||
if (!queryParam["F_EnabledMark"].IsEmpty()) | |||
{ | |||
dp.Add("F_EnabledMark", queryParam["F_EnabledMark"].ToString(), DbType.String); | |||
strSql.Append(" AND s.F_EnabledMark=@F_EnabledMark"); | |||
} | |||
if (!queryParam["F_StampType"].IsEmpty()) | |||
{ | |||
dp.Add("F_StampType", queryParam["F_StampType"].ToString(), DbType.String); | |||
strSql.Append(" AND s.F_StampType = @F_StampType"); | |||
} | |||
if (!queryParam["F_CreateUserId"].IsEmpty()) | |||
{ | |||
dp.Add("F_CreateUserId", queryParam["F_CreateUserId"].ToString(), DbType.String); | |||
strSql.Append(" AND s.F_CreateUserId = @F_CreateUserId"); | |||
} | |||
} | |||
return this.BaseRepository().FindList<StampPersonalEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取印章实体 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public StampPersonalEntity GetEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindEntity<StampPersonalEntity>(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 保存印章信息(新增/编辑) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="stampEntity">实体</param> | |||
public void SaveEntity(string keyValue, StampPersonalEntity entity) | |||
{ | |||
try | |||
{ | |||
//如果keyValue值为空或者null,表示,当前的操作是添加,否则是修改 | |||
if (string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Create(); | |||
this.BaseRepository().Insert(entity); | |||
} | |||
else | |||
{ | |||
entity.Modify(keyValue); | |||
this.BaseRepository().Update(entity); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 删除印章信息 | |||
/// </summary> | |||
/// <param name="keyVlaue">主键</param> | |||
public void DeleteEntity(string keyVlaue) | |||
{ | |||
try | |||
{ | |||
this.BaseRepository().Delete<StampPersonalEntity>(s => s.F_StampId == keyVlaue);//删除操作 | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |