浏览器版本推荐 --迁移
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 09:29:36
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
/// <summary> ExploreRecommendView 列表视图模型 </summary>
|
||||
public class ExploreRecommendView
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Title { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
public string DownloadUrl { get; set; }
|
||||
public string Path { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public DateTime? DeleteTime { get; set; }
|
||||
public Guid? DeleteUserId { get; set; }
|
||||
}
|
||||
|
||||
///<summary>ExploreRecommendQuery 列表查询参数模型</summary>
|
||||
public class ExploreRecommendQuery:PageInput
|
||||
{
|
||||
|
||||
public string? Version { get; set; }
|
||||
|
||||
|
||||
public string? Title { get; set; }
|
||||
|
||||
|
||||
public string? DownloadUrl { get; set; }
|
||||
|
||||
|
||||
public string? FileName { get; set; }
|
||||
|
||||
public bool? IsDeleted { get; set; }
|
||||
|
||||
}
|
||||
|
||||
///<summary> ExploreRecommendAddOrEdit 列表查询参数模型</summary>
|
||||
public class ExploreRecommendAddOrEdit
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Title { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
public string DownloadUrl { get; set; }
|
||||
public string Path { get; set; }
|
||||
public string FileName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 09:26:59
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// ExploreRecommendService
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Common")]
|
||||
public class ExploreRecommendService : BaseService, IExploreRecommendService
|
||||
{
|
||||
|
||||
private readonly IRepository<ExploreRecommend> _exploreRecommendRepository;
|
||||
|
||||
public ExploreRecommendService(IRepository<ExploreRecommend> exploreRecommendRepository)
|
||||
{
|
||||
_exploreRecommendRepository = exploreRecommendRepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<ExploreRecommendView>> GetExploreRecommendList(ExploreRecommendQuery inQuery)
|
||||
{
|
||||
|
||||
var exploreRecommendQueryable =
|
||||
|
||||
_exploreRecommendRepository
|
||||
.WhereIf(string.IsNullOrEmpty(inQuery.Title), t => t.Title.Contains(inQuery.Title))
|
||||
.WhereIf(string.IsNullOrEmpty(inQuery.FileName), t => t.Title.Contains(inQuery.FileName))
|
||||
.WhereIf(string.IsNullOrEmpty(inQuery.DownloadUrl), t => t.Title.Contains(inQuery.DownloadUrl))
|
||||
.WhereIf(string.IsNullOrEmpty(inQuery.Version), t => t.Title.Contains(inQuery.Version))
|
||||
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == t.IsDeleted)
|
||||
.ProjectTo<ExploreRecommendView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = await exploreRecommendQueryable
|
||||
.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(ExploreRecommendView.Id) : inQuery.SortField,
|
||||
inQuery.Asc);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateExploreRecommend(ExploreRecommendAddOrEdit addOrEditExploreRecommend)
|
||||
{
|
||||
var verifyExp2 = new EntityVerifyExp<ExploreRecommend>()
|
||||
{
|
||||
VerifyExp = u => u.IsDeleted == addOrEditExploreRecommend.IsDeleted,
|
||||
|
||||
VerifyMsg = "当前启用版本只允许有一个",
|
||||
|
||||
IsVerify = addOrEditExploreRecommend.IsDeleted == false
|
||||
};
|
||||
|
||||
var entity = await _exploreRecommendRepository.InsertOrUpdateAsync(addOrEditExploreRecommend, true, verifyExp2);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{exploreRecommendId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteExploreRecommend(Guid exploreRecommendId)
|
||||
{
|
||||
var success = await _exploreRecommendRepository.DeleteFromQueryAsync(t => t.Id == exploreRecommendId, true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task<ExploreRecommendView> GetExploreRecommentInfo()
|
||||
{
|
||||
|
||||
|
||||
var result = await _exploreRecommendRepository.Where(t => t.IsDeleted == false).ProjectTo<ExploreRecommendView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new QueryBusinessObjectNotExistException("系统浏览器版本推荐未维护,请联系维护人员");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 09:27:36
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// IExploreRecommendService
|
||||
/// </summary>
|
||||
public interface IExploreRecommendService
|
||||
{
|
||||
|
||||
Task<PageOutput<ExploreRecommendView>> GetExploreRecommendList(ExploreRecommendQuery inQuery);
|
||||
|
||||
Task<IResponseOutput> AddOrUpdateExploreRecommend(ExploreRecommendAddOrEdit addOrEditExploreRecommend);
|
||||
|
||||
Task<IResponseOutput> DeleteExploreRecommend(Guid exploreRecommendId);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -80,8 +80,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<PublishLog, PublishLogAddOrEdit>().ReverseMap();
|
||||
|
||||
CreateMap<PublishLog, PublishVersionSelect>();
|
||||
|
||||
|
||||
CreateMap<ExploreRecommend, ExploreRecommendView>();
|
||||
CreateMap<ExploreRecommend, ExploreRecommendAddOrEdit>().ReverseMap();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user