mh_jy_safe/APT.MicroApi/APT.SK.WebApi/Controllers/Api/PlanSetController.cs

74 lines
2.6 KiB
C#
Raw Normal View History

2025-08-25 09:56:57 +08:00
using APT.Infrastructure.Core;
using APT.MS.Domain.Entities.SK;
using APT.Utility;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
namespace APT.SK.WebApi.Controllers.Api
{
/// <summary>
/// 制定任务
/// </summary>
[Route("api/SK/SKPlanSet")]
public partial class PlanSetController : AuthorizeApiController<T_SK_PLAN_SET>
{
/// <summary>
/// 更新或新增数据
/// </summary>
/// <param name="entity">对象实体</param>
/// <returns></returns>
[HttpPost, Route("FullUpdate")]
public JsonActionResult<bool> FullUpdate([FromBody] T_SK_PLAN_SET entity)
{
return SafeExecute<bool>(() =>
{
var details = entity.Nav_ListDepOut;
entity.Nav_ListDepOut = null;
var objects = entity.Nav_ListSetDepObject;
entity.Nav_ListSetDepObject = null;
var areas = entity.Nav_ListArea;
entity.Nav_ListArea = null;
if (details != null && details.Any())
{
foreach (var item in details)
{
item.ORG_ID = entity.ORG_ID;
item.PLANSET_ID = entity.ID;
item.Nav_Department = null;
}
}
if (objects != null && objects.Any())
{
foreach (var item in objects)
{
item.ORG_ID = entity.ORG_ID;
item.PLANSET_ID = entity.ID;
item.Nav_Department = null;
}
}
if (areas != null && areas.Any())
{
foreach (var item in areas)
{
item.ORG_ID = entity.ORG_ID;
item.PLANSET_ID = entity.ID;
item.Nav_Area = null;
}
}
this.UnifiedCommit(() =>
{
if (entity != null)
UpdateEntityNoCommit(entity);
if (details != null && details.Any())
BantchSaveEntityNoCommit(details);
if (objects != null && objects.Any())
BantchSaveEntityNoCommit(objects);
if (areas != null && areas.Any())
BantchSaveEntityNoCommit(areas);
});
return true;
});
}
}
}