Browse Source

主表 个性化导出

master
郑渤旭[Irelia] 1 year ago
parent
commit
75bee9b512
  1. 9
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBase/IZbxBase.cs
  2. 33
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBaseBusiness/ExportCustomUserSetting/Dtos/CreateUpdateExportCustomUserSettingDto.cs
  3. 37
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBaseBusiness/ExportCustomUserSetting/Dtos/ExportCustomUserSettingDto.cs
  4. 35
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBaseBusiness/ExportCustomUserSetting/Dtos/ExportCustomUserSettingGetListInput.cs
  5. 26
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBaseBusiness/ExportCustomUserSetting/IExportCustomUserSettingAppService.cs
  6. 5
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/Permissions/WininPermissionDefinitionProvider.cs
  7. 10
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/Permissions/WininPermissions.cs
  8. 69
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs
  9. 55
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingAppService.cs
  10. 4
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/WininApplicationAutoMapperProfile.cs
  11. 81
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Localization/Winin/ar.json
  12. 1
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting.cs
  13. 11
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBaseBusiness/ExportCustomUserSetting/IExportCustomUserSettingRepository.cs
  14. 22
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingEfCoreQuerableExtensions.cs
  15. 20
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingRepository.cs
  16. 17
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/EntityFrameworkCore/WininDbContext.cs
  17. 2
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/EntityFrameworkCore/WininEntityFrameworkCoreModule.cs
  18. 2087
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/Migrations/20230710132440_Added_ExportCustomUserSetting.Designer.cs
  19. 48
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/Migrations/20230710132440_Added_ExportCustomUserSetting.cs
  20. 66
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/Migrations/WininDbContextModelSnapshot.cs
  21. 6
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Menus/WininMenuContributor.cs
  22. 1
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Menus/WininMenus.cs
  23. 18
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/CreateModal.cshtml
  24. 27
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/CreateModal.cshtml.cs
  25. 19
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/EditModal.cshtml
  26. 38
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/EditModal.cshtml.cs
  27. 55
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/Index.cshtml
  28. 40
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/Index.cshtml.cs
  29. 23
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/ViewModels/CreateEditExportCustomUserSettingViewModel.cs
  30. 0
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/index.css
  31. 100
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/index.js
  32. 4
      Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/WininWebAutoMapperProfile.cs
  33. 28
      Code/Be/Faster.Zheng.Winin/test/Faster.Zheng.Winin.Application.Tests/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingAppServiceTests.cs
  34. 24
      Code/Be/Faster.Zheng.Winin/test/Faster.Zheng.Winin.Domain.Tests/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingDomainTests.cs
  35. 32
      Code/Be/Faster.Zheng.Winin/test/Faster.Zheng.Winin.EntityFrameworkCore.Tests/EntityFrameworkCore/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingRepositoryTests.cs
  36. 23
      Code/Be/Faster.Zheng.Winin/test/Faster.Zheng.Winin.Web.Tests/Pages/AppBaseBusiness/ExportCustomUserSetting/IndexTests.cs

9
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBase/IZbxBase.cs

@ -13,4 +13,13 @@ public interface IZbxBase<TEntity, TEntityDto, TPagedAndSortedResultRequestDto,
Task<PagedResultDto<TEntityDto>> GetPageListByFilterAsync(SfsRequestInputBase sfsRequestInputBase, Task<PagedResultDto<TEntityDto>> GetPageListByFilterAsync(SfsRequestInputBase sfsRequestInputBase,
bool includeDetails = false, CancellationToken cancellationToken = default); bool includeDetails = false, CancellationToken cancellationToken = default);
/// <summary>
/// 【基础】-【导出Excel】【有筛选条件】
/// </summary>
/// <param name="sfsRequestInputBase">查询条件</param>
/// <param name="isRedundance">是否冗余主表数据</param>
/// <param name="isDetailExport">是否导出子表</param>
/// <param name="userId">用户ID</param>
/// <returns></returns>
Task<IActionResult> ExportToExcelAsync(SfsRequestInputBase sfsRequestInputBase,bool isRedundance, Guid userId,bool isDetailExport = true);
} }

33
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBaseBusiness/ExportCustomUserSetting/Dtos/CreateUpdateExportCustomUserSettingDto.cs

@ -0,0 +1,33 @@
using System;
using Faster.Zheng.Winin.Enums;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
[Serializable]
public class CreateUpdateExportCustomUserSettingDto
{
/// <summary>
/// 用户ID
/// </summary>
public Guid ExportUserId { get; set; }
/// <summary>
/// 用户姓名
/// </summary>
public string ExportUserName { get; set; }
/// <summary>
/// 列名
/// </summary>
public string ExportColumnName { get; set; }
/// <summary>
/// 表名
/// </summary>
public string ExportTableName { get; set; }
/// <summary>
/// 导出设置项
/// </summary>
public Enum_ExportCustomUserSetting CustomUserSetting { get; set; }
}

37
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBaseBusiness/ExportCustomUserSetting/Dtos/ExportCustomUserSettingDto.cs

@ -0,0 +1,37 @@
using System;
using Faster.Zheng.Winin.Enums;
using Volo.Abp.Application.Dtos;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
/// <summary>
/// 用户个型导出配置
/// </summary>
[Serializable]
public class ExportCustomUserSettingDto : AuditedEntityDto<Guid>
{
/// <summary>
/// 用户ID
/// </summary>
public Guid ExportUserId { get; set; }
/// <summary>
/// 用户姓名
/// </summary>
public string ExportUserName { get; set; }
/// <summary>
/// 列名
/// </summary>
public string ExportColumnName { get; set; }
/// <summary>
/// 表名
/// </summary>
public string ExportTableName { get; set; }
/// <summary>
/// 导出设置项
/// </summary>
public Enum_ExportCustomUserSetting CustomUserSetting { get; set; }
}

