| | |
| | | using Rhea.Common; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | |
| | | public partial class MqCustomer : ICustomer |
| | | { |
| | | /// <summary> |
| | | /// 获取分页 |
| | | /// </summary> |
| | | /// <param name="pageList"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<PageAble<Customer>>> GetCustomers(PageAble<Customer> pageList) |
| | | { |
| | | var res = new ApiAction<PageAble<Customer>>(); |
| | | try |
| | | { |
| | | RefAsync<int> total = 0; |
| | | pageList.data = await Db.Queryable<Customer>().WhereIF(!string.IsNullOrEmpty(pageList.sqlcmd), x => x.CustomerCode.Contains(pageList.sqlcmd)).OrderBy(x=>x.CustomerCode).ToPageListAsync(pageList.pageIndex, pageList.pageSize, total); |
| | | pageList.totals = total; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | res.CatchExceptionWithLog(ex, "获取客户信息异常"); |
| | | } |
| | | res.Data = pageList; |
| | | return res; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取客户信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | return res; |
| | | } |
| | | |
| | | public async Task<Result> SaveImportCustomerInfo(DataTable dt) |
| | | public async Task<ApiAction> SaveImportCustomerInfo(List<Customer> list) |
| | | { |
| | | throw new NotImplementedException(); |
| | | var res = new ApiAction(); |
| | | //更新机型记录 |
| | | var db = Db; |
| | | var dbTran = await db.UseTranAsync(async () => |
| | | { |
| | | await db.Saveable(list).ExecuteCommandAsync(); |
| | | }); |
| | | if (!dbTran.IsSuccess) |
| | | { |
| | | res.IsSuccessed = false; |
| | | res.Message = $"导入异常"; |
| | | } |
| | | return res; |
| | | } |
| | | } |
| | | } |