18 changed files with 14924 additions and 80 deletions
			
			
		- 
					8src/Shentun.Peis.Application.Contracts/Asbitems/AsbitemDto.cs
 - 
					4src/Shentun.Peis.Application.Contracts/Asbitems/CreateAsbitemDto.cs
 - 
					4src/Shentun.Peis.Application.Contracts/Asbitems/UpdateAsbitemDto.cs
 - 
					27src/Shentun.Peis.Application.Contracts/CollectItemTypes/CollectItemTypeDto.cs
 - 
					11src/Shentun.Peis.Application.Contracts/CollectItemTypes/CollectItemTypeIdInputDto.cs
 - 
					22src/Shentun.Peis.Application.Contracts/CollectItemTypes/CreateCollectItemTypeDto.cs
 - 
					23src/Shentun.Peis.Application.Contracts/CollectItemTypes/UpdateCollectItemTypeDto.cs
 - 
					1src/Shentun.Peis.Application/Asbitems/AsbitemAppService.cs
 - 
					164src/Shentun.Peis.Application/CollectItemTypes/CollectItemTypeAppService.cs
 - 
					7src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
 - 
					2src/Shentun.Peis.Domain/CollectItemTypes/CollectItemType.cs
 - 
					116src/Shentun.Peis.Domain/CollectItemTypes/CollectItemTypeManager.cs
 - 
					16src/Shentun.Peis.Domain/HelperDto/UpdateSortManyDto.cs
 - 
					33src/Shentun.Peis.EntityFrameworkCore/DbMapping/CollectItemTypes/CollectItemTypeDbMapping.cs
 - 
					7src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
 - 
					14165src/Shentun.Peis.EntityFrameworkCore/Migrations/20240502143341_init20240502003.Designer.cs
 - 
					242src/Shentun.Peis.EntityFrameworkCore/Migrations/20240502143341_init20240502003.cs
 - 
					152src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
 
@ -0,0 +1,27 @@ | 
			
		|||||
 | 
				using System; | 
			
		||||
 | 
				using System.Collections.Generic; | 
			
		||||
 | 
				using System.ComponentModel.DataAnnotations.Schema; | 
			
		||||
 | 
				using System.ComponentModel.DataAnnotations; | 
			
		||||
 | 
				using System.Text; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace Shentun.Peis.CollectItemTypes | 
			
		||||
 | 
				{ | 
			
		||||
 | 
				    public class CollectItemTypeDto : AuditedEntityDtoName | 
			
		||||
 | 
				    { | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 名称
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        public string DisplayName { get; set; } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        public string SimpleCode { get; set; } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 发票项目类别ID
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        public Guid InvoiceItemTypeId { get; set; } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        public int DisplayOrder { get; set; } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
@ -0,0 +1,11 @@ | 
			
		|||||
 | 
				using System; | 
			
		||||
 | 
				using System.Collections.Generic; | 
			
		||||
 | 
				using System.Text; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace Shentun.Peis.CollectItemTypes | 
			
		||||
 | 
				{ | 
			
		||||
 | 
				    public class CollectItemTypeIdInputDto | 
			
		||||
 | 
				    { | 
			
		||||
 | 
				        public Guid Id { get; set; } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
@ -0,0 +1,22 @@ | 
			
		|||||
 | 
				using System; | 
			
		||||
 | 
				using System.Collections.Generic; | 
			
		||||
 | 
				using System.ComponentModel.DataAnnotations.Schema; | 
			
		||||
 | 
				using System.ComponentModel.DataAnnotations; | 
			
		||||
 | 
				using System.Text; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace Shentun.Peis.CollectItemTypes | 
			
		||||
 | 
				{ | 
			
		||||
 | 
				    public class CreateCollectItemTypeDto | 
			
		||||
 | 
				    { | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 名称
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        public string DisplayName { get; set; } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 发票项目类别ID
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        public Guid InvoiceItemTypeId { get; set; } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
@ -0,0 +1,23 @@ | 
			
		|||||
 | 
				using System; | 
			
		||||
 | 
				using System.Collections.Generic; | 
			
		||||
 | 
				using System.Text; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace Shentun.Peis.CollectItemTypes | 
			
		||||
 | 
				{ | 
			
		||||
 | 
				    public class UpdateCollectItemTypeDto | 
			
		||||
 | 
				    { | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        public Guid Id { get; set; } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 名称
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        public string DisplayName { get; set; } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 发票项目类别ID
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        public Guid InvoiceItemTypeId { get; set; } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
@ -0,0 +1,164 @@ | 
			
		|||||
 | 
				using Microsoft.AspNetCore.Authorization; | 
			
		||||
 | 
				using Microsoft.AspNetCore.Mvc; | 
			
		||||
 | 
				using Shentun.Peis.ColumnReferences; | 
			
		||||
 | 
				using Shentun.Peis.HelperDto; | 
			
		||||
 | 
				using Shentun.Peis.InvoiceItemTypes; | 
			
		||||
 | 
				using Shentun.Peis.Models; | 
			
		||||
 | 
				using System; | 
			
		||||
 | 
				using System.Collections.Generic; | 
			
		||||
 | 
				using System.Linq; | 
			
		||||
 | 
				using System.Text; | 
			
		||||
 | 
				using System.Threading.Tasks; | 
			
		||||
 | 
				using Volo.Abp.Application.Services; | 
			
		||||
 | 
				using Volo.Abp.Domain.Repositories; | 
			
		||||
 | 
				using Volo.Abp.Identity; | 
			
		||||
 | 
				using Volo.Abp.Users; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace Shentun.Peis.CollectItemTypes | 
			
		||||
 | 
				{ | 
			
		||||
 | 
				    /// <summary>
 | 
			
		||||
 | 
				    /// 汇总项目类别
 | 
			
		||||
 | 
				    /// </summary>
 | 
			
		||||
 | 
				    [ApiExplorerSettings(GroupName = "Work")] | 
			
		||||
 | 
				    [Authorize] | 
			
		||||
 | 
				    public class CollectItemTypeAppService : ApplicationService | 
			
		||||
 | 
				    { | 
			
		||||
 | 
				        private readonly IRepository<CollectItemType, Guid> _collectItemTypeRepository; | 
			
		||||
 | 
				        private readonly CacheService _cacheService; | 
			
		||||
 | 
				        private readonly CollectItemTypeManager _manager; | 
			
		||||
 | 
				        private readonly IRepository<IdentityUser, Guid> _userRepository; | 
			
		||||
 | 
				        public CollectItemTypeAppService( | 
			
		||||
 | 
				            IRepository<CollectItemType, Guid> collectItemTypeRepository, | 
			
		||||
 | 
				            IRepository<IdentityUser, Guid> userRepository, | 
			
		||||
 | 
				            CollectItemTypeManager manager, | 
			
		||||
 | 
				            CacheService cacheService) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            _collectItemTypeRepository = collectItemTypeRepository; | 
			
		||||
 | 
				            _cacheService = cacheService; | 
			
		||||
 | 
				            _manager = manager; | 
			
		||||
 | 
				            _userRepository = userRepository; | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 根据ID查实体内容
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <param name="input"></param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        [HttpPost("api/app/CollectItemType/GetById")] | 
			
		||||
 | 
				        public async Task<CollectItemTypeDto> GetByIdAsync(CollectItemTypeIdInputDto input) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            var entity = await _collectItemTypeRepository.GetAsync(input.Id); | 
			
		||||
 | 
				            var entityDto = ObjectMapper.Map<CollectItemType, CollectItemTypeDto>(entity); | 
			
		||||
 | 
				            entityDto.CreatorName = _cacheService.GetSurnameAsync(entityDto.CreatorId).Result; | 
			
		||||
 | 
				            entityDto.LastModifierName = _cacheService.GetSurnameAsync(entityDto.LastModifierId).Result; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            return entityDto; | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 查询列表
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        [HttpPost("api/app/CollectItemType/GetList")] | 
			
		||||
 | 
				        public async Task<List<CollectItemTypeDto>> GetListAsync() | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            var userQueryable = await _userRepository.GetQueryableAsync(); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            var entlist = (from a in await _collectItemTypeRepository.GetQueryableAsync() | 
			
		||||
 | 
				                           join b in userQueryable on a.CreatorId equals b.Id into bb | 
			
		||||
 | 
				                           from ab in bb.DefaultIfEmpty() | 
			
		||||
 | 
				                           join c in userQueryable on a.LastModifierId equals c.Id into cc | 
			
		||||
 | 
				                           from ac in cc.DefaultIfEmpty() | 
			
		||||
 | 
				                           select new | 
			
		||||
 | 
				                           { | 
			
		||||
 | 
				                               a, | 
			
		||||
 | 
				                               CreatorName = ab != null ? ab.Surname : "", | 
			
		||||
 | 
				                               LastModifierName = ac != null ? ac.Surname : "" | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				                           }) | 
			
		||||
 | 
				                           .Select(s => new CollectItemTypeDto | 
			
		||||
 | 
				                           { | 
			
		||||
 | 
				                               CreationTime = s.a.CreationTime, | 
			
		||||
 | 
				                               CreatorId = s.a.CreatorId, | 
			
		||||
 | 
				                               LastModifierId = s.a.LastModifierId, | 
			
		||||
 | 
				                               Id = s.a.Id, | 
			
		||||
 | 
				                               DisplayOrder = s.a.DisplayOrder, | 
			
		||||
 | 
				                               DisplayName = s.a.DisplayName, | 
			
		||||
 | 
				                               InvoiceItemTypeId = s.a.InvoiceItemTypeId, | 
			
		||||
 | 
				                               SimpleCode = s.a.SimpleCode, | 
			
		||||
 | 
				                               LastModificationTime = s.a.LastModificationTime, | 
			
		||||
 | 
				                               CreatorName = s.CreatorName, | 
			
		||||
 | 
				                               LastModifierName = s.LastModifierName | 
			
		||||
 | 
				                           }).OrderBy(o => o.DisplayOrder).ToList(); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            return entlist; | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 创建
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <param name="input"></param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        [HttpPost("api/app/CollectItemType/Create")] | 
			
		||||
 | 
				        public async Task<CollectItemTypeDto> CreateAsync(CreateCollectItemTypeDto input) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            var createEntity = ObjectMapper.Map<CreateCollectItemTypeDto, CollectItemType>(input); | 
			
		||||
 | 
				            var entity = await _manager.CreateAsync(createEntity); | 
			
		||||
 | 
				            entity = await _collectItemTypeRepository.InsertAsync(entity); | 
			
		||||
 | 
				            var dto = ObjectMapper.Map<CollectItemType, CollectItemTypeDto>(entity); | 
			
		||||
 | 
				            return dto; | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 修改
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <param name="input"></param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        [HttpPost("api/app/CollectItemType/Update")] | 
			
		||||
 | 
				        public async Task<CollectItemTypeDto> UpdateAsync(UpdateCollectItemTypeDto input) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            var entity = await _collectItemTypeRepository.GetAsync(input.Id); | 
			
		||||
 | 
				            var sourceEntity = ObjectMapper.Map<UpdateCollectItemTypeDto, CollectItemType>(input); | 
			
		||||
 | 
				            await _manager.UpdateAsync(sourceEntity, entity); | 
			
		||||
 | 
				            entity = await _collectItemTypeRepository.UpdateAsync(entity); | 
			
		||||
 | 
				            return ObjectMapper.Map<CollectItemType, CollectItemTypeDto>(entity); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 删除
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <param name="input"></param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        [HttpPost("api/app/CollectItemType/Delete")] | 
			
		||||
 | 
				        public async Task DeleteAsync(CollectItemTypeIdInputDto input) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            var entity = await _collectItemTypeRepository.GetAsync(input.Id); | 
			
		||||
 | 
				            await _manager.CheckAndDeleteAsync(entity); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 修改排序  置顶,置底
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <param name="input"></param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        [HttpPost("api/app/CollectItemType/UpdateManySort")] | 
			
		||||
 | 
				        public async Task UpdateManySortAsync(UpdateManySortInput input) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            await _manager.UpdateManySortAsync(input.Id, input.SortType); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        ///  修改排序  拖拽
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <param name="input"></param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        [HttpPost("api/app/CollectItemType/UpdateSortMany")] | 
			
		||||
 | 
				        public async Task UpdateSortManyAsync(UpdateSortManyDto input) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            await _manager.UpdateSortManyAsync(input); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
@ -0,0 +1,116 @@ | 
			
		|||||
 | 
				using Shentun.Peis.Enums; | 
			
		||||
 | 
				using Shentun.Peis.HelperDto; | 
			
		||||
 | 
				using Shentun.Peis.Models; | 
			
		||||
 | 
				using Shentun.Utilities; | 
			
		||||
 | 
				using System; | 
			
		||||
 | 
				using System.Collections.Generic; | 
			
		||||
 | 
				using System.Linq; | 
			
		||||
 | 
				using System.Text; | 
			
		||||
 | 
				using System.Threading.Tasks; | 
			
		||||
 | 
				using Volo.Abp; | 
			
		||||
 | 
				using Volo.Abp.Domain.Entities; | 
			
		||||
 | 
				using Volo.Abp.Domain.Repositories; | 
			
		||||
 | 
				using Volo.Abp.Domain.Services; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace Shentun.Peis.CollectItemTypes | 
			
		||||
 | 
				{ | 
			
		||||
 | 
				    public class CollectItemTypeManager : DomainService | 
			
		||||
 | 
				    { | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        private readonly IRepository<CollectItemType, Guid> _repository; | 
			
		||||
 | 
				        private readonly IRepository<Asbitem, Guid> _asbitemRepository; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        public CollectItemTypeManager( | 
			
		||||
 | 
				            IRepository<CollectItemType, Guid> repository, | 
			
		||||
 | 
				            IRepository<Asbitem, Guid> asbitemRepository) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            _repository = repository; | 
			
		||||
 | 
				            _asbitemRepository = asbitemRepository; | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 创建
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <param name="entity"></param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        public async Task<CollectItemType> CreateAsync( | 
			
		||||
 | 
				          CollectItemType entity | 
			
		||||
 | 
				         ) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            Verify(entity); | 
			
		||||
 | 
				            await EntityHelper.CheckSameName(_repository, entity.DisplayName); | 
			
		||||
 | 
				            return new CollectItemType( | 
			
		||||
 | 
				                GuidGenerator.Create() | 
			
		||||
 | 
				             ) | 
			
		||||
 | 
				            { | 
			
		||||
 | 
				                DisplayName = entity.DisplayName, | 
			
		||||
 | 
				                InvoiceItemTypeId = entity.InvoiceItemTypeId, | 
			
		||||
 | 
				                SimpleCode = LanguageConverter.GetPYSimpleCode(entity.DisplayName), | 
			
		||||
 | 
				                DisplayOrder = await EntityHelper.CreateMaxDisplayOrder(_repository) | 
			
		||||
 | 
				            }; | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        public async Task UpdateAsync( | 
			
		||||
 | 
				          CollectItemType sourceEntity, | 
			
		||||
 | 
				          CollectItemType targetEntity | 
			
		||||
 | 
				         ) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            DataHelper.CheckEntityIsNull(targetEntity); | 
			
		||||
 | 
				            Verify(sourceEntity); | 
			
		||||
 | 
				            if (sourceEntity.DisplayName != targetEntity.DisplayName) | 
			
		||||
 | 
				            { | 
			
		||||
 | 
				                await EntityHelper.CheckSameName<CollectItemType, Guid>(_repository, sourceEntity.DisplayName, targetEntity); | 
			
		||||
 | 
				                targetEntity.DisplayName = sourceEntity.DisplayName; | 
			
		||||
 | 
				                targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(sourceEntity.DisplayName); | 
			
		||||
 | 
				            } | 
			
		||||
 | 
				            targetEntity.InvoiceItemTypeId = sourceEntity.InvoiceItemTypeId; | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        public async Task CheckAndDeleteAsync(CollectItemType entity) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            var asbitemEnt = await _asbitemRepository.FirstOrDefaultAsync(m => m.CollectItemTypeId == entity.Id); | 
			
		||||
 | 
				            if (asbitemEnt != null) | 
			
		||||
 | 
				            { | 
			
		||||
 | 
				                throw new UserFriendlyException($"汇总项目类别\"{entity.DisplayName}\"已被组合项目\"{asbitemEnt.DisplayName}\"使用,不能删除"); | 
			
		||||
 | 
				            } | 
			
		||||
 | 
				            await _repository.DeleteAsync(entity); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 修改排序  置顶,置底
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <param name="id">需要修改的ID</param>
 | 
			
		||||
 | 
				        /// <param name="SortType">修改方式:1 置顶   2 置底</param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        public async Task UpdateManySortAsync(Guid id, int SortType) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            await EntityHelper.UpdateManySortAsync(_repository, id, SortType); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        /// <summary>
 | 
			
		||||
 | 
				        /// 修改排序  拖拽
 | 
			
		||||
 | 
				        /// </summary>
 | 
			
		||||
 | 
				        /// <typeparam name="TEntity"></typeparam>
 | 
			
		||||
 | 
				        /// <param name="repository"></param>
 | 
			
		||||
 | 
				        /// <param name="input"></param>
 | 
			
		||||
 | 
				        /// <returns></returns>
 | 
			
		||||
 | 
				        public async Task UpdateSortManyAsync(UpdateSortManyDto input) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            await EntityHelper.UpdateSortManyAsync(_repository, input); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        private void Verify(CollectItemType entity) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            DataHelper.CheckEntityIsNull(entity); | 
			
		||||
 | 
				            DataHelper.CheckStringIsNull(entity.DisplayName, "名称"); | 
			
		||||
 | 
				            DataHelper.CheckGuidIsDefaultValue(entity.InvoiceItemTypeId, "配置参数"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
@ -0,0 +1,33 @@ | 
			
		|||||
 | 
				using Microsoft.EntityFrameworkCore.Metadata.Builders; | 
			
		||||
 | 
				using Microsoft.EntityFrameworkCore; | 
			
		||||
 | 
				using Shentun.Peis.Models; | 
			
		||||
 | 
				using System; | 
			
		||||
 | 
				using System.Collections.Generic; | 
			
		||||
 | 
				using System.Linq; | 
			
		||||
 | 
				using System.Text; | 
			
		||||
 | 
				using System.Threading.Tasks; | 
			
		||||
 | 
				using Shentun.Peis.CollectItemTypes; | 
			
		||||
 | 
				using Shentun.Peis.EntityFrameworkCore; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace Shentun.Peis.DbMapping | 
			
		||||
 | 
				{ | 
			
		||||
 | 
				  | 
			
		||||
 | 
				    internal class CollectItemTypeDbMapping : IEntityTypeConfiguration<CollectItemType> | 
			
		||||
 | 
				    { | 
			
		||||
 | 
				        public void Configure(EntityTypeBuilder<CollectItemType> entity) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            entity.HasComment("汇总项目类别"); | 
			
		||||
 | 
				            entity.Property(t => t.DisplayName).HasComment("名称").IsRequired(); | 
			
		||||
 | 
				            entity.Property(t => t.DisplayOrder).HasComment("显示顺序").IsRequired(); | 
			
		||||
 | 
				            entity.Property(t => t.InvoiceItemTypeId).HasComment("发票项目类别ID").IsRequired(); | 
			
		||||
 | 
				            entity.Property(t => t.SimpleCode).HasComment("简码").IsRequired(); | 
			
		||||
 | 
				            entity.Property(e => e.Id) | 
			
		||||
 | 
				                .IsFixedLength() | 
			
		||||
 | 
				                .HasComment("编号").HasColumnName("id"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            entity.ConfigureByConvention(); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
						
							
						
						
							14165
	
						
						src/Shentun.Peis.EntityFrameworkCore/Migrations/20240502143341_init20240502003.Designer.cs
						
							File diff suppressed because it is too large
							
							
								
									View File
								
							
						
					
				File diff suppressed because it is too large
							
							
								
									View File
								
							
						@ -0,0 +1,242 @@ | 
			
		|||||
 | 
				using System; | 
			
		||||
 | 
				using Microsoft.EntityFrameworkCore.Migrations; | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				#nullable disable | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace Shentun.Peis.Migrations | 
			
		||||
 | 
				{ | 
			
		||||
 | 
				    public partial class init20240502003 : Migration | 
			
		||||
 | 
				    { | 
			
		||||
 | 
				        protected override void Up(MigrationBuilder migrationBuilder) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "Id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "id"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "LastModifierId", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "last_modifier_id"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "LastModificationTime", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "last_modification_time"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "CreatorId", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "creator_id"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "CreationTime", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "creation_time"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "ConcurrencyStamp", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "concurrency_stamp"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterTable( | 
			
		||||
 | 
				                name: "collect_item_type", | 
			
		||||
 | 
				                comment: "汇总项目类别"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<string>( | 
			
		||||
 | 
				                name: "simple_code", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "character varying(50)", | 
			
		||||
 | 
				                maxLength: 50, | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                defaultValue: "", | 
			
		||||
 | 
				                comment: "简码", | 
			
		||||
 | 
				                oldClrType: typeof(string), | 
			
		||||
 | 
				                oldType: "character varying(50)", | 
			
		||||
 | 
				                oldMaxLength: 50, | 
			
		||||
 | 
				                oldNullable: true); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<Guid>( | 
			
		||||
 | 
				                name: "invoice_item_type_id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "uuid", | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                comment: "发票项目类别ID", | 
			
		||||
 | 
				                oldClrType: typeof(Guid), | 
			
		||||
 | 
				                oldType: "uuid"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<int>( | 
			
		||||
 | 
				                name: "display_order", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "integer", | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                comment: "显示顺序", | 
			
		||||
 | 
				                oldClrType: typeof(int), | 
			
		||||
 | 
				                oldType: "integer"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<string>( | 
			
		||||
 | 
				                name: "display_name", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "character varying(50)", | 
			
		||||
 | 
				                maxLength: 50, | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                defaultValue: "", | 
			
		||||
 | 
				                comment: "名称", | 
			
		||||
 | 
				                oldClrType: typeof(string), | 
			
		||||
 | 
				                oldType: "character varying(50)", | 
			
		||||
 | 
				                oldMaxLength: 50, | 
			
		||||
 | 
				                oldNullable: true); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<Guid>( | 
			
		||||
 | 
				                name: "id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "uuid", | 
			
		||||
 | 
				                fixedLength: true, | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                comment: "编号", | 
			
		||||
 | 
				                oldClrType: typeof(Guid), | 
			
		||||
 | 
				                oldType: "uuid"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<Guid>( | 
			
		||||
 | 
				                name: "last_modifier_id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "uuid", | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), | 
			
		||||
 | 
				                oldClrType: typeof(Guid), | 
			
		||||
 | 
				                oldType: "uuid", | 
			
		||||
 | 
				                oldNullable: true); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<DateTime>( | 
			
		||||
 | 
				                name: "last_modification_time", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "timestamp without time zone", | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), | 
			
		||||
 | 
				                oldClrType: typeof(DateTime), | 
			
		||||
 | 
				                oldType: "timestamp without time zone", | 
			
		||||
 | 
				                oldNullable: true); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<Guid>( | 
			
		||||
 | 
				                name: "creator_id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "uuid", | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), | 
			
		||||
 | 
				                oldClrType: typeof(Guid), | 
			
		||||
 | 
				                oldType: "uuid", | 
			
		||||
 | 
				                oldNullable: true); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        protected override void Down(MigrationBuilder migrationBuilder) | 
			
		||||
 | 
				        { | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "Id"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "last_modifier_id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "LastModifierId"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "last_modification_time", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "LastModificationTime"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "creator_id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "CreatorId"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "creation_time", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "CreationTime"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.RenameColumn( | 
			
		||||
 | 
				                name: "concurrency_stamp", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                newName: "ConcurrencyStamp"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterTable( | 
			
		||||
 | 
				                name: "collect_item_type", | 
			
		||||
 | 
				                oldComment: "汇总项目类别"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<string>( | 
			
		||||
 | 
				                name: "simple_code", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "character varying(50)", | 
			
		||||
 | 
				                maxLength: 50, | 
			
		||||
 | 
				                nullable: true, | 
			
		||||
 | 
				                oldClrType: typeof(string), | 
			
		||||
 | 
				                oldType: "character varying(50)", | 
			
		||||
 | 
				                oldMaxLength: 50, | 
			
		||||
 | 
				                oldComment: "简码"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<Guid>( | 
			
		||||
 | 
				                name: "invoice_item_type_id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "uuid", | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                oldClrType: typeof(Guid), | 
			
		||||
 | 
				                oldType: "uuid", | 
			
		||||
 | 
				                oldComment: "发票项目类别ID"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<int>( | 
			
		||||
 | 
				                name: "display_order", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "integer", | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                oldClrType: typeof(int), | 
			
		||||
 | 
				                oldType: "integer", | 
			
		||||
 | 
				                oldComment: "显示顺序"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<string>( | 
			
		||||
 | 
				                name: "display_name", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "character varying(50)", | 
			
		||||
 | 
				                maxLength: 50, | 
			
		||||
 | 
				                nullable: true, | 
			
		||||
 | 
				                oldClrType: typeof(string), | 
			
		||||
 | 
				                oldType: "character varying(50)", | 
			
		||||
 | 
				                oldMaxLength: 50, | 
			
		||||
 | 
				                oldComment: "名称"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<Guid>( | 
			
		||||
 | 
				                name: "Id", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "uuid", | 
			
		||||
 | 
				                nullable: false, | 
			
		||||
 | 
				                oldClrType: typeof(Guid), | 
			
		||||
 | 
				                oldType: "uuid", | 
			
		||||
 | 
				                oldFixedLength: true, | 
			
		||||
 | 
				                oldComment: "编号"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<Guid>( | 
			
		||||
 | 
				                name: "LastModifierId", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "uuid", | 
			
		||||
 | 
				                nullable: true, | 
			
		||||
 | 
				                oldClrType: typeof(Guid), | 
			
		||||
 | 
				                oldType: "uuid"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<DateTime>( | 
			
		||||
 | 
				                name: "LastModificationTime", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "timestamp without time zone", | 
			
		||||
 | 
				                nullable: true, | 
			
		||||
 | 
				                oldClrType: typeof(DateTime), | 
			
		||||
 | 
				                oldType: "timestamp without time zone"); | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				            migrationBuilder.AlterColumn<Guid>( | 
			
		||||
 | 
				                name: "CreatorId", | 
			
		||||
 | 
				                table: "collect_item_type", | 
			
		||||
 | 
				                type: "uuid", | 
			
		||||
 | 
				                nullable: true, | 
			
		||||
 | 
				                oldClrType: typeof(Guid), | 
			
		||||
 | 
				                oldType: "uuid"); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue