using GDZZ.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using System.Collections.Generic;
using System;
using GDZZ.Core.Service;
namespace GDZZ.Application
{
///
/// 意见反馈服务
///
[ApiDescriptionSettings("Application",Name = "FeedBack", Order = 1)]
public class FeedBackService : IFeedBackService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository _rep;
public FeedBackService(SqlSugarRepository rep)
{
_rep = rep;
}
///
/// 分页查询意见反馈
///
///
///
[HttpGet("/FeedBack/page")]
public async Task QueryNoticePageList([FromQuery] NoticeInput input)
{
var notices = await _rep.AsQueryable()
.ToPagedListAsync(input.PageNo, input.PageSize);
return notices.XnPagedResult();
}
///
/// 获取意见反馈
///
///
[HttpGet("Mini/GetFeedBackList")]
public async Task GetFeedBackList()
{
return await _rep.AsQueryable()
.Filter("TenantId", true)
.Where(x => x.CreatedUserId == UserManager.UserId).ToListAsync();
}
///
/// 添加意见反馈
///
///
///
[HttpPost("Mini/AddFeedBack")]
public async Task AddFeedBack(FeedBackInput backInput)
{
var entity = backInput.Adapt();
await _rep.InsertAsync(entity);
}
///
/// 添加意见反馈
///
///
///
[HttpPost("Mini/UpFeedBack")]
public async Task UpFeedBack(FeedBackInput backInput)
{
var entity = backInput.Adapt();
await _rep.InsertAsync(entity);
}
}
}