diff --git a/src/Shentun.Peis.Application/GuideTypes/GuideTypeAppService.cs b/src/Shentun.Peis.Application/GuideTypes/GuideTypeAppService.cs
index b0d7263a..02dfcf56 100644
--- a/src/Shentun.Peis.Application/GuideTypes/GuideTypeAppService.cs
+++ b/src/Shentun.Peis.Application/GuideTypes/GuideTypeAppService.cs
@@ -1,4 +1,5 @@
-using Shentun.Peis.Books;
+using Microsoft.AspNetCore.Mvc;
+using Shentun.Peis.Books;
using Shentun.Peis.GuidTypes;
using Shentun.Peis.Models;
using System;
@@ -15,6 +16,10 @@ using Volo.Abp.ObjectMapping;
namespace Shentun.Peis.GuideTypes
{
+ ///
+ /// 指引类别
+ ///
+ [ApiExplorerSettings(GroupName = "Work")]
public class GuideTypeAppService : CrudAppService<
GuideType, //The Book entity
GuideTypeDto, //Used to show books
@@ -23,6 +28,7 @@ namespace Shentun.Peis.GuideTypes
CreateGuideTypeDto,
UpdateGuideTypeDto>
{
+
private readonly GuideTypeManager _manager;
public GuideTypeAppService(
IRepository repository,
@@ -38,7 +44,7 @@ namespace Shentun.Peis.GuideTypes
///
public override async Task GetAsync(Guid id)
{
- var entity = await Repository.FindAsync(o=>o.Id == id);
+ var entity = await Repository.FindAsync(o => o.Id == id);
//throw new Exception("标准异常测试");
//throw new BusinessException("业务异常测试");
//throw new UserFriendlyException("友好异常测试");
@@ -47,7 +53,7 @@ namespace Shentun.Peis.GuideTypes
if (entity == null)
return null;
return ObjectMapper.Map(entity);
-
+
}
///
/// 获取列表
@@ -81,7 +87,7 @@ namespace Shentun.Peis.GuideTypes
{
var entity = await Repository.GetAsync(id);
var sourceEntity = ObjectMapper.Map(input);
- await _manager.UpdateAsync(sourceEntity,entity);
+ await _manager.UpdateAsync(sourceEntity, entity);
entity = await Repository.UpdateAsync(entity);
return ObjectMapper.Map(entity);
}
@@ -95,5 +101,29 @@ namespace Shentun.Peis.GuideTypes
return base.DeleteAsync(id);
}
+
+
+ ///
+ /// 修改排序 相邻之间
+ ///
+ /// 需要修改的ID
+ /// 目标ID
+ [HttpPut("api/app/guidetype/updatesort")]
+ public async Task UpdateSortAsync(Guid id, Guid targetid)
+ {
+ await EntityHelper.UpdateSort(Repository, id, targetid);
+ }
+
+ ///
+ /// 修改排序 置顶,置底
+ ///
+ /// 需要修改的ID
+ /// 修改方式:1 置顶 2 置底
+ ///
+ [HttpPut("api/app/guidetype/updatemanysort")]
+ public async Task UpdateManySortAsync(Guid id, int SortType)
+ {
+ await EntityHelper.UpdateManySortAsync(Repository, id, SortType);
+ }
}
}
diff --git a/src/Shentun.Peis.Application/MedicalReportTypes/MedicalReportTypeAppService.cs b/src/Shentun.Peis.Application/MedicalReportTypes/MedicalReportTypeAppService.cs
index 48f8ba52..eedce638 100644
--- a/src/Shentun.Peis.Application/MedicalReportTypes/MedicalReportTypeAppService.cs
+++ b/src/Shentun.Peis.Application/MedicalReportTypes/MedicalReportTypeAppService.cs
@@ -1,4 +1,5 @@
-using Shentun.Peis.Books;
+using Microsoft.AspNetCore.Mvc;
+using Shentun.Peis.Books;
using Shentun.Peis.GuidTypes;
using Shentun.Peis.Models;
using System;
@@ -15,6 +16,10 @@ using Volo.Abp.ObjectMapping;
namespace Shentun.Peis.MedicalReportTypes
{
+ ///
+ /// 体检报告类别
+ ///
+ [ApiExplorerSettings(GroupName = "Work")]
public class MedicalReportTypeAppService : CrudAppService<
MedicalReportType, //The Book entity
MedicalReportTypeDto, //Used to show books
@@ -95,5 +100,27 @@ namespace Shentun.Peis.MedicalReportTypes
return base.DeleteAsync(id);
}
+ ///
+ /// 修改排序 相邻之间
+ ///
+ /// 需要修改的ID
+ /// 目标ID
+ [HttpPut("api/app/medicalreporttype/updatesort")]
+ public async Task UpdateSortAsync(Guid id, Guid targetid)
+ {
+ await EntityHelper.UpdateSort(Repository, id, targetid);
+ }
+
+ ///
+ /// 修改排序 置顶,置底
+ ///
+ /// 需要修改的ID
+ /// 修改方式:1 置顶 2 置底
+ ///
+ [HttpPut("api/app/medicalreporttype/updatemanysort")]
+ public async Task UpdateManySortAsync(Guid id, int SortType)
+ {
+ await EntityHelper.UpdateManySortAsync(Repository, id, SortType);
+ }
}
}
diff --git a/src/Shentun.Peis.Application/Sexs/SexAppService.cs b/src/Shentun.Peis.Application/Sexs/SexAppService.cs
new file mode 100644
index 00000000..0927169b
--- /dev/null
+++ b/src/Shentun.Peis.Application/Sexs/SexAppService.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shentun.Peis.Sexs
+{
+ public class SexAppService
+ {
+ }
+}
diff --git a/src/Shentun.Peis.Domain/EntityHelper.cs b/src/Shentun.Peis.Domain/EntityHelper.cs
index 9a4e2f01..4153403e 100644
--- a/src/Shentun.Peis.Domain/EntityHelper.cs
+++ b/src/Shentun.Peis.Domain/EntityHelper.cs
@@ -1,8 +1,10 @@
-using System;
+using Shentun.Peis.Models;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
@@ -16,11 +18,101 @@ namespace Shentun.Peis
///
///
///
- public static async Task CreateMaxDisplayOrder(IRepository repository)
- where TEntity: class, IEntity,IDisplayOrder
+ public static async Task CreateMaxDisplayOrder(IRepository repository)
+ where TEntity : class, IEntity, IDisplayOrder
{
int? maxDisplayOrder = await repository.MaxAsync(o => (int?)o.DisplayOrder);
return (maxDisplayOrder ?? 0) + 1;
}
+
+
+ ///
+ /// 修改排序,相邻之间修改
+ ///
+ ///
+ ///
+ /// 当前ID
+ /// 目标ID
+ ///
+ public static async Task UpdateSort(IRepository repository, Guid id, Guid targetid)
+ where TEntity : class, IEntity, IDisplayOrder
+ {
+ var entity = await repository.GetAsync(id);
+ var targetentity = await repository.GetAsync(targetid);
+
+ int olddisplaynum = entity.DisplayOrder;
+ entity.DisplayOrder = targetentity.DisplayOrder;
+ targetentity.DisplayOrder = olddisplaynum;
+
+ List entlist = new List();
+ entlist.Add(entity);
+ entlist.Add(targetentity);
+
+ await repository.UpdateManyAsync(entlist);
+
+ }
+
+
+ ///
+ /// 修改排序 置顶,置底
+ ///
+ ///
+ ///
+ /// 需要修改的ID
+ /// 修改方式:1 置顶 2 置底
+ ///
+ public static async Task UpdateManySortAsync(IRepository repository, Guid id, int SortType)
+ where TEntity : class, IEntity, IDisplayOrder
+ {
+ var entity = await repository.GetAsync(id);
+
+ List UptList = new List();
+
+ if (SortType == 1)
+ {
+ UptList = (await repository.GetListAsync(o => o.DisplayOrder > entity.DisplayOrder)).OrderBy(o => o.DisplayOrder).ToList();
+
+ if (UptList.Count > 0)
+ {
+
+ int indexnum = entity.DisplayOrder; //原有值
+
+ entity.DisplayOrder = UptList[UptList.Count - 1].DisplayOrder; //修改当前排序值为最大
+
+ //置顶操作,往上一行开始,逐渐替换
+ foreach (var item in UptList)
+ {
+ int dqnum = item.DisplayOrder;
+ item.DisplayOrder = indexnum;
+ indexnum = dqnum;
+ }
+ }
+ }
+ else
+ {
+ UptList = (await repository.GetListAsync(o => o.DisplayOrder < entity.DisplayOrder)).OrderByDescending(o => o.DisplayOrder).ToList(); ;
+
+ int indexnum = entity.DisplayOrder; //原有值
+
+ entity.DisplayOrder = UptList[UptList.Count - 1].DisplayOrder; //修改当前排序值为最小
+
+ //置底操作,往下一行开始,逐渐替换
+ foreach (var item in UptList)
+ {
+ int dqnum = item.DisplayOrder;
+ item.DisplayOrder = indexnum;
+ indexnum = dqnum;
+ }
+ }
+
+
+ UptList.Add(entity);
+
+
+ await repository.UpdateManyAsync(UptList);
+
+ }
+
+
}
}