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.
97 lines
2.9 KiB
97 lines
2.9 KiB
using GDZZ.Core;
|
|
using Furion.DependencyInjection;
|
|
using Furion.DynamicApiController;
|
|
using Mapster;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using SqlSugar;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using GDZZ.Application.Entity;
|
|
namespace GDZZ.Application
|
|
{
|
|
/// <summary>
|
|
/// 求职者服务
|
|
/// </summary>
|
|
[ApiDescriptionSettings("Application",Name = "JobHunter", Order = 1)]
|
|
public class JobHunterService : IJobHunterService, IDynamicApiController, ITransient
|
|
{
|
|
private readonly SqlSugarRepository<JobHunter> _rep;
|
|
|
|
public JobHunterService(SqlSugarRepository<JobHunter> rep)
|
|
{
|
|
_rep = rep;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页查询求职者
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("/JobHunter/page")]
|
|
public async Task<dynamic> Page([FromQuery] JobHunterInput input)
|
|
{
|
|
var entities = await _rep.AsQueryable()
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
return entities.XnPagedResult();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加求职者
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("/JobHunter/add")]
|
|
public async Task Add(AddJobHunterInput input)
|
|
{
|
|
var entity = input.Adapt<JobHunter>();
|
|
await _rep.InsertAsync(entity);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除求职者
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("/JobHunter/delete")]
|
|
public async Task Delete(DeleteJobHunterInput input)
|
|
{
|
|
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
await _rep.DeleteAsync(entity);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新求职者
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("/JobHunter/edit")]
|
|
public async Task Update(UpdateJobHunterInput input)
|
|
{
|
|
var entity = input.Adapt<JobHunter>();
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取求职者
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("/JobHunter/detail")]
|
|
public async Task<JobHunter> Get([FromQuery] QueryeJobHunterInput input)
|
|
{
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取求职者列表
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("/JobHunter/list")]
|
|
public async Task<dynamic> List([FromQuery] JobHunterInput input)
|
|
{
|
|
return await _rep.ToListAsync();
|
|
}
|
|
}
|
|
}
|