using Infrastructure.Attribute; using Microsoft.AspNetCore.Http; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Infrastructure; using ARW.Model; using ARW.Repository; using ARW.Repository.Business.Settings.PlatformSpecs; using ARW.Service.Business.IBusinessService.Settings.PlatformSpecs; using ARW.Model.Dto.Business.Settings.PlatformSpecs; using ARW.Model.Models.Business.Settings.PlatformSpecs; using ARW.Model.Vo.Business.Settings.PlatformSpecs; namespace ARW.Service.Business.BusinessService.Settings.PlatformSpecs { /// /// 平台资质与规范接口实现类 /// /// @author lwh /// @date 2023-10-22 /// [AppService(ServiceType = typeof(IPlatformSpecService), ServiceLifetime = LifeTime.Transient)] public class PlatformSpecServiceImpl : BaseService, IPlatformSpecService { private readonly PlatformSpecRepository _PlatformSpecRepository; public PlatformSpecServiceImpl(PlatformSpecRepository PlatformSpecRepository) { this._PlatformSpecRepository = PlatformSpecRepository; } #region 业务逻辑代码 /// /// 查询平台资质与规范分页列表 /// public async Task> GetPlatformSpecList(PlatformSpecQueryDto parm) { //开始拼装查询条件d var predicate = Expressionable.Create(); predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.PlatformSpecTitle), s => s.PlatformSpecTitle.Contains(parm.PlatformSpecTitle)); var query = _PlatformSpecRepository .Queryable() .Where(predicate.ToExpression()) .OrderBy(s => s.PlatformSpecSort,OrderByType.Asc) .Select(s => new PlatformSpecVo { PlatformSpecId = s.PlatformSpecId, PlatformSpecGuid = s.PlatformSpecGuid, PlatformSpecTitle = s.PlatformSpecTitle, PlatformSpecContent = s.PlatformSpecContent, PlatformSpecSort = s.PlatformSpecSort, }); return await query.ToPageAsync(parm); } /// /// 添加或修改平台资质与规范 /// public async Task AddOrUpdatePlatformSpec(PlatformSpec model) { if (model.PlatformSpecId != 0) { var response = await _PlatformSpecRepository.UpdateAsync(model); return "修改成功!"; } else { var response = await _PlatformSpecRepository.InsertReturnSnowflakeIdAsync(model); return "添加成功!"; } } #region Excel处理 #endregion #endregion } }