# YiTemplate

Id: 7a6f5c62-b77e-871b-eafc-3a10d2e93168
BuildPath: D:\code\Entities\@ModelEntity.cs
Name: Entity
Remarks: 实体
TemplateStr:
  using SqlSugar;
  using Volo.Abp;
  using Volo.Abp.Auditing;
  using Volo.Abp.Domain.Entities;
  using Yi.Framework.Core.Data;

  namespace Yi.Framework.Rbac.Domain.Entities
  {
      /// <summary>
      /// 实体
      /// </summary>
      [SugarTable("@Model")]
      public class @ModelEntity : Entity<Guid>
      {
  @field
      }
  }


Id: 93d4282c-2bd9-14bd-7644-3a10d2e93168
BuildPath: D:\code\Dtos\@Model\@ModelGetListInput.cs
Name: GetListInput
Remarks: 列表查询参数
TemplateStr:
  using Yi.Framework.Ddd;
  using Yi.Framework.Ddd.Application.Contracts;

  namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model
  {
      /// <summary>
      /// 查询参数
      /// </summary>
      public class @ModelGetListInputVo : PagedAllResultRequestDto
      {
  @field
      }
  }


Id: 3c2dc24d-e4b1-f2e8-3fce-3a10d2e93169
BuildPath: D:\code\Dtos\@Model\@ModelGetListOutputDto.cs
Name: GetListOutputDto
Remarks: 列表返回dto
TemplateStr:
  using Volo.Abp.Application.Dtos;

  namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model
  {
      public class @ModelGetListOutputDto : EntityDto<Guid>
      {
  @field
      }
  }


Id: 5ee816c5-c965-1733-b051-3a10d2e93169
BuildPath: D:\code\Dtos\@Model\@ModelGetOutputDto.cs
Name: GetOutputDto
Remarks: 单返回dto
TemplateStr:
  using Volo.Abp.Application.Dtos;

  namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model
  {
      public class @ModelGetOutputDto : EntityDto<Guid>
      {
  @field
      }
  }


Id: 373afd94-7d92-f53f-b1e7-3a10d2e93169
BuildPath: D:\code\Dtos\@Model\@ModelUpdateInput.cs
Name: UpdateInput
Remarks: 更新输入
TemplateStr:
  namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model
  {
      public class @ModelUpdateInput
      {
  @field
      }
  }


Id: 3c1bf0fc-859a-dab0-1044-3a10d2e93169
BuildPath: D:\code\Dtos\@Model\@ModelCreateInput.cs
Name: CreateInput
Remarks: 创建dto
TemplateStr:
  namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model
  {
      /// <summary>
      /// @Model输入创建对象
      /// </summary>
      public class @ModelCreateInput
      {
  @field
      }
  }


Id: 7407b18f-b2df-ae73-1010-3a10d2e93169
BuildPath: D:\code\IServices\I@ModelService.cs
Name: IServices
Remarks: 应用服务抽象
TemplateStr:
  using Volo.Abp.Application.Services;
  using Yi.Framework.Ddd.Application.Contracts;
  using Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;

  namespace Yi.Framework.Rbac.Application.Contracts.IServices
  {
      /// <summary>
      /// @Model服务抽象
      /// </summary>
      public interface I@ModelService : IYiCrudAppService<@ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInputVo, @ModelCreateInputVo, @ModelUpdateInputVo>
      {

      }
  }


Id: 65b01798-21ca-9d0f-d018-3a10d2e93169
BuildPath: D:\code\Services\@ModelService.cs
Name: Service
Remarks: 应用服务
TemplateStr:
  using SqlSugar;
  using Volo.Abp.Application.Dtos;
  using Volo.Abp.Application.Services;
  using Yi.Framework.Ddd.Application;
  using Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;
  using Yi.Framework.Rbac.Application.Contracts.IServices;
  using Yi.Framework.Rbac.Domain.Entities;
  using Yi.Framework.SqlSugarCore.Abstractions;

  namespace Yi.Framework.Rbac.Application.Services
  {
      /// <summary>
      /// @Model服务实现
      /// </summary>
      public class @ModelService : YiCrudAppService<@ModelEntity, @ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInputVo, @ModelCreateInputVo, @ModelUpdateInputVo>,
         I@ModelService
      {
          private ISqlSugarRepository<@ModelEntity, Guid> _repository;
          public @ModelService(ISqlSugarRepository<@ModelEntity, Guid> repository) : base(repository)
          {
              _repository = repository;
          }

          /// <summary>
          /// 多查
          /// </summary>
          /// <param name="input"></param>
          /// <returns></returns>
          public override async Task<PagedResultDto<@ModelGetListOutputDto>> GetListAsync(@ModelGetListInputVo input)
          {
              RefAsync<int> total = 0;

              var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.@ModelKey), x => x.@ModelKey.Contains(input.@ModelKey!))
                            .WhereIF(!string.IsNullOrEmpty(input.@ModelName), x => x.@ModelName!.Contains(input.@ModelName!))
                            .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
                            .ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
              return new PagedResultDto<@ModelGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
          }
      }
  }