35
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBaseBusiness/ExportCustomUserSetting/Dtos/ExportCustomUserSettingGetListInput.cs

@ -0,0 +1,35 @@
using System;
using System.ComponentModel;
using Faster.Zheng.Winin.Enums;
using Volo.Abp.Application.Dtos;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
[Serializable]
public class ExportCustomUserSettingGetListInput : PagedAndSortedResultRequestDto
{
/// <summary>
/// 用户ID
/// </summary>
public Guid? ExportUserId { get; set; }
/// <summary>
/// 用户姓名
/// </summary>
public string ExportUserName { get; set; }
/// <summary>
/// 列名
/// </summary>
public string ExportColumnName { get; set; }
/// <summary>
/// 表名
/// </summary>
public string ExportTableName { get; set; }
/// <summary>
/// 导出设置项
/// </summary>
public Enum_ExportCustomUserSetting? CustomUserSetting { get; set; }
}

26
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/AppBaseBusiness/ExportCustomUserSetting/IExportCustomUserSettingAppService.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
using Volo.Abp.Application.Services;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
/// <summary>
/// 用户个型导出配置
/// </summary>
public interface IExportCustomUserSettingAppService :
ICrudAppService<
ExportCustomUserSettingDto,
Guid,
ExportCustomUserSettingGetListInput,
CreateUpdateExportCustomUserSettingDto,
CreateUpdateExportCustomUserSettingDto>
{
/// <summary>
/// 根据用户和表名获取个性化导出
/// </summary>
/// <returns></returns>
Task<List<ExportCustomUserSettingDto>> GetByUserIdAndExportTableNameAsync(Guid userId, string exportTableName);
}

5
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/Permissions/WininPermissionDefinitionProvider.cs

@ -26,6 +26,11 @@ public class WininPermissionDefinitionProvider : PermissionDefinitionProvider
demoCarPermission.AddChild(WininPermissions.DemoCar.Create, L("Permission:Create")); demoCarPermission.AddChild(WininPermissions.DemoCar.Create, L("Permission:Create"));
demoCarPermission.AddChild(WininPermissions.DemoCar.Update, L("Permission:Update")); demoCarPermission.AddChild(WininPermissions.DemoCar.Update, L("Permission:Update"));
demoCarPermission.AddChild(WininPermissions.DemoCar.Delete, L("Permission:Delete")); demoCarPermission.AddChild(WininPermissions.DemoCar.Delete, L("Permission:Delete"));
var exportCustomUserSettingPermission = myGroup.AddPermission(WininPermissions.ExportCustomUserSetting.Default, L("Permission:ExportCustomUserSetting"));
exportCustomUserSettingPermission.AddChild(WininPermissions.ExportCustomUserSetting.Create, L("Permission:Create"));
exportCustomUserSettingPermission.AddChild(WininPermissions.ExportCustomUserSetting.Update, L("Permission:Update"));
exportCustomUserSettingPermission.AddChild(WininPermissions.ExportCustomUserSetting.Delete, L("Permission:Delete"));
} }
private static LocalizableString L(string name) private static LocalizableString L(string name)

10
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application.Contracts/Permissions/WininPermissions.cs

@ -36,4 +36,14 @@ public static class WininPermissions
public const string Create = Default + ".Create"; public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete"; public const string Delete = Default + ".Delete";
} }
/// <summary>
/// 用户个型导出配置
/// </summary>
public class ExportCustomUserSetting
{
public const string Default = GroupName + ".ExportCustomUserSetting";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
} }

69
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs

@ -10,6 +10,8 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper; using AutoMapper;
using Faster.Zheng.Winin.AppBase.Filters; using Faster.Zheng.Winin.AppBase.Filters;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
using Faster.Zheng.Winin.Enums;
using Faster.Zheng.Winin.Extensions; using Faster.Zheng.Winin.Extensions;
using Faster.Zheng.Winin.Localization; using Faster.Zheng.Winin.Localization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -42,6 +44,8 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
private readonly IMapper _mapper; private readonly IMapper _mapper;
private Func<TCreateInput, Entity> _mapFunc; private Func<TCreateInput, Entity> _mapFunc;
protected IStringLocalizer<WininResource> _localizer => LazyServiceProvider.LazyGetRequiredService<IStringLocalizer<WininResource>>(); protected IStringLocalizer<WininResource> _localizer => LazyServiceProvider.LazyGetRequiredService<IStringLocalizer<WininResource>>();
protected ExportCustomUserSettingAppService _exportCustomUserSettingAppService => LazyServiceProvider.LazyGetRequiredService<ExportCustomUserSettingAppService>();
public ZbxBase(IRepository<TEntity, TKey> repository) : base(repository) public ZbxBase(IRepository<TEntity, TKey> repository) : base(repository)
{ {
@ -272,9 +276,10 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
/// <param name="sfsRequestInputBase">查询条件</param> /// <param name="sfsRequestInputBase">查询条件</param>
/// <param name="isRedundance">是否冗余主表数据</param> /// <param name="isRedundance">是否冗余主表数据</param>
/// <param name="isDetailExport">是否导出子表</param> /// <param name="isDetailExport">是否导出子表</param>
/// <param name="userId">用户ID</param>
/// <returns></returns> /// <returns></returns>
[HttpPost("api/[controller]/base/export-to-excel")] [HttpPost("api/[controller]/base/export-to-excel")]
public virtual async Task<IActionResult> ExportToExcelAsync(SfsRequestInputBase sfsRequestInputBase,bool isRedundance,bool isDetailExport = true) public virtual async Task<IActionResult> ExportToExcelAsync(SfsRequestInputBase sfsRequestInputBase,bool isRedundance, Guid userId,bool isDetailExport = true)
{ {
var isHasDetail = false;//是否包含从表 var isHasDetail = false;//是否包含从表
@ -288,14 +293,31 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
// 获取主表的属性 创建主表 表头 // 获取主表的属性 创建主表 表头
var mainAllProperties = typeof(TEntityDto).GetProperties(); var mainAllProperties = typeof(TEntityDto).GetProperties();
var mainProperties= mainAllProperties.Where(p=>p.Name.ToLower()!="details").ToArray();//去除details属性否则导出时会带出来 var mainProperties= mainAllProperties.Where(p=>p.Name!= "Details").ToArray();//去除details属性否则导出时会带出来
#region 用户个性导出
//获取个型导出的字段
var show = await _exportCustomUserSettingAppService.GetByUserIdAndExportTableNameAsync(userId, typeof(TEntity).Name);
var notShowUserColumn = show.Where(p => p.CustomUserSetting == Enum_ExportCustomUserSetting.No).Select(p => p.ExportColumnName).ToList();
if (show.Count == 0)
{
//如果没有就都导出
}
else
{
mainProperties = mainProperties.Where(p =>!notShowUserColumn.Contains(p.Name)).ToArray();//去除details属性否则导出时会带出来
}
#endregion
IRow headerRow = sheet.CreateRow(0); IRow headerRow = sheet.CreateRow(0);
for (int i = 0; i < mainProperties.Length; i++) for (int i = 0; i < mainProperties.Length; i++)
{ {
var englishName=mainProperties[i].Name; var englishName=mainProperties[i].Name;
//本地化 //本地化
var localizerName = _localizer[typeof(TEntityDto).Name.Replace("Dto","") + englishName]; var localizerName = _localizer[typeof(TEntity).Name+ englishName];
headerRow.CreateCell(i).SetCellValue(localizerName); headerRow.CreateCell(i).SetCellValue(localizerName);
} }
@ -431,15 +453,6 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
return fileContentResult; return fileContentResult;
} }
private static ICellStyle SetExcelDetailsColor(IWorkbook workbook)
{
var cellStyle = workbook.CreateCellStyle();
cellStyle.FillBackgroundColor = IndexedColors.LightOrange.Index;
cellStyle.FillForegroundColor = IndexedColors.LightOrange.Index;
cellStyle.FillPattern = FillPattern.SolidForeground;
return cellStyle;
}
#endregion #endregion
#region 私有处理 #region 私有处理
@ -476,6 +489,12 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
return result; return result;
} }
/// <summary>
/// 设置排序
/// </summary>
/// <param name="entities"></param>
/// <param name="sorting"></param>
/// <returns></returns>
private IQueryable<TEntity> GetSortingQueryable(IQueryable<TEntity> entities, string sorting) private IQueryable<TEntity> GetSortingQueryable(IQueryable<TEntity> entities, string sorting)
{ {
if (string.IsNullOrEmpty(sorting)) if (string.IsNullOrEmpty(sorting))
@ -506,19 +525,19 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
return entities; return entities;
} }
//private async Task TestSqlAsync() /// <summary>
//{ /// 导出设置子表单元格样式
// var dbContext=await _dbContextProvider.GetDbContextAsync().ConfigureAwait(false); /// </summary>
/// <param name="workbook"></param>
// var query = dbContext.TestSchools /// <returns></returns>
// .Join(dbContext.TestStudentDetails, TPK => TPK.Id, TFK => TFK.MasterId, (TPK, TFK) => new { TPK, TFK }) private static ICellStyle SetExcelDetailsColor(IWorkbook workbook)
// .Where(result => result.TFK.StudentName == "阎致远"); {
var cellStyle = workbook.CreateCellStyle();
// foreach (var result in query) cellStyle.FillBackgroundColor = IndexedColors.LightOrange.Index;
// { cellStyle.FillForegroundColor = IndexedColors.LightOrange.Index;
// Console.WriteLine($"Customer: {result.TFK.StudentName}, Order ID: {result.TPK.SchoolName}"); cellStyle.FillPattern = FillPattern.SolidForeground;
// } return cellStyle;
//} }
#endregion #endregion
} }

55
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingAppService.cs

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Faster.Zheng.Winin.Permissions;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Services;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
/// <summary>
/// 用户个型导出配置
/// </summary>
public class ExportCustomUserSettingAppService : CrudAppService<ExportCustomUserSetting, ExportCustomUserSettingDto, Guid, ExportCustomUserSettingGetListInput, CreateUpdateExportCustomUserSettingDto, CreateUpdateExportCustomUserSettingDto>,
IExportCustomUserSettingAppService
{
protected override string GetPolicyName { get; set; } = WininPermissions.ExportCustomUserSetting.Default;
protected override string GetListPolicyName { get; set; } = WininPermissions.ExportCustomUserSetting.Default;
protected override string CreatePolicyName { get; set; } = WininPermissions.ExportCustomUserSetting.Create;
protected override string UpdatePolicyName { get; set; } = WininPermissions.ExportCustomUserSetting.Update;
protected override string DeletePolicyName { get; set; } = WininPermissions.ExportCustomUserSetting.Delete;
private readonly IExportCustomUserSettingRepository _repository;
public ExportCustomUserSettingAppService(IExportCustomUserSettingRepository repository) : base(repository)
{
_repository = repository;
}
protected override async Task<IQueryable<ExportCustomUserSetting>> CreateFilteredQueryAsync(ExportCustomUserSettingGetListInput input)
{
// TODO: AbpHelper generated
return (await base.CreateFilteredQueryAsync(input))
.WhereIf(input.ExportUserId != null, x => x.ExportUserId == input.ExportUserId)
.WhereIf(!input.ExportUserName.IsNullOrWhiteSpace(), x => x.ExportUserName.Contains(input.ExportUserName))
.WhereIf(!input.ExportColumnName.IsNullOrWhiteSpace(), x => x.ExportColumnName.Contains(input.ExportColumnName))
.WhereIf(!input.ExportTableName.IsNullOrWhiteSpace(), x => x.ExportTableName.Contains(input.ExportTableName))
.WhereIf(input.CustomUserSetting != null, x => x.CustomUserSetting == input.CustomUserSetting)
;
}
/// <summary>
/// 根据用户和表名获取个性化导出
/// </summary>
/// <returns></returns>
[HttpPost("get-by-user-and-table-name")]
public virtual async Task<List<ExportCustomUserSettingDto>> GetByUserIdAndExportTableNameAsync(Guid userId, string exportTableName)
{
var entitys= await _repository.GetListAsync(p => p.ExportUserId == userId && p.ExportTableName == exportTableName);
return ObjectMapper.Map<List<ExportCustomUserSetting>, List<ExportCustomUserSettingDto>>(entitys);
}
}

