|
@@ -28,8 +28,9 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
|
|
|
private readonly IIndustryCaseRepository _industryCaseRepository;
|
|
|
private readonly ISnapshotSMSTemplateRepository _snapshotSMSTemplateRepository;
|
|
|
private readonly IPractitionerRepository _practitionerRepository;
|
|
|
+ private readonly IVolunteerRepository _volunteerRepository;
|
|
|
|
|
|
- public IndustryApplication(IIndustryRepository industryRepository, IFileRepository fileRepository, ISystemSettingCacheManager sysSetting, IIndustryCaseRepository industryCaseRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IPractitionerRepository practitionerRepository)
|
|
|
+ public IndustryApplication(IIndustryRepository industryRepository, IFileRepository fileRepository, ISystemSettingCacheManager sysSetting, IIndustryCaseRepository industryCaseRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IPractitionerRepository practitionerRepository, IVolunteerRepository volunteerRepository)
|
|
|
{
|
|
|
_industryRepository = industryRepository;
|
|
|
_fileRepository = fileRepository;
|
|
@@ -37,6 +38,7 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
|
|
|
_industryCaseRepository = industryCaseRepository;
|
|
|
_snapshotSMSTemplateRepository = snapshotSMSTemplateRepository;
|
|
|
_practitionerRepository = practitionerRepository;
|
|
|
+ _volunteerRepository = volunteerRepository;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 新增行业
|
|
@@ -280,8 +282,59 @@ public class IndustryApplication : IIndustryApplication, IScopeDependency
|
|
|
var entity = dto.Adapt<Practitioner>();
|
|
|
await _practitionerRepository.UpdateAsync(entity);
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 志愿者
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 志愿者集合
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="NotImplementedException"></exception>
|
|
|
+ public ISugarQueryable<VolunteerItemsOutDto> GetVolunteerItemsAsync(VolunteerItemsInDto dto)
|
|
|
+ {
|
|
|
+ var query = _volunteerRepository.Queryable()
|
|
|
+ .WhereIF(dto.Name.NotNullOrEmpty(), m => m.Name.Contains(dto.Name))
|
|
|
+ .WhereIF(dto.PhoneNumber.NotNullOrEmpty(), m => m.PhoneNumber.Contains(dto.PhoneNumber))
|
|
|
+ .Select<VolunteerItemsOutDto>();
|
|
|
+ return query;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 添加志愿者
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<string> AddVolunteerAsync(AddVolunteerInDto dto)
|
|
|
+ {
|
|
|
+ var entity = dto.Adapt<Volunteer>();
|
|
|
+ entity.Id = await _volunteerRepository.AddAsync(entity);
|
|
|
+ return entity.Id;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 批量删除志愿者
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="ids"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task DeleteVolunteerAsync(IList<string> ids)
|
|
|
+ {
|
|
|
+ await _volunteerRepository.Updateable()
|
|
|
+ .SetColumns(m => m.IsDeleted, true)
|
|
|
+ .Where(m => ids.Contains(m.Id))
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 志愿者详情
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Volunteer> GetVolunteerAsync(string id)
|
|
|
+ {
|
|
|
+ return await _volunteerRepository.GetAsync(id);
|
|
|
+ }
|
|
|
#endregion
|
|
|
}
|