94 lines
2.9 KiB
C#
94 lines
2.9 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 平台资质与规范接口实现类
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-22
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IPlatformSpecService), ServiceLifetime = LifeTime.Transient)]
|
|
public class PlatformSpecServiceImpl : BaseService<PlatformSpec>, IPlatformSpecService
|
|
{
|
|
private readonly PlatformSpecRepository _PlatformSpecRepository;
|
|
|
|
public PlatformSpecServiceImpl(PlatformSpecRepository PlatformSpecRepository)
|
|
{
|
|
this._PlatformSpecRepository = PlatformSpecRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询平台资质与规范分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<PlatformSpecVo>> GetPlatformSpecList(PlatformSpecQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<PlatformSpec>();
|
|
|
|
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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改平台资质与规范
|
|
/// </summary>
|
|
public async Task<string> 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
|
|
|
|
}
|
|
}
|