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.
88 lines
2.5 KiB
C#
88 lines
2.5 KiB
C#
using CommonModel;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using ZhongLianInterface;
|
|
using ZhongLianModel;
|
|
|
|
namespace ZhongLianAPI.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class ProjectController : ControllerBase
|
|
{
|
|
public ProjectController(IProjectService projectService)
|
|
{
|
|
ProjectService = projectService;
|
|
}
|
|
|
|
private readonly IProjectService ProjectService;
|
|
|
|
/// <summary>
|
|
/// 插入新工程
|
|
/// </summary>
|
|
/// <param name="project">工程对象</param>
|
|
/// <returns>工程对象</returns>
|
|
[HttpPost("insert")]
|
|
public async Task<ActionResult> insert(ProjectDO project)
|
|
{
|
|
return Ok(await ProjectService.Insert(project));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新工程
|
|
/// </summary>
|
|
/// <param name="project">工程对象</param>
|
|
/// <returns>工程对象</returns>
|
|
[HttpPost("update")]
|
|
[HttpPut("update")]
|
|
public async Task<ActionResult> update(ProjectDO project)
|
|
{
|
|
return Ok(await ProjectService.Update(project));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除工程
|
|
/// </summary>
|
|
/// <param name="ids">工程编号数组</param>
|
|
/// <returns></returns>
|
|
[HttpDelete("delete")]
|
|
[HttpPost("delete")]
|
|
public async Task<ActionResult> delete(string[] ids)
|
|
{
|
|
await ProjectService.Delete(ids);
|
|
return Ok();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据编号查询工程详情
|
|
/// </summary>
|
|
/// <param name="id">编号</param>
|
|
/// <returns>工程</returns>
|
|
[HttpGet("get/{id}")]
|
|
[HttpPost("get/{id}")]
|
|
[AllowAnonymous]
|
|
public async Task<ActionResult> get(string id)
|
|
{
|
|
return Ok(await ProjectService.Get(id));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页查询工程
|
|
/// </summary>
|
|
/// <param name="page">分页对象</param>
|
|
/// <returns>分页数据</returns>
|
|
[HttpPost("list")]
|
|
[AllowAnonymous]
|
|
public async Task<ActionResult> list(PageSearch<ProjectDO> page)
|
|
{
|
|
return Ok(await ProjectService.List(page));
|
|
}
|
|
|
|
[HttpGet("geo")]
|
|
public async Task<ActionResult> geo() {
|
|
return Ok(await ProjectService.GeoCount());
|
|
}
|
|
}
|
|
}
|