72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
|
|
using APT.BaseData.Domain.Entities;
|
|||
|
|
using APT.BaseData.Domain.IServices;
|
|||
|
|
using APT.Infrastructure.Core;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using APT.Utility;
|
|||
|
|
using APT.Infrastructure.Api;
|
|||
|
|
using APT.Migrations;
|
|||
|
|
using APT.BaseData.Domain.Entities.OP;
|
|||
|
|
using APT.BaseData.Domain.Enums.OP;
|
|||
|
|
using APT.BaseData.Domain.Enums.PF;
|
|||
|
|
using APT.BaseData.Domain.IServices.OP;
|
|||
|
|
using Microsoft.Data.SqlClient;
|
|||
|
|
|
|||
|
|
namespace APT.PF.WebApiControllers.Api.PF
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
[Route("api/PF/PFBititle")]
|
|||
|
|
public class PFBititleController : AuthorizeApiController<T_PF_BITITLE>
|
|||
|
|
{
|
|||
|
|
IOPTenantDBConnService OPTenantDBConnService { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="opTenantDBConnService"></param>
|
|||
|
|
public PFBititleController(IOPTenantDBConnService opTenantDBConnService)
|
|||
|
|
{
|
|||
|
|
OPTenantDBConnService = opTenantDBConnService;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新或新增数据
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="entity">对象实体</param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost, Route("FullUpdate")]
|
|||
|
|
public JsonActionResult<bool> FullUpdate([FromBody] T_PF_BITITLE entity)
|
|||
|
|
{
|
|||
|
|
return SafeExecute(() =>
|
|||
|
|
{
|
|||
|
|
T_PF_BITITLE check = null;
|
|||
|
|
T_PF_BITITLE ModelUpdateOld = null;
|
|||
|
|
if (entity.STATUS == STATEEnum.release)
|
|||
|
|
{
|
|||
|
|
check = GetEntity<T_PF_BITITLE>(e => e.STATUS == STATEEnum.release);
|
|||
|
|
if (check != null)
|
|||
|
|
{
|
|||
|
|
if (check.ID == entity.ID)
|
|||
|
|
{
|
|||
|
|
//旧数据 撤回状态 本条修改ID 父项ID 版本号等
|
|||
|
|
ModelUpdateOld = check;
|
|||
|
|
ModelUpdateOld.STATUS = STATEEnum.Draft;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
throw new Exception("只能有一条已发布的标语!入需发布本本条,请撤回已发布的标语!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|