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 { /// /// 制定任务 /// [Route("api/SK/SKPlanSet")] public partial class PlanSetController : AuthorizeApiController { /// /// 更新或新增数据 /// /// 对象实体 /// [HttpPost, Route("FullUpdate")] public JsonActionResult FullUpdate([FromBody] T_SK_PLAN_SET entity) { return SafeExecute(() => { 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; }); } /// /// 排序分页查询数据 /// /// 分页过滤实体 /// [HttpPost, Route("SKOrderPaged")] public PagedActionResult SKOrderPaged([FromBody] KeywordPageFilter pageFilter) { var result = this.GetOrderPageEntities(null, pageFilter); if (result != null && result.Data != null && result.Data.Any()) { result.Data.ForEach(t => { if (t.MONTH == null || t.MONTH == 0) { t.MONTHStr = "--"; } if (t.DATA == null || t.DATA == 0) { t.DATAStr = "--"; } }); } return result; } } }