update 登录页背景, 组织机构code非必填, dapper查询优化
This commit is contained in:
@@ -137,7 +137,7 @@ namespace Ewide.Core
|
||||
/// <summary>
|
||||
/// 已有相同组织机构,编码或名称相同
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已有相同组织机构,编码或名称相同")]
|
||||
[ErrorCodeItemMetadata("已有相同编码组织机构")]
|
||||
D2002,
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5557,11 +5557,6 @@
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.AddOrgInput.Code">
|
||||
<summary>
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.AddOrgInput.AreaCode">
|
||||
<summary>
|
||||
机构所在区域
|
||||
|
||||
@@ -17,13 +17,14 @@ namespace Ewide.Core.Extension.DataFilter.WebPage
|
||||
protected IEnumerable<string> OtherRangeFields;
|
||||
public DynamicParameters sqlParameters = new DynamicParameters();
|
||||
|
||||
public SearchJsonFitlerInfoGetService(PageInputBase input, IEnumerable<string> equalsFields, IEnumerable<string> likeFields, IEnumerable<string> dateRangeFields, IEnumerable<string> otherRangeFields)
|
||||
public SearchJsonFitlerInfoGetService(PageInputBase input, IEnumerable<string> equalsFields, IEnumerable<string> likeFields, IEnumerable<string> dateRangeFields, IEnumerable<string> otherRangeFields, object param = null)
|
||||
{
|
||||
Input = input;
|
||||
EqualsFields = equalsFields;
|
||||
LikeFields = likeFields;
|
||||
DateRangeFields = dateRangeFields;
|
||||
OtherRangeFields = otherRangeFields;
|
||||
sqlParameters = new DynamicParameters(param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -125,12 +125,12 @@ namespace Ewide.Core.Extension
|
||||
}
|
||||
|
||||
#region DAPPER
|
||||
public async static Task<PagedList> QueryPageDataDynamic(this IDapperRepository source, string baseSql, PageInputBase input, IEnumerable<string> equalsFields = null, IEnumerable<string> likeFields = null, IEnumerable<string> dateTimeRangeFields = null, IEnumerable<string> otherRangeFields = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
public async static Task<PagedList> QueryPageDataDynamic(this IDapperRepository source, string baseSql, PageInputBase input, object param = null, IEnumerable<string> equalsFields = null, IEnumerable<string> likeFields = null, IEnumerable<string> dateTimeRangeFields = null, IEnumerable<string> otherRangeFields = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
{
|
||||
SearchJsonFitlerInfoGetService searchJsonFitlerInfoGetService = new SearchJsonFitlerInfoGetService(input, equalsFields, likeFields, dateTimeRangeFields, otherRangeFields);
|
||||
SearchJsonFitlerInfoGetService searchJsonFitlerInfoGetService = new SearchJsonFitlerInfoGetService(input, equalsFields, likeFields, dateTimeRangeFields, otherRangeFields, param);
|
||||
var sql = searchJsonFitlerInfoGetService.GetWhereSql(baseSql);
|
||||
var param = searchJsonFitlerInfoGetService.sqlParameters;
|
||||
return await QueryPageData(source, sql, input, param, transaction, commandTimeout, commandType);
|
||||
var sqlParam = searchJsonFitlerInfoGetService.sqlParameters;
|
||||
return await QueryPageData(source, sql, input, sqlParam, transaction, commandTimeout, commandType);
|
||||
}
|
||||
|
||||
public async static Task<PagedList> QueryPageData(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
|
||||
@@ -65,11 +65,6 @@ namespace Ewide.Core.Service
|
||||
[Required(ErrorMessage = "机构名称不能为空")]
|
||||
public override string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "机构编码不能为空")]
|
||||
public override string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 机构所在区域
|
||||
/// </summary>
|
||||
|
||||
@@ -125,9 +125,12 @@ namespace Ewide.Core.Service
|
||||
[HttpPost("/sysOrg/add")]
|
||||
public async Task AddOrg(AddOrgInput input)
|
||||
{
|
||||
var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => u.Name == input.Name || u.Code == input.Code);
|
||||
if (isExist)
|
||||
throw Oops.Oh(ErrorCode.D2002);
|
||||
if (!string.IsNullOrEmpty(input.Code))
|
||||
{
|
||||
var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => u.Code == input.Code);
|
||||
if (isExist)
|
||||
throw Oops.Oh(ErrorCode.D2002);
|
||||
}
|
||||
|
||||
if (!_userManager.SuperAdmin)
|
||||
{
|
||||
@@ -236,9 +239,12 @@ namespace Ewide.Core.Service
|
||||
if (!_userManager.SuperAdmin && (dataScopes.Count < 1 || !dataScopes.Contains(sysOrg.Id)))
|
||||
throw Oops.Oh(ErrorCode.D2003);
|
||||
|
||||
var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => (u.Name == input.Name || u.Code == input.Code) && u.Id != sysOrg.Id);
|
||||
if (isExist)
|
||||
throw Oops.Oh(ErrorCode.D2002);
|
||||
if (!string.IsNullOrEmpty(input.Code))
|
||||
{
|
||||
var isExist = await _sysOrgRep.DetachedEntities.AnyAsync(u => u.Code == input.Code && u.Id != sysOrg.Id);
|
||||
if (isExist)
|
||||
throw Oops.Oh(ErrorCode.D2002);
|
||||
}
|
||||
|
||||
// 如果名称有变化,则修改对应员工的机构相关信息
|
||||
if (!sysOrg.Name.Equals(input.Name))
|
||||
|
||||
Reference in New Issue
Block a user