NewGaoKaoApi/New_College.Api/Controllers/Front/OccupationMapJobInfoControl...

59 lines
1.9 KiB
C#

using New_College.IServices;
using New_College.Model;
using New_College.Model.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
using SqlSugar;
namespace New_College.Api.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
[Authorize]
public class MapJobInfoController : ControllerBase
{
/// <summary>
/// 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下
/// </summary>
private readonly IOccupationMapJobInfoServices _occupationMapJobInfoServices;
public MapJobInfoController(IOccupationMapJobInfoServices OccupationMapJobInfoServices)
{
_occupationMapJobInfoServices = OccupationMapJobInfoServices;
}
/// <summary>
/// 根据职业名称查询岗位信息列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpGet]
public async Task<MessageModel<PageModel<OccupationMapJobInfo>>> Get([FromQuery] OccupationMapJobInfoRequest request)
{
if (string.IsNullOrWhiteSpace(request.OccupName))
{
return new MessageModel<PageModel<OccupationMapJobInfo>>()
{
msg = "Occupname必填",
success = false,
status = 200
};
}
request.OccupName = "后端开发";
var query = await _occupationMapJobInfoServices.QueryPage(c => SqlFunc.Contains(c.occupName, request.OccupName), request.PageIndex, request.PageSize);
return new MessageModel<PageModel<OccupationMapJobInfo>>()
{
msg = "获取成功",
success = true,
response = query
};
}
}
}