114 lines
3.5 KiB
C#
114 lines
3.5 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.Factory_Model.Dto;
|
||
using DOAN.Model.Factory_Model;
|
||
using DOAN.Service.Factory_Model.IService;
|
||
using DOAN.Admin.WebApi.Filters;
|
||
|
||
//创建时间:2024-08-26
|
||
namespace DOAN.Admin.WebApi.Controllers.Factory_Model
|
||
{
|
||
/// <summary>
|
||
/// 公司
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("Factory_Model/BaseCompany")]
|
||
public class BaseCompanyController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 公司接口
|
||
/// </summary>
|
||
private readonly IBaseCompanyService _BaseCompanyService;
|
||
|
||
public BaseCompanyController(IBaseCompanyService BaseCompanyService)
|
||
{
|
||
_BaseCompanyService = BaseCompanyService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询公司列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "basecompany:list")]
|
||
public IActionResult QueryBaseCompany([FromQuery] BaseCompanyQueryDto parm)
|
||
{
|
||
var response = _BaseCompanyService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
/// <summary>
|
||
/// 查询公司列表 没有分页
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list_no_page")]
|
||
|
||
public IActionResult QueryBaseCompany_No_page([FromQuery] BaseCompanyQueryDto parm)
|
||
{
|
||
var response = _BaseCompanyService.GetList_No_page(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询公司详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "basecompany:query")]
|
||
public IActionResult GetBaseCompany(int Id)
|
||
{
|
||
var response = _BaseCompanyService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<BaseCompanyDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加公司
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "basecompany:add")]
|
||
[Log(Title = "公司", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddBaseCompany([FromBody] BaseCompanyDto parm)
|
||
{
|
||
var modal = parm.Adapt<BaseCompany>().ToCreate(HttpContext);
|
||
|
||
var response = _BaseCompanyService.AddBaseCompany(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新公司
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "basecompany:edit")]
|
||
[Log(Title = "公司", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateBaseCompany([FromBody] BaseCompanyDto parm)
|
||
{
|
||
var modal = parm.Adapt<BaseCompany>().ToUpdate(HttpContext);
|
||
var response = _BaseCompanyService.UpdateBaseCompany(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除公司
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "basecompany:delete")]
|
||
[Log(Title = "公司", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteBaseCompany([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<int>(ids);
|
||
|
||
return ToResponse(_BaseCompanyService.Delete(idArr));
|
||
}
|
||
|
||
}
|
||
} |