You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

63 lines
1.9 KiB

using Microsoft.AspNetCore.Mvc;
using System;
using Znyc.Cloudcar.Admin.AspNetCore.Controllers;
using Znyc.Cloudcar.Admin.Security.Dtos;
using Znyc.Cloudcar.Admin.Security.Entitys;
using Znyc.Cloudcar.Admin.Security.IServices;
namespace Znyc.Cloudcar.Admin.WebApi.Controllers
{
/// <summary>
/// 地区接口
/// </summary>
[ApiController]
[Route("api/Security/[controller]")]
public class AreaController : AreaApiController<AreaEntity, AreaOutputDto, AreaInputDto, IAreaService, long>
{
/// <summary>
/// 构造函数
/// </summary>
/// <param name="_service"></param>
public AreaController(IAreaService _service) : base(_service)
{
_service = _service;
}
/// <summary>
/// 新增前处理数据
/// </summary>
/// <param name="info"></param>
protected override void OnBeforeInsert(AreaEntity info)
{
info.Id = 0;
info.CreatedTime = DateTime.Now;
info.CreatedUserId = CurrentUser.UserId;
info.IsDeleted = false;
if (info.SortCode == null)
{
info.SortCode = 99;
}
}
/// <summary>
/// 在更新数据前对数据的修改操作
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
protected override void OnBeforeUpdate(AreaEntity info)
{
info.ModifiedUserId = CurrentUser.UserId;
info.ModifiedTime = DateTime.Now;
}
/// <summary>
/// 在软删除数据前对数据的修改操作
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
protected override void OnBeforeSoftDelete(AreaEntity info)
{
info.IsDeleted = true;
}
}
}