110 lines
3.3 KiB
C#
110 lines
3.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.Dto;
|
||
using DOAN.Model.MES.group;
|
||
using DOAN.Model.MES.group.Dto;
|
||
using DOAN.Service.group.IService;
|
||
using DOAN.Service.group;
|
||
using DOAN.Admin.WebApi.Filters;
|
||
|
||
//创建时间:2024-08-08
|
||
namespace DOAN.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 班次
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("mes/groupManagement/GroupShift")]
|
||
public class GroupShiftController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 班次接口
|
||
/// </summary>
|
||
private readonly IGroupShiftService _GroupShiftService;
|
||
|
||
public GroupShiftController(IGroupShiftService GroupShiftService)
|
||
{
|
||
_GroupShiftService = GroupShiftService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询班次列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "groupManagement:groupshift:list")]
|
||
public IActionResult QueryGroupShift([FromQuery] GroupShiftQueryDto parm)
|
||
{
|
||
var response = _GroupShiftService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询班次详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "groupManagement:groupshift:query")]
|
||
public IActionResult GetGroupShift(int Id)
|
||
{
|
||
var response = _GroupShiftService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<GroupShift>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加班次
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "groupManagement:groupshift:add")]
|
||
[Log(Title = "班次", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddGroupShift([FromBody] GroupShiftDto parm)
|
||
{
|
||
var modal = parm.Adapt<GroupShift>().ToCreate(HttpContext);
|
||
|
||
var response = _GroupShiftService.AddGroupShift(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新班次
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "groupManagement:groupshift:edit")]
|
||
[Log(Title = "班次", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateGroupShift([FromBody] GroupShiftDto parm)
|
||
{
|
||
var modal = parm.Adapt<GroupShift>().ToUpdate(HttpContext);
|
||
var response = _GroupShiftService.UpdateGroupShift(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除班次
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "groupManagement:groupshift:delete")]
|
||
[Log(Title = "班次", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteGroupShift(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _GroupShiftService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |