|
@@ -3,6 +3,7 @@ using Hotline.Repository.SqlSugar.Extensions;
|
|
|
using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Dtos.Snapshot;
|
|
|
using Hotline.Share.Tools;
|
|
|
+using Hotline.Snapshot.IRepository;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using System.ComponentModel;
|
|
|
|
|
@@ -12,10 +13,28 @@ namespace Hotline.Api.Controllers.Snapshot;
|
|
|
public class SnapshotUserController : BaseController
|
|
|
{
|
|
|
private readonly ISnapshotUserApplication _snapshotUserApplication;
|
|
|
+ private readonly ISafetyTypeRepository _safetyTypeRepository;
|
|
|
|
|
|
- public SnapshotUserController(ISnapshotUserApplication snapshotUserApplication)
|
|
|
+ public SnapshotUserController(ISnapshotUserApplication snapshotUserApplication, ISafetyTypeRepository safetyTypeRepository)
|
|
|
{
|
|
|
_snapshotUserApplication = snapshotUserApplication;
|
|
|
+ _safetyTypeRepository = safetyTypeRepository;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取添加安全志愿者和安全员分类关系的基础数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("citizen_relation/basedata")]
|
|
|
+ public async Task<Dictionary<string, object>> GetCitizenRelationSafetyTypeBase()
|
|
|
+ {
|
|
|
+ var safetyTypes = await _safetyTypeRepository.Queryable()
|
|
|
+ .Select(m => new { m.Id, m.Name})
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+ return new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "safetyTypes", safetyTypes }
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -27,11 +46,20 @@ public class SnapshotUserController : BaseController
|
|
|
=> (await _snapshotUserApplication.GetCitizenRelationSafetyType(dto).ToPagedListAsync(dto)).ToPaged();
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 添加安全志愿者
|
|
|
+ /// 添加安全志愿者和安全员分类关系
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("citizen_relation")]
|
|
|
public async Task AddCitizenRelationSafetyTypeInDto([FromBody]AddCitizenRelationSafetyTypeInDto dto)
|
|
|
=> await _snapshotUserApplication.AddCitizenRelationSafetyType(dto, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 批量删除安全志愿者分类关系
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpDelete("citizen_relation")]
|
|
|
+ public async Task DeleteCitizenRelationSafetyType([FromBody] DeleteCitizenRelationSafetyTypeInDto dto)
|
|
|
+ => await _snapshotUserApplication.DeleteCitizenRelationSafetyAsync(dto);
|
|
|
}
|