using Microsoft.AspNetCore.Mvc;
|
using IStation.Model.Api;
|
using System.Net;
|
using System.Net.Http.Headers;
|
using Microsoft.Extensions.Hosting.Internal;
|
using Microsoft.AspNetCore.Http.Extensions;
|
using IStation.Untity;
|
|
namespace IStation.WebApi.Controllers.V1
|
{
|
/// <summary>
|
/// PipeLineBinding 标准Api
|
/// </summary>
|
[ApiController]
|
[Route("V1/Standard/PipeLineBinding")]
|
[ApiExplorerSettings(GroupName = "V1")]
|
public class PipeLineBinding_StandardController : ControllerBase
|
{
|
private readonly Service.PipeLineBinding _service = new Service.PipeLineBinding();
|
|
#region Query
|
|
/// <summary>
|
/// 通过 CorpID 获取
|
/// </summary>
|
[Route("GetByCorpID")]
|
[HttpGet]
|
public Result GetByCorpID(long CorpID)
|
{
|
if (CorpID < 1)
|
{
|
return new Result(Code.Error, "CorpID 参数错误");
|
}
|
var list = _service.GetByCorpID(CorpID);
|
return new Result<List<Model.PipeLineBinding>>(list);
|
}
|
|
/// <summary>
|
/// 通过 ID 获取
|
/// </summary>
|
[Route("GetByID")]
|
[HttpGet]
|
public Result GetByID(long CorpID, long ID)
|
{
|
if (CorpID < 1)
|
{
|
return new Result(Code.Error, "CorpID 参数错误");
|
}
|
if (ID < 1)
|
{
|
return new Result(Code.Error, "ID 参数错误");
|
}
|
var model = _service.GetByID(CorpID, ID);
|
return new Result<Model.PipeLineBinding>(model);
|
}
|
|
/// <summary>
|
/// 通过 Ids 获取
|
/// </summary>
|
[Route("GetByIds")]
|
[HttpGet]
|
public Result GetByIds(long CorpID, string Ids)
|
{
|
if (CorpID < 1)
|
{
|
return new Result(Code.Error, "CorpID 参数错误");
|
}
|
var ids = LongListHelper.ToList(Ids);
|
if (ids == null || ids.Count() < 1)
|
{
|
return new Result(Code.Error, "Ids 参数错误");
|
}
|
var list = _service.GetByIds(CorpID, ids);
|
return new Result<List<Model.PipeLineBinding>>(list);
|
}
|
|
/// <summary>
|
/// 通过 PipeLineID 获取
|
/// </summary>
|
[Route("GetByPipeLineID")]
|
[HttpGet]
|
public Result GetByPipeLineID(long CorpID, long PipeLineID)
|
{
|
if (CorpID < 1)
|
{
|
return new Result(Code.Error, "CorpID 参数错误");
|
}
|
if (PipeLineID < 1)
|
{
|
return new Result(Code.Error, "PipeLineID 参数错误");
|
}
|
var list = _service.GetByPipeLineID(CorpID, PipeLineID);
|
return new Result<List<Model.PipeLineBinding>>(list);
|
}
|
|
/// <summary>
|
/// 通过 GetByPipeLineIds 获取
|
/// </summary>
|
[Route("GetByPipeLineIds")]
|
[HttpGet]
|
public Result GetByPipeLineIds(long CorpID, string PipeLineIds)
|
{
|
if (CorpID < 1)
|
{
|
return new Result(Code.Error, "CorpID 参数错误");
|
}
|
var parentIds = LongListHelper.ToList(PipeLineIds);
|
if (parentIds == null || parentIds.Count() < 1)
|
{
|
return new Result(Code.Error, "PipeLineIds 参数错误");
|
}
|
var list = _service.GetByPipeLineIds(CorpID, parentIds);
|
return new Result<List<Model.PipeLineBinding>>(list);
|
}
|
|
/// <summary>
|
/// 通过 PipeLineIds 获取正在使用的
|
/// </summary>
|
[Route("GetUseByPipeLineIds")]
|
[HttpGet]
|
public Result GetUseByPipeLineIds(long CorpID, string PipeLineIds)
|
{
|
if (CorpID < 1)
|
{
|
return new Result(Code.Error, "CorpID 参数错误");
|
}
|
var parentIds = LongListHelper.ToList(PipeLineIds);
|
if (parentIds == null || parentIds.Count() < 1)
|
{
|
return new Result(Code.Error, "PipeLineIds 参数错误");
|
}
|
var list = _service.GetUseByPipeLineIds(CorpID, parentIds);
|
return new Result<List<Model.PipeLineBinding>>(list);
|
}
|
|
/// <summary>
|
/// 通过 ObjectType 和 ObjectID 获取
|
/// </summary>
|
[Route("GetByObjectTypeAndObjectID")]
|
[HttpGet]
|
public Result GetByObjectTypeAndObjectID(long CorpID, string ObjectType, long ObjectID)
|
{
|
if (CorpID < 1)
|
{
|
return new Result(Code.Error, "CorpID 参数错误");
|
}
|
if (string.IsNullOrEmpty(ObjectType))
|
{
|
return new Result(Code.Error, "ObjectType 参数错误");
|
}
|
if (ObjectID < 1)
|
{
|
return new Result(Code.Error, "ObjectID 参数错误");
|
}
|
var list = _service.GetByObjectTypeAndObjectID(CorpID, ObjectType,ObjectID);
|
return new Result<List<Model.PipeLineBinding>>(list);
|
}
|
|
|
#endregion
|
|
#region Insert
|
|
/// <summary>
|
/// 插入一条
|
/// </summary>
|
[Route("Insert")]
|
[HttpPost]
|
public Result Insert(Model.PipeLineBinding model)
|
{
|
if (model == null)
|
{
|
return new Result(Code.Error, "参数错误");
|
}
|
|
var id = _service.Insert(model);
|
return new Result<long>(id);
|
}
|
|
/// <summary>
|
/// 插入多条
|
/// </summary>
|
[Route("Inserts")]
|
[HttpPost]
|
public Result Inserts(List<Model.PipeLineBinding> list)
|
{
|
if (list == null || list.Count() < 1)
|
{
|
return new Result(Code.Error, "参数错误");
|
}
|
var bol = _service.Inserts(list);
|
return new Result<bool>(bol);
|
}
|
|
#endregion
|
|
#region Update
|
|
/// <summary>
|
/// 更新一条
|
/// </summary>
|
[Route("Update")]
|
[HttpPut]
|
public Result Update(Model.PipeLineBinding model)
|
{
|
if (model == null)
|
{
|
return new Result(Code.Error, "参数错误");
|
}
|
|
var bol = _service.Update(model);
|
return new Result<bool>(bol);
|
}
|
|
/// <summary>
|
/// 更新多条
|
/// </summary>
|
[Route("Updates")]
|
[HttpPut]
|
public Result Updates(List<Model.PipeLineBinding> list)
|
{
|
if (list == null || list.Count() < 1)
|
{
|
return new Result(Code.Error, "参数错误");
|
}
|
var bol = _service.Updates(list);
|
return new Result<bool>(bol);
|
}
|
|
|
#endregion
|
|
|
}
|
}
|