4
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/WininApplicationAutoMapperProfile.cs

@ -2,6 +2,8 @@ using Faster.Zheng.Winin.AppBusiness.TestSchool;
using Faster.Zheng.Winin.AppBusiness.TestSchool.Dtos; using Faster.Zheng.Winin.AppBusiness.TestSchool.Dtos;
using Faster.Zheng.Winin.AppBusiness.DemoCar; using Faster.Zheng.Winin.AppBusiness.DemoCar;
using Faster.Zheng.Winin.AppBusiness.DemoCar.Dtos; using Faster.Zheng.Winin.AppBusiness.DemoCar.Dtos;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
using AutoMapper; using AutoMapper;
namespace Faster.Zheng.Winin; namespace Faster.Zheng.Winin;
@ -19,5 +21,7 @@ public class WininApplicationAutoMapperProfile : Profile
CreateMap<CreateUpdateTestStudentDetailDto, TestStudentDetail>(MemberList.Source); CreateMap<CreateUpdateTestStudentDetailDto, TestStudentDetail>(MemberList.Source);
CreateMap<DemoCar, DemoCarDto>(); CreateMap<DemoCar, DemoCarDto>();
CreateMap<CreateUpdateDemoCarDto, DemoCar>(MemberList.Source); CreateMap<CreateUpdateDemoCarDto, DemoCar>(MemberList.Source);
CreateMap<ExportCustomUserSetting, ExportCustomUserSettingDto>();
CreateMap<CreateUpdateExportCustomUserSettingDto, ExportCustomUserSetting>(MemberList.Source);
} }
} }

81
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain.Shared/Localization/Winin/ar.json

@ -1,38 +1,49 @@
{ {
"culture": "ar", "culture": "ar",
"texts": { "texts": {
"Menu:Home": "الصفحة الرئيسية", "Menu:Home": "الصفحة الرئيسية",
"LongWelcomeMessage": "مرحبا بكم في التطبيق. هذا مشروع بدء تشغيل يعتمد على إطار عمل ABP. لمزيد من المعلومات ، يرجى زيارة abp.io.", "LongWelcomeMessage": "مرحبا بكم في التطبيق. هذا مشروع بدء تشغيل يعتمد على إطار عمل ABP. لمزيد من المعلومات ، يرجى زيارة abp.io.",
"Permission:TestSchool": "TestSchool", "Permission:TestSchool": "TestSchool",
"Permission:Create": "Create", "Permission:Create": "Create",
"Permission:Update": "Update", "Permission:Update": "Update",
"Permission:Delete": "Delete", "Permission:Delete": "Delete",
"Menu:TestSchool": "MenuTestSchool", "Menu:TestSchool": "MenuTestSchool",
"TestSchool": "TestSchool", "TestSchool": "TestSchool",
"TestSchoolSchoolName": "TestSchoolSchoolName", "TestSchoolSchoolName": "TestSchoolSchoolName",
"TestSchoolOrderType": "TestSchoolOrderType", "TestSchoolOrderType": "TestSchoolOrderType",
"TestSchoolDetails": "TestSchoolDetails", "TestSchoolDetails": "TestSchoolDetails",
"CreateTestSchool": "CreateTestSchool", "CreateTestSchool": "CreateTestSchool",
"EditTestSchool": "EditTestSchool", "EditTestSchool": "EditTestSchool",
"TestSchoolDeletionConfirmationMessage": "Are you sure to delete the testSchool {0}?", "TestSchoolDeletionConfirmationMessage": "Are you sure to delete the testSchool {0}?",
"SuccessfullyDeleted": "Successfully deleted", "SuccessfullyDeleted": "Successfully deleted",
"TableFilter": "TableFilter", "TableFilter": "TableFilter",
"Permission:TestStudentDetail": "TestStudentDetail", "Permission:TestStudentDetail": "TestStudentDetail",
"Menu:TestStudentDetail": "MenuTestStudentDetail", "Menu:TestStudentDetail": "MenuTestStudentDetail",
"TestStudentDetail": "TestStudentDetail", "TestStudentDetail": "TestStudentDetail",
"TestStudentDetailMasterId": "TestStudentDetailMasterId", "TestStudentDetailMasterId": "TestStudentDetailMasterId",
"TestStudentDetailStudentName": "TestStudentDetailStudentName", "TestStudentDetailStudentName": "TestStudentDetailStudentName",
"TestStudentDetailOrderType": "TestStudentDetailOrderType", "TestStudentDetailOrderType": "TestStudentDetailOrderType",
"CreateTestStudentDetail": "CreateTestStudentDetail", "CreateTestStudentDetail": "CreateTestStudentDetail",
"EditTestStudentDetail": "EditTestStudentDetail", "EditTestStudentDetail": "EditTestStudentDetail",
"TestStudentDetailDeletionConfirmationMessage": "Are you sure to delete the testStudentDetail {0}?", "TestStudentDetailDeletionConfirmationMessage": "Are you sure to delete the testStudentDetail {0}?",
"Permission:DemoCar": "DemoCar", "Permission:DemoCar": "DemoCar",
"Menu:DemoCar": "MenuDemoCar", "Menu:DemoCar": "MenuDemoCar",
"DemoCar": "DemoCar", "DemoCar": "DemoCar",
"DemoCarCarName": "DemoCarCarName", "DemoCarCarName": "DemoCarCarName",
"DemoCarCarColor": "DemoCarCarColor", "DemoCarCarColor": "DemoCarCarColor",
"CreateDemoCar": "CreateDemoCar", "CreateDemoCar": "CreateDemoCar",
"EditDemoCar": "EditDemoCar", "EditDemoCar": "EditDemoCar",
"DemoCarDeletionConfirmationMessage": "Are you sure to delete the demoCar {0}?" "DemoCarDeletionConfirmationMessage": "Are you sure to delete the demoCar {0}?",
} "Permission:ExportCustomUserSetting": "ExportCustomUserSetting",
"Menu:ExportCustomUserSetting": "MenuExportCustomUserSetting",
"ExportCustomUserSetting": "ExportCustomUserSetting",
"ExportCustomUserSettingExportUserId": "ExportCustomUserSettingExportUserId",
"ExportCustomUserSettingExportUserName": "ExportCustomUserSettingExportUserName",
"ExportCustomUserSettingExportColumnName": "ExportCustomUserSettingExportColumnName",
"ExportCustomUserSettingExportTableName": "ExportCustomUserSettingExportTableName",
"ExportCustomUserSettingCustomUserSetting": "ExportCustomUserSettingCustomUserSetting",
"CreateExportCustomUserSetting": "CreateExportCustomUserSetting",
"EditExportCustomUserSetting": "EditExportCustomUserSetting",
"ExportCustomUserSettingDeletionConfirmationMessage": "Are you sure to delete the exportCustomUserSetting {0}?"
}
} }

