自动生成定义管理通用代码

This commit is contained in:
陈淳
2023-01-04 15:46:29 +08:00
parent a27d83a5e3
commit 5f6d29a3f8
44 changed files with 2112 additions and 13 deletions

View File

@@ -0,0 +1,32 @@
using AutoMapper;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.DtoModel.ERP.Unit;
using Yi.Framework.Interface.ERP;
using Yi.Framework.Model.ERP.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service.Base.Crud;
namespace Yi.Framework.Service.ERP
{
public class UnitService : CrudAppService<UnitEntity, UnitGetListOutput, long, UnitCreateUpdateInput>, IUnitService
{
public UnitService(IRepository<UnitEntity> repository, IMapper mapper) : base(repository, mapper)
{
}
public async Task<PageModel<List<UnitGetListOutput>>> PageListAsync(UnitCreateUpdateInput input, PageParModel page)
{
RefAsync<int> totalNumber = 0;
var data = await Repository._DbQueryable
.WhereIF(input.Code is not null,u=>u.Code.Contains(input.Code))
.WhereIF(input.Name is not null, u => u.Name.Contains(input.Name))
.ToPageListAsync(page.PageNum, page.PageSize, totalNumber);
return new PageModel<List<UnitGetListOutput>> { Total = totalNumber.Value, Data = await MapToGetListOutputDtosAsync(data) };
}
}
}