fix:接口

This commit is contained in:
geh 2025-04-27 19:36:01 +08:00
parent 594c85b083
commit 988fe2b2ef
2 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,92 @@
using BLL;
using System;
using System.Data.Linq.SqlClient;
using System.Linq;
using System.Web.Http;
namespace WebAPI.Controllers.HSSE
{
public class RectifyController : ApiController
{
#region
/// <summary>
/// 获取集合
/// </summary>
/// <returns></returns>
public Model.ResponeData getRectifyList(string RectifyName, int PageNumber, int PageSize)
{
var responeData = new Model.ResponeData();
try
{
var query = (from x in Funs.DB.Technique_Rectify
where x.IsEndLever.Value == true
select new
{
x.RectifyId,
x.RectifyName,
}).ToList();
if (!string.IsNullOrEmpty(RectifyName))
{
query = query.Where(x => x.RectifyName.Contains(RectifyName)).ToList();
}
var paginatedQuery = query
.Skip((PageNumber - 1) * PageSize)
.Take(PageSize)
.ToList();
responeData.data = paginatedQuery;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region id获取明细列表
/// <summary>
/// 获取集合
/// </summary>
/// <returns></returns>
public Model.ResponeData getRectifyItemListBy(string RectifyId,string HazardSourcePoint, int PageNumber, int PageSize)
{
var responeData = new Model.ResponeData();
try
{
var query = (from x in Funs.DB.Technique_RectifyItem
where x.RectifyId == RectifyId
select new
{
x.RectifyItemId,
x.HazardSourcePoint,
x.RiskAnalysis,
x.RiskPrevention
}).ToList();
if (!string.IsNullOrEmpty(HazardSourcePoint))
{
query = query.Where(x => x.HazardSourcePoint.Contains(HazardSourcePoint)).ToList();
}
var paginatedQuery = query
.Skip((PageNumber - 1) * PageSize)
.Take(PageSize)
.ToList();
responeData.data = paginatedQuery;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -152,6 +152,8 @@ namespace WebAPI.Filter
, "Person*PostAddUrl" , "Person*PostAddUrl"
, "Person*getWorkPostList" , "Person*getWorkPostList"
, "ProjectUnitPenetrate*getDataByProjectUnitId" , "ProjectUnitPenetrate*getDataByProjectUnitId"
, "Rectify*getRectifyList"
, "Rectify*getRectifyItemListBy"
}; };
/// <summary> /// <summary>