12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- 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;
- /// <summary>
- /// 随手拍行业管理接口
- /// </summary>
- 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;
- }
- /// <summary>
- /// 添加行业页面基础数据
- /// </summary>
- /// <returns></returns>
- [HttpGet("basedata")]
- public Dictionary<string, object> GetBaseData()
- {
- return new Dictionary<string, object>
- {
- { "department", _systemDicDataCacheManager.SnapshotDepartment },
- { "acceptType", _systemDicDataCacheManager.AcceptType},
- { "bulletinType", _systemDicDataCacheManager.SnapshotBulletinType}
- };
- }
- /// <summary>
- /// 新增行业
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public async Task<string> AddIndustry([FromBody] AddIndustryDto dto)
- => await _industryApplication.AddIndustryAsync(dto, HttpContext.RequestAborted);
- /// <summary>
- /// 行业详情
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet("{id}")]
- public async Task<IndustryDetailOutDto> GetIndustryDetailAsync(string id)
- => await _industryApplication.GetIndustryDetailAsync(id);
- /// <summary>
- /// 获取行业集合
- /// </summary>
- /// <returns></returns>
- [HttpGet("industry")]
- public async Task<PagedDto<IndustryItemsOutDto>> GetIndustryAsync([FromQuery] IndustryListInDto dto)
- => (await _industryApplication.GetIndustres(dto).ToPagedListAsync(dto, HttpContext.RequestAborted)).ToPaged();
- /// <summary>
- /// 修改行业
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPut]
- public async Task UpdateIndustry([FromBody] UpdateIndustryInDto dto)
- => await _industryApplication.UpdateIndustryAsync(dto, HttpContext.RequestAborted);
- }
|