You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.2 KiB
C#

namespace Admin.NET.Plugin.HwPortal;
[AllowAnonymous]
[Route("portal/portalConfig")]
public class HwPortalConfigController : HwPortalControllerBase
{
private readonly HwPortalConfigService _configService;
private readonly HwPortalConfigTypeService _configTypeService;
public HwPortalConfigController(HwPortalConfigService configService, HwPortalConfigTypeService configTypeService)
{
_configService = configService;
_configTypeService = configTypeService;
}
[HttpGet("list")]
public async Task<HwPortalTableDataInfo<HwPortalConfig>> List([FromQuery] HwPortalConfig input)
{
return GetDataTable(await _configService.SelectHwPortalConfigJoinList(input));
}
[HttpPost("export")]
[Idempotent]
public async Task<IActionResult> Export([FromQuery] HwPortalConfig input)
{
return ExportExcel(await _configService.SelectHwPortalConfigList(input), "门户配置数据");
}
[HttpGet("{portalConfigId:long}")]
public async Task<HwPortalAjaxResult> GetInfo(long portalConfigId)
{
return Success(await _configService.SelectHwPortalConfigByPortalConfigId(portalConfigId));
}
[HttpPost]
[Idempotent]
public async Task<HwPortalAjaxResult> Add([FromBody] HwPortalConfig input)
{
return ToAjax(await _configService.InsertHwPortalConfig(input));
}
[HttpPut]
[Idempotent]
public async Task<HwPortalAjaxResult> Edit([FromBody] HwPortalConfig input)
{
return ToAjax(await _configService.UpdateHwPortalConfig(input));
}
[HttpDelete("{portalConfigIds}")]
[Idempotent]
public async Task<HwPortalAjaxResult> Remove(string portalConfigIds)
{
return ToAjax(await _configService.DeleteHwPortalConfigByPortalConfigIds(ParseLongArray(portalConfigIds)));
}
[HttpGet("portalConfigTypeTree")]
public async Task<HwPortalAjaxResult> PortalConfigTypeTree([FromQuery] HwPortalConfigType input)
{
return Success(await _configTypeService.SelectPortalConfigTypeTreeList(input));
}
private static long[] ParseLongArray(string value) => value.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
}