|
|
|
|
using Admin.Core.Model;
|
|
|
|
|
using Admin.Core.Common.Resource;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Admin.Core.Common;
|
|
|
|
|
using Admin.Core.IService.ISys;
|
|
|
|
|
using Admin.Core.Model.Sys;
|
|
|
|
|
|
|
|
|
|
namespace Admin.Core.Api
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// SysRoleDeptController
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("api/[controller]/[action]")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
[Authorize(Permissions.Name)]
|
|
|
|
|
public class SysRoleDeptController : BaseApiController
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// _sysRoleDeptService
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly ISysRoleDeptService _sysRoleDeptService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="SysRoleDeptService"></param>
|
|
|
|
|
public SysRoleDeptController(ISysRoleDeptService SysRoleDeptService)
|
|
|
|
|
{
|
|
|
|
|
_sysRoleDeptService = SysRoleDeptService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="page">第几页</param>
|
|
|
|
|
/// <param name="key"></param>
|
|
|
|
|
/// <param name="intPageSize">每页大小</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public MessageModel<PageModel<SysRoleDept>> GetByPage(int page = 1, string key = "", int intPageSize = 50)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(key) || string.IsNullOrWhiteSpace(key))
|
|
|
|
|
{
|
|
|
|
|
key = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Expression<Func<SysRoleDept, bool>> whereExpression = a => true;
|
|
|
|
|
|
|
|
|
|
var data = _sysRoleDeptService.QueryPageAsync(whereExpression, page, intPageSize, "UpdateTime").Result;
|
|
|
|
|
return SuccessPage(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据ID查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">主键</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public MessageModel<SysRoleDept> GetByID(int id)
|
|
|
|
|
{
|
|
|
|
|
return new MessageModel<SysRoleDept>()
|
|
|
|
|
{
|
|
|
|
|
msg = Resource_SysBase.OprateSuccess,
|
|
|
|
|
success = true,
|
|
|
|
|
data = _sysRoleDeptService.QueryByIdAsync(id).Result
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|