|
|
|
|
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;
|
|
|
|
|
namespace GDZZ.Application
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 套餐管理服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiDescriptionSettings("Application",Name = "MiniThali", Order = 1)]
|
|
|
|
|
public class MiniThaliService : IMiniThaliService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
private readonly SqlSugarRepository<MiniThali> _rep;
|
|
|
|
|
|
|
|
|
|
public MiniThaliService(SqlSugarRepository<MiniThali> rep)
|
|
|
|
|
{
|
|
|
|
|
_rep = rep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页查询套餐管理
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/MiniThali/page")]
|
|
|
|
|
public async Task<dynamic> Page([FromQuery] MiniThaliInput input)
|
|
|
|
|
{
|
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim()))
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加套餐管理
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/MiniThali/add")]
|
|
|
|
|
public async Task Add(AddMiniThaliInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<MiniThali>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除套餐管理
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/MiniThali/delete")]
|
|
|
|
|
public async Task Delete(DeleteMiniThaliInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
await _rep.DeleteAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新套餐管理
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/MiniThali/edit")]
|
|
|
|
|
public async Task Update(UpdateMiniThaliInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<MiniThali>();
|
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取套餐管理
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/MiniThali/detail")]
|
|
|
|
|
public async Task<MiniThali> Get([FromQuery] QueryeMiniThaliInput input)
|
|
|
|
|
{
|
|
|
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取套餐管理列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/MiniThali/list")]
|
|
|
|
|
public async Task<dynamic> List([FromQuery] MiniThaliInput input)
|
|
|
|
|
{
|
|
|
|
|
return await _rep.ToListAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|