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/productCaseInfo")]
public class HwProductCaseInfoController : HwPortalControllerBase
{
private readonly HwProductCaseInfoService _caseInfoService;
private readonly HwPortalConfigTypeService _configTypeService;
public HwProductCaseInfoController(HwProductCaseInfoService caseInfoService, HwPortalConfigTypeService configTypeService)
{
_caseInfoService = caseInfoService;
_configTypeService = configTypeService;
}
[HttpGet("list")]
public async Task<HwPortalTableDataInfo<HwProductCaseInfo>> List([FromQuery] HwProductCaseInfo input)
{
return GetDataTable(await _caseInfoService.SelectHwProductCaseInfoList(input));
}
[HttpPost("export")]
[Idempotent]
public async Task<IActionResult> Export([FromQuery] HwProductCaseInfo input)
{
return ExportExcel(await _caseInfoService.SelectHwProductCaseInfoList(input), "案例信息数据");
}
[HttpGet("{caseInfoId:long}")]
public async Task<HwPortalAjaxResult> GetInfo(long caseInfoId)
{
return Success(await _caseInfoService.SelectHwProductCaseInfoByCaseInfoId(caseInfoId));
}
[HttpPost]
[Idempotent]
public async Task<HwPortalAjaxResult> Add([FromBody] HwProductCaseInfo input)
{
return ToAjax(await _caseInfoService.InsertHwProductCaseInfo(input));
}
[HttpPut]
[Idempotent]
public async Task<HwPortalAjaxResult> Edit([FromBody] HwProductCaseInfo input)
{
return ToAjax(await _caseInfoService.UpdateHwProductCaseInfo(input));
}
[HttpDelete("{caseInfoIds}")]
[Idempotent]
public async Task<HwPortalAjaxResult> Remove(string caseInfoIds)
{
return ToAjax(await _caseInfoService.DeleteHwProductCaseInfoByCaseInfoIds(ParseLongArray(caseInfoIds)));
}
[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();
}