1
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting.cs

@ -2,7 +2,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Faster.Zheng.Winin.Enums; using Faster.Zheng.Winin.Enums;
using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Domain.Entities.Auditing;
#pragma warning disable CS8618
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting; namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;

11
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Domain/AppBaseBusiness/ExportCustomUserSetting/IExportCustomUserSettingRepository.cs

@ -0,0 +1,11 @@
using System;
using Volo.Abp.Domain.Repositories;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
/// <summary>
/// 用户个型导出配置
/// </summary>
public interface IExportCustomUserSettingRepository : IRepository<ExportCustomUserSetting, Guid>
{
}

22
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingEfCoreQuerableExtensions.cs

@ -0,0 +1,22 @@
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
/// <summary>
/// 用户个型导出配置
/// </summary>
public static class ExportCustomUserSettingEfCoreQueryableExtensions
{
public static IQueryable<ExportCustomUserSetting> IncludeDetails(this IQueryable<ExportCustomUserSetting> queryable, bool include = true)
{
if (!include)
{
return queryable;
}
return queryable
// .Include(x => x.xxx) // TODO: AbpHelper generated
;
}
}

20
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingRepository.cs

@ -0,0 +1,20 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Faster.Zheng.Winin.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
public class ExportCustomUserSettingRepository : EfCoreRepository<WininDbContext, ExportCustomUserSetting, Guid>, IExportCustomUserSettingRepository
{
public ExportCustomUserSettingRepository(IDbContextProvider<WininDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public override async Task<IQueryable<ExportCustomUserSetting>> WithDetailsAsync()
{
return (await GetQueryableAsync()).IncludeDetails();
}
}

17
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/EntityFrameworkCore/WininDbContext.cs

@ -15,6 +15,7 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore;
using Faster.Zheng.Winin.AppBusiness.TestSchool; using Faster.Zheng.Winin.AppBusiness.TestSchool;
using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Abp.EntityFrameworkCore.Modeling;
using Faster.Zheng.Winin.AppBusiness.DemoCar; using Faster.Zheng.Winin.AppBusiness.DemoCar;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
namespace Faster.Zheng.Winin.EntityFrameworkCore; namespace Faster.Zheng.Winin.EntityFrameworkCore;
@ -67,6 +68,10 @@ public class WininDbContext :
/// ///
/// </summary> /// </summary>
public DbSet<DemoCar> DemoCars { get; set; } public DbSet<DemoCar> DemoCars { get; set; }
/// <summary>
/// 用户个型导出配置
/// </summary>
public DbSet<ExportCustomUserSetting> ExportCustomUserSettings { get; set; }
public WininDbContext(DbContextOptions<WininDbContext> options) public WininDbContext(DbContextOptions<WininDbContext> options)
: base(options) : base(options)
@ -104,7 +109,7 @@ public class WininDbContext :
b.ToTable(WininConsts.DbTablePrefix + "TestSchools", WininConsts.DbSchema, table => table.HasComment("")); b.ToTable(WininConsts.DbTablePrefix + "TestSchools", WininConsts.DbSchema, table => table.HasComment(""));
b.ConfigureByConvention(); b.ConfigureByConvention();
// 【手动】如果需要添加级联删除 // ���ֶ��������Ҫ���Ӽ���ɾ��
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterId).IsRequired(); b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterId).IsRequired();
/* Configure more properties here */ /* Configure more properties here */
@ -127,6 +132,16 @@ public class WininDbContext :
b.ConfigureByConvention(); b.ConfigureByConvention();
/* Configure more properties here */
});
builder.Entity<ExportCustomUserSetting>(b =>
{
b.ToTable(WininConsts.DbTablePrefix + "ExportCustomUserSettings", WininConsts.DbSchema, table => table.HasComment(" 用户个型导出配置"));
b.ConfigureByConvention();
/* Configure more properties here */ /* Configure more properties here */
}); });
} }

2
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/EntityFrameworkCore/WininEntityFrameworkCoreModule.cs

