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.
110 lines
3.7 KiB
110 lines
3.7 KiB
using GDZZ.Core;
|
|
using Furion.DependencyInjection;
|
|
using Furion.DynamicApiController;
|
|
using Mapster;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Threading.Tasks;
|
|
using GDZZ.Application.Entity;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
namespace GDZZ.Application
|
|
{
|
|
/// <summary>
|
|
/// 求职列表服务
|
|
/// </summary>
|
|
[ApiDescriptionSettings("Application",Name = "JobHunt", Order = 1)]
|
|
public class JobHuntService : IJobHuntService, IDynamicApiController, ITransient
|
|
{
|
|
private readonly SqlSugarRepository<JobHunt> _rep;
|
|
|
|
public JobHuntService(SqlSugarRepository<JobHunt> rep)
|
|
{
|
|
_rep = rep;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页查询求职列表
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("/JobHunt/page")]
|
|
[AllowAnonymous]
|
|
public async Task<dynamic> Page([FromQuery] JobHuntInput input)
|
|
{
|
|
var entities = await _rep.AsQueryable()
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Address), u => u.Address.Contains(input.Address.Trim()))
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Tags), u => u.Tags == input.Tags)
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Position), u => u.Position == input.Position)
|
|
.OrderBy(u => u.Sort)
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
return entities.XnPagedResult();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加求职列表
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("/JobHunt/add")]
|
|
[AllowAnonymous]
|
|
public async Task Add(AddJobHuntInput input)
|
|
{
|
|
var entity = input.Adapt<JobHunt>();
|
|
await _rep.InsertAsync(entity);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除求职列表
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("/JobHunt/delete")]
|
|
[AllowAnonymous]
|
|
public async Task Delete(DeleteJobHuntInput input)
|
|
{
|
|
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
await _rep.DeleteAsync(entity);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新求职列表
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("/JobHunt/edit")]
|
|
[AllowAnonymous]
|
|
public async Task Update(UpdateJobHuntInput input)
|
|
{
|
|
var entity = input.Adapt<JobHunt>();
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取求职列表
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("/JobHunt/Detail")]
|
|
[AllowAnonymous]
|
|
public async Task<JobHunt> Get([FromQuery] QueryeJobHuntInput input)
|
|
{
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取求职列表列表
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("/JobHunt/list")]
|
|
[AllowAnonymous]
|
|
public async Task<dynamic> List([FromQuery] JobHuntInput input)
|
|
{
|
|
return await _rep.AsQueryable()
|
|
.Where(x=>x.CreatedUserId == UserManager.UserId)
|
|
.OrderByDescending(x=>x.Tags)
|
|
.ToListAsync();
|
|
}
|
|
}
|
|
}
|