人员单位管理
parent
d68ddef86a
commit
3fd9ec74d0
|
|
@ -16,6 +16,7 @@ using OpenAuth.App.Const;
|
|||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.App.ServiceApp.FireManagement.Response;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.FireManagement
|
||||
{
|
||||
|
|
@ -131,7 +132,66 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return new Response<List<FmUserUnit>> { Result = userunit };
|
||||
}
|
||||
}
|
||||
|
||||
#region 单位管理
|
||||
//添加人员单位
|
||||
public async Task<Response<bool>> AddUserUnit(FmUserUnit info)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
{
|
||||
info.Id = YitIdHelper.NextId();
|
||||
await db.FmUserUnit.InsertAsync(info);
|
||||
if (db.Commit())
|
||||
{
|
||||
return new Response<bool> { Result = true, Message = "操作成功" };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Response<bool> { Result = false, Message = "操作失败" };
|
||||
}
|
||||
}
|
||||
}
|
||||
//编辑人员单位
|
||||
public async Task<Response<bool>> EditUserUnit(FmUserUnit info)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
{
|
||||
await db.FmUserUnit.UpdateAsync(info);
|
||||
if (db.Commit())
|
||||
{
|
||||
return new Response<bool> { Result = true, Message = "操作成功" };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Response<bool> { Result = false, Message = "操作失败" };
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取单个人员单位
|
||||
public async Task<Response<FmUserUnit>> LoadUserUnitById(long id)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
{
|
||||
var info = await db.FmUserUnit.AsQueryable().FirstAsync(r => r.Id == id);
|
||||
return new Response<FmUserUnit> { Result = info };
|
||||
}
|
||||
}
|
||||
//删除人员单位
|
||||
public async Task<Response<bool>> DeleteUserUnit(long id)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
{
|
||||
await db.FmUserUnit.DeleteAsync(r => r.Id == id);
|
||||
if (db.Commit())
|
||||
{
|
||||
return new Response<bool> { Result = true, Message = "操作成功" };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Response<bool> { Result = false, Message = "操作失败" };
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 火情线索
|
||||
public async Task<Response<bool>> AddFireClueInfo(FmFireclueInfo info)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -102,7 +102,88 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
|
|||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
#region 人员单位管理
|
||||
/// <summary>
|
||||
/// 添加人员单位
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Response<bool>> AddUserUnit(FmUserUnit info)
|
||||
{
|
||||
Response<bool> response = new Response<bool>();
|
||||
try
|
||||
{
|
||||
return await _app.AddUserUnit(info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑人员单位
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Response<bool>> EditUserUnit(FmUserUnit info)
|
||||
{
|
||||
Response<bool> response = new Response<bool>();
|
||||
try
|
||||
{
|
||||
return await _app.EditUserUnit(info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除人员单位
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Response<bool>> DeleteUserUnit(long id)
|
||||
{
|
||||
Response<bool> response = new Response<bool>();
|
||||
try
|
||||
{
|
||||
return await _app.DeleteUserUnit(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取单条人员单位
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Response<FmUserUnit>> LoadUserUnitById(long id)
|
||||
{
|
||||
Response<FmUserUnit> response = new Response<FmUserUnit>();
|
||||
try
|
||||
{
|
||||
return await _app.LoadUserUnitById(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
#endregion
|
||||
#region 火情线索
|
||||
/// <summary>
|
||||
/// 添加火情线索
|
||||
|
|
|
|||
Loading…
Reference in New Issue