@ -1,3 +1,4 @@
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
using Faster.Zheng.Winin.AppBusiness.DemoCar; using Faster.Zheng.Winin.AppBusiness.DemoCar;
using Faster.Zheng.Winin.AppBusiness.TestSchool; using Faster.Zheng.Winin.AppBusiness.TestSchool;
using System; using System;
@ -46,6 +47,7 @@ public class WininEntityFrameworkCoreModule : AbpModule
options.AddRepository<TestSchool, TestSchoolRepository>(); options.AddRepository<TestSchool, TestSchoolRepository>();
options.AddRepository<TestStudentDetail, TestStudentDetailRepository>(); options.AddRepository<TestStudentDetail, TestStudentDetailRepository>();
options.AddRepository<DemoCar, DemoCarRepository>(); options.AddRepository<DemoCar, DemoCarRepository>();
options.AddRepository<ExportCustomUserSetting, ExportCustomUserSettingRepository>();
}); });
Configure<AbpDbContextOptions>(options => Configure<AbpDbContextOptions>(options =>

2087
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/Migrations/20230710132440_Added_ExportCustomUserSetting.Designer.cs

File diff suppressed because it is too large

48
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/Migrations/20230710132440_Added_ExportCustomUserSetting.cs

@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Faster.Zheng.Winin.Migrations
{
/// <inheritdoc />
public partial class AddedExportCustomUserSetting : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AppExportCustomUserSettings",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExportUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExportUserName = table.Column<string>(type: "nvarchar(max)", nullable: false),
ExportColumnName = table.Column<string>(type: "nvarchar(max)", nullable: false),
ExportTableName = table.Column<string>(type: "nvarchar(max)", nullable: false),
CustomUserSetting = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AppExportCustomUserSettings", x => x.Id);
},
comment: " 用户个型导出配置");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AppExportCustomUserSettings");
}
}
}

66
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.EntityFrameworkCore/Migrations/WininDbContextModelSnapshot.cs

@ -24,6 +24,63 @@ namespace Faster.Zheng.Winin.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<int>("CustomUserSetting")
.HasColumnType("int");
b.Property<string>("ExportColumnName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExportTableName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<Guid>("ExportUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ExportUserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.HasKey("Id");
b.ToTable("AppExportCustomUserSettings", null, t =>
{
t.HasComment(" 用户个型导出配置");
});
});
modelBuilder.Entity("Faster.Zheng.Winin.AppBusiness.DemoCar.DemoCar", b => modelBuilder.Entity("Faster.Zheng.Winin.AppBusiness.DemoCar.DemoCar", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -160,12 +217,9 @@ namespace Faster.Zheng.Winin.Migrations
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<Guid?>("TestSchoolId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TestSchoolId"); b.HasIndex("MasterId");
b.ToTable("AppTestStudentDetails", null, t => b.ToTable("AppTestStudentDetails", null, t =>
{ {
@ -1833,7 +1887,9 @@ namespace Faster.Zheng.Winin.Migrations
{ {
b.HasOne("Faster.Zheng.Winin.AppBusiness.TestSchool.TestSchool", null) b.HasOne("Faster.Zheng.Winin.AppBusiness.TestSchool.TestSchool", null)
.WithMany("Details") .WithMany("Details")
.HasForeignKey("TestSchoolId"); .HasForeignKey("MasterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
}); });
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>

6
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Menus/WininMenuContributor.cs

@ -67,5 +67,11 @@ public class WininMenuContributor : IMenuContributor
new ApplicationMenuItem(WininMenus.DemoCar, l["Menu:DemoCar"], "/AppBusiness/DemoCar/DemoCar") new ApplicationMenuItem(WininMenus.DemoCar, l["Menu:DemoCar"], "/AppBusiness/DemoCar/DemoCar")
); );
} }
if (await context.IsGrantedAsync(WininPermissions.ExportCustomUserSetting.Default))
{
context.Menu.AddItem(
new ApplicationMenuItem(WininMenus.ExportCustomUserSetting, l["Menu:ExportCustomUserSetting"], "/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting")
);
}
} }
} }

1
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Menus/WininMenus.cs

@ -10,4 +10,5 @@ public class WininMenus
public const string TestSchool = Prefix + ".TestSchool"; public const string TestSchool = Prefix + ".TestSchool";
public const string TestStudentDetail = Prefix + ".TestStudentDetail"; public const string TestStudentDetail = Prefix + ".TestStudentDetail";
public const string DemoCar = Prefix + ".DemoCar"; public const string DemoCar = Prefix + ".DemoCar";
public const string ExportCustomUserSetting = Prefix + ".ExportCustomUserSetting";
} }

18
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/CreateModal.cshtml

@ -0,0 +1,18 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@using Faster.Zheng.Winin.Localization
@inject IHtmlLocalizer<WininResource> L
@model Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting.CreateModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="CreateModal">
<abp-modal>
<abp-modal-header title="@L["CreateExportCustomUserSetting"].Value"></abp-modal-header>
<abp-modal-body>
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

27
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/CreateModal.cshtml.cs

@ -0,0 +1,27 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
using Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting.ViewModels;
namespace Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting;
public class CreateModalModel : WininPageModel
{
[BindProperty]
public CreateEditExportCustomUserSettingViewModel ViewModel { get; set; }
private readonly IExportCustomUserSettingAppService _service;
public CreateModalModel(IExportCustomUserSettingAppService service)
{
_service = service;
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<CreateEditExportCustomUserSettingViewModel, CreateUpdateExportCustomUserSettingDto>(ViewModel);
await _service.CreateAsync(dto);
return NoContent();
}
}

19
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/EditModal.cshtml

@ -0,0 +1,19 @@
@page
@using Faster.Zheng.Winin.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@inject IHtmlLocalizer<WininResource> L
@model Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting.EditModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="EditModal">
<abp-modal>
<abp-modal-header title="@L["EditExportCustomUserSetting"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="Id" />
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

38
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/EditModal.cshtml.cs

@ -0,0 +1,38 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
using Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting.ViewModels;
namespace Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting;
public class EditModalModel : WininPageModel
{
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid Id { get; set; }
[BindProperty]
public CreateEditExportCustomUserSettingViewModel ViewModel { get; set; }
private readonly IExportCustomUserSettingAppService _service;
public EditModalModel(IExportCustomUserSettingAppService service)
{
_service = service;
}
public virtual async Task OnGetAsync()
{
var dto = await _service.GetAsync(Id);
ViewModel = ObjectMapper.Map<ExportCustomUserSettingDto, CreateEditExportCustomUserSettingViewModel>(dto);
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<CreateEditExportCustomUserSettingViewModel, CreateUpdateExportCustomUserSettingDto>(ViewModel);
await _service.UpdateAsync(Id, dto);
return NoContent();
}
}

55
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/Index.cshtml

@ -0,0 +1,55 @@
@page
@using Faster.Zheng.Winin.Permissions
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting
@using Faster.Zheng.Winin.Localization
@using Faster.Zheng.Winin.Web.Menus
@model IndexModel
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<WininResource> L
@inject IAuthorizationService Authorization
@{
PageLayout.Content.Title = L["ExportCustomUserSetting"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:ExportCustomUserSetting"].Value);
PageLayout.Content.MenuItemName = WininMenus.ExportCustomUserSetting;
}
@section scripts
{
<abp-script src="/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/index.js" />
}
@section styles
{
<abp-style src="/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/index.css"/>
}
<abp-card>
<abp-card-header>
<abp-row>
<abp-column size-md="_6">
<abp-card-title>@L["ExportCustomUserSetting"]</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-end">
@if (await Authorization.IsGrantedAsync(WininPermissions.ExportCustomUserSetting.Create))
{
<abp-button id="NewExportCustomUserSettingButton"
text="@L["CreateExportCustomUserSetting"].Value"
icon="plus"
button-type="Primary" />
}
</abp-column>
</abp-row>
</abp-card-header>
<abp-card-body>
@*<abp-row class="mb-3">
<a abp-collapse-id="ExportCustomUserSettingCollapse" class="text-secondary">@L["TableFilter"] </a>
</abp-row>
<abp-collapse-body id="ExportCustomUserSettingCollapse">
<abp-dynamic-form abp-model="ExportCustomUserSettingFilter" id="ExportCustomUserSettingFilter" required-symbols="false"/>
<hr />
</abp-collapse-body>*@
<abp-table striped-rows="true" id="ExportCustomUserSettingTable" class="nowrap"/>
</abp-card-body>
</abp-card>

40
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/Index.cshtml.cs

@ -0,0 +1,40 @@
using System;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using Faster.Zheng.Winin.Enums;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;
namespace Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting;
public class IndexModel : WininPageModel
{
public ExportCustomUserSettingFilterInput ExportCustomUserSettingFilter { get; set; }
public virtual async Task OnGetAsync()
{
await Task.CompletedTask;
}
}
public class ExportCustomUserSettingFilterInput
{
[FormControlSize(AbpFormControlSize.Small)]
[Display(Name = "ExportCustomUserSettingExportUserId")]
public Guid? ExportUserId { get; set; }
[FormControlSize(AbpFormControlSize.Small)]
[Display(Name = "ExportCustomUserSettingExportUserName")]
public string ExportUserName { get; set; }
[FormControlSize(AbpFormControlSize.Small)]
[Display(Name = "ExportCustomUserSettingExportColumnName")]
public string ExportColumnName { get; set; }
[FormControlSize(AbpFormControlSize.Small)]
[Display(Name = "ExportCustomUserSettingExportTableName")]
public string ExportTableName { get; set; }
[FormControlSize(AbpFormControlSize.Small)]
[Display(Name = "ExportCustomUserSettingCustomUserSetting")]
public Enum_ExportCustomUserSetting? CustomUserSetting { get; set; }
}

23
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/ViewModels/CreateEditExportCustomUserSettingViewModel.cs

@ -0,0 +1,23 @@
using System;
using System.ComponentModel.DataAnnotations;
using Faster.Zheng.Winin.Enums;
namespace Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting.ViewModels;
public class CreateEditExportCustomUserSettingViewModel
{
[Display(Name = "ExportCustomUserSettingExportUserId")]
public Guid ExportUserId { get; set; }
[Display(Name = "ExportCustomUserSettingExportUserName")]
public string ExportUserName { get; set; }
[Display(Name = "ExportCustomUserSettingExportColumnName")]
public string ExportColumnName { get; set; }
[Display(Name = "ExportCustomUserSettingExportTableName")]
public string ExportTableName { get; set; }
[Display(Name = "ExportCustomUserSettingCustomUserSetting")]
public Enum_ExportCustomUserSetting CustomUserSetting { get; set; }
}

0
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/index.css

100
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/Pages/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/index.js

@ -0,0 +1,100 @@
$(function () {
$("#ExportCustomUserSettingFilter :input").on('input', function () {
dataTable.ajax.reload();
});
$('#ExportCustomUserSettingFilter div').addClass('col-sm-3').parent().addClass('row');
var getFilter = function () {
var input = {};
$("#ExportCustomUserSettingFilter")
.serializeArray()
.forEach(function (data) {
if (data.value != '') {
input[abp.utils.toCamelCase(data.name.replace(/ExportCustomUserSettingFilter./g, ''))] = data.value;
}
})
return input;
};
var l = abp.localization.getResource('Winin');
var service = faster.zheng.winin.appBaseBusiness.exportCustomUserSetting.exportCustomUserSetting;
var createModal = new abp.ModalManager(abp.appPath + 'AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/CreateModal');
var editModal = new abp.ModalManager(abp.appPath + 'AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSetting/EditModal');
var dataTable = $('#ExportCustomUserSettingTable').DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,
serverSide: true,
paging: true,
searching: false,//disable default searchbox
autoWidth: false,
scrollCollapse: true,
order: [[0, "asc"]],
ajax: abp.libs.datatables.createAjax(service.getList,getFilter),
columnDefs: [
{
rowAction: {
items:
[
{
text: l('Edit'),
visible: abp.auth.isGranted('Winin.ExportCustomUserSetting.Update'),
action: function (data) {
editModal.open({ id: data.record.id });
}
},
{
text: l('Delete'),
visible: abp.auth.isGranted('Winin.ExportCustomUserSetting.Delete'),
confirmMessage: function (data) {
return l('ExportCustomUserSettingDeletionConfirmationMessage', data.record.id);
},
action: function (data) {
service.delete(data.record.id)
.then(function () {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
});
}
}
]
}
},
{
title: l('ExportCustomUserSettingExportUserId'),
data: "exportUserId"
},
{
title: l('ExportCustomUserSettingExportUserName'),
data: "exportUserName"
},
{
title: l('ExportCustomUserSettingExportColumnName'),
data: "exportColumnName"
},
{
title: l('ExportCustomUserSettingExportTableName'),
data: "exportTableName"
},
{
title: l('ExportCustomUserSettingCustomUserSetting'),
data: "customUserSetting"
},
]
}));
createModal.onResult(function () {
dataTable.ajax.reload();
});
editModal.onResult(function () {
dataTable.ajax.reload();
});
$('#NewExportCustomUserSettingButton').click(function (e) {
e.preventDefault();
createModal.open();
});
});

