using Microsoft.AspNetCore.Mvc; using System; using Znyc.Recruitment.Admin.AspNetCore.Controllers; using Znyc.Recruitment.Admin.Security.Dtos; using Znyc.Recruitment.Admin.Security.Entitys; using Znyc.Recruitment.Admin.Security.IServices; namespace Znyc.Recruitment.Admin.WebApi.Controllers { /// /// 地区接口 /// [ApiController] [Route("api/Security/[controller]")] public class AreaController : AreaApiController { /// /// 构造函数 /// /// public AreaController(IAreaService _service) : base(_service) { _service = _service; } /// /// 新增前处理数据 /// /// 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; } } /// /// 在更新数据前对数据的修改操作 /// /// /// protected override void OnBeforeUpdate(AreaEntity info) { info.ModifiedUserId = CurrentUser.UserId; info.ModifiedTime = DateTime.Now; } /// /// 在软删除数据前对数据的修改操作 /// /// /// protected override void OnBeforeSoftDelete(AreaEntity info) { info.IsDeleted = true; } } }