using Amazon.Runtime.Internal.Transform; using Hotline.Application.Snapshot; using Hotline.Caching.Interfaces; using Hotline.Repository.SqlSugar.Extensions; using Hotline.Share.Dtos; using Hotline.Share.Dtos.Snapshot; using Hotline.Share.Tools; using Hotline.Snapshot.Interfaces; using Microsoft.AspNetCore.Mvc; namespace Hotline.Api.Controllers.Snapshot; /// /// 随手拍行业管理接口 /// public class IndustryController : BaseController { private readonly IIndustryRepository _industryRepository; private readonly ISystemDicDataCacheManager _systemDicDataCacheManager; private readonly IIndustryApplication _industryApplication; public IndustryController(IIndustryRepository industryRepository, IIndustryApplication industryApplication, ISystemDicDataCacheManager systemDicDataCacheManager) { _industryRepository = industryRepository; _industryApplication = industryApplication; _systemDicDataCacheManager = systemDicDataCacheManager; } /// /// 添加行业页面基础数据 /// /// [HttpGet("basedata")] public Dictionary GetBaseData() { return new Dictionary { { "department", _systemDicDataCacheManager.SnapshotDepartment }, { "acceptType", _systemDicDataCacheManager.AcceptType}, { "bulletinType", _systemDicDataCacheManager.SnapshotBulletinType} }; } /// /// 新增行业 /// /// [HttpPost] public async Task AddIndustry([FromBody] AddIndustryDto dto) => await _industryApplication.AddIndustryAsync(dto, HttpContext.RequestAborted); /// /// 行业详情 /// /// /// [HttpGet("{id}")] public async Task GetIndustryDetailAsync(string id) => await _industryApplication.GetIndustryDetailAsync(id); /// /// 获取行业集合 /// /// [HttpGet("industry")] public async Task> GetIndustryAsync([FromQuery] IndustryListInDto dto) => (await _industryApplication.GetIndustres(dto).ToPagedListAsync(dto, HttpContext.RequestAborted)).ToPaged(); /// /// 修改行业 /// /// /// [HttpPut] public async Task UpdateIndustry([FromBody] UpdateIndustryInDto dto) => await _industryApplication.UpdateIndustryAsync(dto, HttpContext.RequestAborted); }