57 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			57 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using APT.Infrastructure.Core;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.Entities.FM;
							 | 
						|||
| 
								 | 
							
								using Microsoft.AspNetCore.Mvc;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.IServices.FM;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								using APT.Utility;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.Entities.BD;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.Enums;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace APT.FM.WebApi.Controllers.Api.FM
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    /// <summary>
							 | 
						|||
| 
								 | 
							
								    /// 
							 | 
						|||
| 
								 | 
							
								    /// </summary>
							 | 
						|||
| 
								 | 
							
								    [Route("api/FM/FMDepartmentPost")]
							 | 
						|||
| 
								 | 
							
								    public class FMDepartmentPostController : AuthorizeApiController<T_FM_DEPARTMENT_POST>
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 更新
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="id"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        [HttpPost, Route("FullUpdate")]
							 | 
						|||
| 
								 | 
							
								        public JsonActionResult<bool> FullUpdate([FromBody] T_FM_DEPARTMENT_POST entity)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return SafeExecute<bool>(() =>
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var Users = entity.Nav_Users;
							 | 
						|||
| 
								 | 
							
								                entity.Nav_Users = null;
							 | 
						|||
| 
								 | 
							
								                if (Users == null || !Users.Any())
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    throw new Exception("请添加人员!");
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                int rowIndex = 1;
							 | 
						|||
| 
								 | 
							
								                foreach (var item in Users)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (item.USER_ID == Guid.Empty)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        throw new Exception("人员信息不能未空,行:" + rowIndex + "!");
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    rowIndex++;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                this.UnifiedCommit(() =>
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.UpdateEntityNoCommit(entity);
							 | 
						|||
| 
								 | 
							
								                    if (Users != null && Users.Any())
							 | 
						|||
| 
								 | 
							
								                        this.BantchSaveEntityNoCommit(Users);
							 | 
						|||
| 
								 | 
							
								                });
							 | 
						|||
| 
								 | 
							
								                return true;
							 | 
						|||
| 
								 | 
							
								            });
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |