84 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using APT.Infrastructure.Core;
 | 
						|
using APT.MS.Domain.Entities.SK;
 | 
						|
using APT.Utility;
 | 
						|
using Microsoft.AspNetCore.Mvc;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Linq;
 | 
						|
 | 
						|
namespace APT.SK.WebApi.Controllers.Api
 | 
						|
{
 | 
						|
    [Route("api/SK/SKBasicLibraryTemp")]
 | 
						|
    public partial class BasicLibraryTempController : AuthorizeApiController<T_SK_BASIC_LIBRARY_TEMP>
 | 
						|
    {
 | 
						|
        /// <summary>
 | 
						|
        /// 保存
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="entity"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("FullUpdate")]
 | 
						|
        public JsonActionResult<bool> FullUpdate([FromBody] T_SK_BASIC_LIBRARY_TEMP entity)
 | 
						|
        {
 | 
						|
            return SafeExecute<bool>(() =>
 | 
						|
            {
 | 
						|
                var measures = entity.Nav_Measures;
 | 
						|
                entity.Nav_Measures = null;
 | 
						|
                var contents = entity.Nav_Contents;
 | 
						|
                entity.Nav_Contents = null;
 | 
						|
                var hiddens = entity.Nav_Hiddens;
 | 
						|
                entity.Nav_Hiddens = null;
 | 
						|
                List<T_SK_BASIC_LIBRARY_TEMP_MEASURE_LEVEL> levelList = new List<T_SK_BASIC_LIBRARY_TEMP_MEASURE_LEVEL>();
 | 
						|
                if (measures != null && measures.Any())
 | 
						|
                {
 | 
						|
                    foreach (var item in measures)
 | 
						|
                    {
 | 
						|
                        if (item.Nav_Levels != null && item.Nav_Levels.Any())
 | 
						|
                        {
 | 
						|
                            foreach (var item2 in item.Nav_Levels)
 | 
						|
                            {
 | 
						|
                                item2.ORG_ID = entity.ORG_ID;
 | 
						|
                                item2.BASIC_LIBRARY_TEMP_MEASURE_ID = item.ID;
 | 
						|
                                item2.Nav_Measure = null;
 | 
						|
                                levelList.Add(item2);
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                        item.ORG_ID = entity.ORG_ID;
 | 
						|
                        item.BASIC_LIBRARY_TEMP_ID = entity.ID;
 | 
						|
                        item.Nav_Levels = null;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                if (contents != null && contents.Any())
 | 
						|
                {
 | 
						|
                    foreach (var item in contents)
 | 
						|
                    {
 | 
						|
                        item.ORG_ID = entity.ORG_ID;
 | 
						|
                        item.BASIC_LIBRARY_TEMP_ID = entity.ID;
 | 
						|
                        item.Nav_Contents = null;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                if (hiddens != null && hiddens.Any())
 | 
						|
                {
 | 
						|
                    foreach (var item in hiddens)
 | 
						|
                    {
 | 
						|
                        item.ORG_ID = entity.ORG_ID;
 | 
						|
                        item.BASIC_LIBRARY_TEMP_ID = entity.ID;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                this.UnifiedCommit(() =>
 | 
						|
                {
 | 
						|
                    if (entity != null)
 | 
						|
                        UpdateEntityNoCommit(entity);
 | 
						|
                    if (measures != null && measures.Any())
 | 
						|
                        BantchSaveEntityNoCommit(measures);
 | 
						|
                    if (levelList != null && levelList.Any())
 | 
						|
                        BantchSaveEntityNoCommit(levelList);
 | 
						|
                    if (contents != null && contents.Any())
 | 
						|
                        BantchSaveEntityNoCommit(contents);
 | 
						|
                    if (hiddens != null && hiddens.Any())
 | 
						|
                        BantchSaveEntityNoCommit(hiddens);
 | 
						|
                });
 | 
						|
                return true;
 | 
						|
            });
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |