namespace Admin.NET.Core.Service; /// /// 微信账号服务 /// [ApiDescriptionSettings(Order = 220)] public class SysWechatUserService : IDynamicApiController, ITransient { private readonly SqlSugarRepository _sysWechatUserRep; public SysWechatUserService(SqlSugarRepository sysWechatUserRep) { _sysWechatUserRep = sysWechatUserRep; } /// /// 获取微信用户列表 /// /// /// [DisplayName("获取微信用户列表")] public async Task> Page(WechatUserInput input) { return await _sysWechatUserRep.AsQueryable() .WhereIF(!string.IsNullOrWhiteSpace(input.NickName), u => u.NickName.Contains(input.NickName)) .WhereIF(!string.IsNullOrWhiteSpace(input.PhoneNumber), u => u.Mobile.Contains(input.PhoneNumber)) .OrderBy(u => u.Id, OrderByType.Desc) .ToPagedListAsync(input.Page, input.PageSize); } /// /// 增加微信用户 /// /// /// [ApiDescriptionSettings(Name = "Add"), HttpPost] [DisplayName("增加微信用户")] public async Task AddWechatUser(SysWechatUser input) { await _sysWechatUserRep.InsertAsync(input.Adapt()); } /// /// 更新微信用户 /// /// /// [ApiDescriptionSettings(Name = "Update"), HttpPost] [DisplayName("更新微信用户")] public async Task UpdateWechatUser(SysWechatUser input) { var weChatUser = input.Adapt(); await _sysWechatUserRep.AsUpdateable(weChatUser).IgnoreColumns(true).ExecuteCommandAsync(); } /// /// 删除微信用户 /// /// /// [ApiDescriptionSettings(Name = "Delete"), HttpPost] [DisplayName("删除微信用户")] public async Task DeleteWechatUser(DeleteWechatUserInput input) { await _sysWechatUserRep.DeleteAsync(u => u.Id == input.Id); } }