|
|
@ -1,4 +1,5 @@ |
|
|
using Shentun.Peis.Books; |
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
using Shentun.Peis.Books; |
|
|
using Shentun.Peis.GuidTypes; |
|
|
using Shentun.Peis.GuidTypes; |
|
|
using Shentun.Peis.Models; |
|
|
using Shentun.Peis.Models; |
|
|
using System; |
|
|
using System; |
|
|
@ -15,6 +16,10 @@ using Volo.Abp.ObjectMapping; |
|
|
|
|
|
|
|
|
namespace Shentun.Peis.GuideTypes |
|
|
namespace Shentun.Peis.GuideTypes |
|
|
{ |
|
|
{ |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 指引类别
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ApiExplorerSettings(GroupName = "Work")] |
|
|
public class GuideTypeAppService : CrudAppService< |
|
|
public class GuideTypeAppService : CrudAppService< |
|
|
GuideType, //The Book entity
|
|
|
GuideType, //The Book entity
|
|
|
GuideTypeDto, //Used to show books
|
|
|
GuideTypeDto, //Used to show books
|
|
|
@ -23,6 +28,7 @@ namespace Shentun.Peis.GuideTypes |
|
|
CreateGuideTypeDto, |
|
|
CreateGuideTypeDto, |
|
|
UpdateGuideTypeDto> |
|
|
UpdateGuideTypeDto> |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
private readonly GuideTypeManager _manager; |
|
|
private readonly GuideTypeManager _manager; |
|
|
public GuideTypeAppService( |
|
|
public GuideTypeAppService( |
|
|
IRepository<GuideType, Guid> repository, |
|
|
IRepository<GuideType, Guid> repository, |
|
|
@ -38,7 +44,7 @@ namespace Shentun.Peis.GuideTypes |
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
public override async Task<GuideTypeDto> GetAsync(Guid id) |
|
|
public override async Task<GuideTypeDto> 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 Exception("标准异常测试");
|
|
|
//throw new BusinessException("业务异常测试");
|
|
|
//throw new BusinessException("业务异常测试");
|
|
|
//throw new UserFriendlyException("友好异常测试");
|
|
|
//throw new UserFriendlyException("友好异常测试");
|
|
|
@ -47,7 +53,7 @@ namespace Shentun.Peis.GuideTypes |
|
|
if (entity == null) |
|
|
if (entity == null) |
|
|
return null; |
|
|
return null; |
|
|
return ObjectMapper.Map<GuideType, GuideTypeDto>(entity); |
|
|
return ObjectMapper.Map<GuideType, GuideTypeDto>(entity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 获取列表
|
|
|
/// 获取列表
|
|
|
@ -81,7 +87,7 @@ namespace Shentun.Peis.GuideTypes |
|
|
{ |
|
|
{ |
|
|
var entity = await Repository.GetAsync(id); |
|
|
var entity = await Repository.GetAsync(id); |
|
|
var sourceEntity = ObjectMapper.Map<UpdateGuideTypeDto, GuideType>(input); |
|
|
var sourceEntity = ObjectMapper.Map<UpdateGuideTypeDto, GuideType>(input); |
|
|
await _manager.UpdateAsync(sourceEntity,entity); |
|
|
|
|
|
|
|
|
await _manager.UpdateAsync(sourceEntity, entity); |
|
|
entity = await Repository.UpdateAsync(entity); |
|
|
entity = await Repository.UpdateAsync(entity); |
|
|
return ObjectMapper.Map<GuideType, GuideTypeDto>(entity); |
|
|
return ObjectMapper.Map<GuideType, GuideTypeDto>(entity); |
|
|
} |
|
|
} |
|
|
@ -95,5 +101,29 @@ namespace Shentun.Peis.GuideTypes |
|
|
return base.DeleteAsync(id); |
|
|
return base.DeleteAsync(id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 修改排序 相邻之间
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">需要修改的ID</param>
|
|
|
|
|
|
/// <param name="targetid">目标ID</param>
|
|
|
|
|
|
[HttpPut("api/app/guidetype/updatesort")] |
|
|
|
|
|
public async Task UpdateSortAsync(Guid id, Guid targetid) |
|
|
|
|
|
{ |
|
|
|
|
|
await EntityHelper.UpdateSort(Repository, id, targetid); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 修改排序 置顶,置底
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">需要修改的ID</param>
|
|
|
|
|
|
/// <param name="SortType">修改方式:1 置顶 2 置底</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut("api/app/guidetype/updatemanysort")] |
|
|
|
|
|
public async Task UpdateManySortAsync(Guid id, int SortType) |
|
|
|
|
|
{ |
|
|
|
|
|
await EntityHelper.UpdateManySortAsync(Repository, id, SortType); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |