/// <summary>
        /// 新增
        /// </summary>
        /// <param name="moduleElementRequestDto"></param>
        /// <returns></returns>
        public async Task <bool> CreateAsync(ModuleElementRequestDto moduleElementRequestDto)
        {
            var moduleElement = moduleElementRequestDto.MapToCreateEntity <ModuleElementRequestDto, ModuleElement>();
            await ModuleElementValidatorsFilter.DoValidationAsync(_moduleElementRespository, moduleElement, ValidatorTypeConstants.Create);

            return(await _moduleElementRespository.InsertAsync(moduleElement));
        }
        /// <summary>
        /// 批量新增
        /// </summary>
        /// <param name="moduleElementRequestDtos"></param>
        /// <returns></returns>
        public async Task <bool> BatchCreateAsync(IList <ModuleElementRequestDto> moduleElementRequestDtos)
        {
            var entities = moduleElementRequestDtos.MapToCreateEntities <ModuleElementRequestDto, ModuleElement>();
            await ModuleElementValidatorsFilter.DoValidationAsync(_moduleElementRespository, entities, ValidatorTypeConstants.Create);

            await _moduleElementRespository.BatchInsertAsync(entities);

            return(true);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="moduleElementRequestDto"></param>
        /// <returns></returns>
        public async Task <bool> ModifyAsync(ModuleElementRequestDto moduleElementRequestDto)
        {
            var moduleElement = await _moduleElementRespository.FirstOrDefaultAsync(e => e.Id == moduleElementRequestDto.Id);

            var entity = moduleElementRequestDto.MapToModifyEntity <ModuleElementRequestDto, ModuleElement>(moduleElement);
            await ModuleElementValidatorsFilter.DoValidationAsync(_moduleElementRespository, entity, ValidatorTypeConstants.Modify);

            return(await _moduleElementRespository.UpdateAsync(entity));
        }
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="moduleElementRequestDtos"></param>
        /// <returns></returns>
        public async Task <bool> BatchModifyAsync(IList <ModuleElementRequestDto> moduleElementRequestDtos)
        {
            var ids            = moduleElementRequestDtos.Select(m => m.Id).ToList();
            var moduleElements = await _moduleElementRespository.EntitiesByExpressionAsync(e => ids.Contains(e.Id));

            var entities = moduleElementRequestDtos.MapToModifyEntities <ModuleElementRequestDto, ModuleElement>(moduleElements.ToList());
            await ModuleElementValidatorsFilter.DoValidationAsync(_moduleElementRespository, entities, ValidatorTypeConstants.Create);

            await _moduleElementRespository.BatchUpdateAsync(entities);

            return(true);
        }