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;
///
/// 插入新工程
///
/// 工程对象
/// 工程对象
[HttpPost("insert")]
public async Task insert(ProjectDO project)
{
return Ok(await ProjectService.Insert(project));
}
///
/// 更新工程
///
/// 工程对象
/// 工程对象
[HttpPost("update")]
[HttpPut("update")]
public async Task update(ProjectDO project)
{
return Ok(await ProjectService.Update(project));
}
///
/// 删除工程
///
/// 工程编号数组
///
[HttpDelete("delete")]
[HttpPost("delete")]
public async Task delete(string[] ids)
{
await ProjectService.Delete(ids);
return Ok();
}
///
/// 根据编号查询工程详情
///
/// 编号
/// 工程
[HttpGet("get/{id}")]
[HttpPost("get/{id}")]
[AllowAnonymous]
public async Task get(string id)
{
return Ok(await ProjectService.Get(id));
}
///
/// 分页查询工程
///
/// 分页对象
/// 分页数据
[HttpPost("list")]
[AllowAnonymous]
public async Task list(PageSearch page)
{
return Ok(await ProjectService.List(page));
}
[HttpGet("geo")]
public async Task geo() {
return Ok(await ProjectService.GeoCount());
}
}
}