修复页面加载不出的问题
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
@@ -6,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DTOModel;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.Repository;
|
||||
@@ -20,9 +22,11 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
public class ArticleController : BaseSimpleCrudController<ArticleEntity>
|
||||
{
|
||||
private IArticleService _iArticleService;
|
||||
public ArticleController(ILogger<ArticleEntity> logger, IArticleService iArticleService) : base(logger, iArticleService)
|
||||
private IMapper _mapper;
|
||||
public ArticleController(ILogger<ArticleEntity> logger, IArticleService iArticleService, IMapper mapper) : base(logger, iArticleService)
|
||||
{
|
||||
_iArticleService = iArticleService;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +38,8 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] ArticleEntity entity, [FromQuery] PageParModel page)
|
||||
{
|
||||
return Result.Success().SetData(await _iArticleService.SelctPageList(entity, page));
|
||||
var pageData= await _iArticleService.SelctPageList(entity, page);
|
||||
return Result.Success().SetData(new PageModel() { Data = _mapper.Map<List<ArticleVo>>(pageData.Data), Total = pageData.Total }) ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,7 +49,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
/// <returns></returns>
|
||||
public override Task<Result> Add(ArticleEntity entity)
|
||||
{
|
||||
entity.UserId=HttpContext.GetUserIdInfo();
|
||||
entity.UserId = HttpContext.GetUserIdInfo();
|
||||
return base.Add(entity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user