4
Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Web/WininWebAutoMapperProfile.cs

@ -5,6 +5,8 @@ using Faster.Zheng.Winin.Web.Pages.AppBusiness.TestSchool.TestStudentDetail.View
using Faster.Zheng.Winin.AppBusiness.DemoCar.Dtos; using Faster.Zheng.Winin.AppBusiness.DemoCar.Dtos;
using Faster.Zheng.Winin.Web.Pages.AppBusiness.DemoCar.DemoCar.ViewModels; using Faster.Zheng.Winin.Web.Pages.AppBusiness.DemoCar.DemoCar.ViewModels;
using AutoMapper; using AutoMapper;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting.Dtos;
using Faster.Zheng.Winin.Web.Pages.AppBaseBusiness.ExportCustomUserSetting.ExportCustomUserSetting.ViewModels;
using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.AspNetCore.Http.HttpResults;
namespace Faster.Zheng.Winin.Web; namespace Faster.Zheng.Winin.Web;
@ -20,6 +22,8 @@ public class WininWebAutoMapperProfile : Profile
CreateMap<CreateEditTestStudentDetailViewModel, CreateUpdateTestStudentDetailDto>(); CreateMap<CreateEditTestStudentDetailViewModel, CreateUpdateTestStudentDetailDto>();
CreateMap<DemoCarDto, CreateEditDemoCarViewModel>(); CreateMap<DemoCarDto, CreateEditDemoCarViewModel>();
CreateMap<CreateEditDemoCarViewModel, CreateUpdateDemoCarDto>(); CreateMap<CreateEditDemoCarViewModel, CreateUpdateDemoCarDto>();
CreateMap<ExportCustomUserSettingDto, CreateEditExportCustomUserSettingViewModel>();
CreateMap<CreateEditExportCustomUserSettingViewModel, CreateUpdateExportCustomUserSettingDto>();
} }
} }

28
Code/Be/Faster.Zheng.Winin/test/Faster.Zheng.Winin.Application.Tests/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingAppServiceTests.cs

@ -0,0 +1,28 @@
using Shouldly;
using System.Threading.Tasks;
using Xunit;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
public class ExportCustomUserSettingAppServiceTests : WininApplicationTestBase
{
private readonly IExportCustomUserSettingAppService _exportCustomUserSettingAppService;
public ExportCustomUserSettingAppServiceTests()
{
_exportCustomUserSettingAppService = GetRequiredService<IExportCustomUserSettingAppService>();
}
/*
[Fact]
public async Task Test1()
{
// Arrange
// Act
// Assert
}
*/
}

24
Code/Be/Faster.Zheng.Winin/test/Faster.Zheng.Winin.Domain.Tests/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingDomainTests.cs

@ -0,0 +1,24 @@
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
public class ExportCustomUserSettingDomainTests : WininDomainTestBase
{
public ExportCustomUserSettingDomainTests()
{
}
/*
[Fact]
public async Task Test1()
{
// Arrange
// Assert
// Assert
}
*/
}

32
Code/Be/Faster.Zheng.Winin/test/Faster.Zheng.Winin.EntityFrameworkCore.Tests/EntityFrameworkCore/AppBaseBusiness/ExportCustomUserSetting/ExportCustomUserSettingRepositoryTests.cs

@ -0,0 +1,32 @@
using System;
using System.Threading.Tasks;
using Faster.Zheng.Winin.AppBaseBusiness.ExportCustomUserSetting;
using Volo.Abp.Domain.Repositories;
using Xunit;
namespace Faster.Zheng.Winin.EntityFrameworkCore.AppBaseBusiness.ExportCustomUserSetting;
public class ExportCustomUserSettingRepositoryTests : WininEntityFrameworkCoreTestBase
{
private readonly IExportCustomUserSettingRepository _exportCustomUserSettingRepository;
public ExportCustomUserSettingRepositoryTests()
{
_exportCustomUserSettingRepository = GetRequiredService<IExportCustomUserSettingRepository>();
}
/*
[Fact]
public async Task Test1()
{
await WithUnitOfWorkAsync(async () =>
{
// Arrange
// Act
//Assert
});
}
*/
}

23
Code/Be/Faster.Zheng.Winin/test/Faster.Zheng.Winin.Web.Tests/Pages/AppBaseBusiness/ExportCustomUserSetting/IndexTests.cs

@ -0,0 +1,23 @@
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace Faster.Zheng.Winin.Pages.AppBaseBusiness.ExportCustomUserSetting;
public class Index_Tests : WininWebTestBase
{
/*
[Fact]
public async Task Index_Page_Test()
{
// Arrange
// Act
var response = await GetResponseAsStringAsync("/ExportCustomUserSetting");
// Assert
response.ShouldNotBeNull();
}
*/
}
Loading…
Cancel
Save