162 lines
5.0 KiB
C#
162 lines
5.0 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using VOL.Business.IServices;
|
|
using VOL.Business.IServices.School;
|
|
using VOL.Business.Services.School;
|
|
using VOL.Core.Filters;
|
|
using VOL.Core.ManageUser;
|
|
using VOL.Core.Utilities;
|
|
using VOL.Entity.DomainModels;
|
|
using VOL.Model;
|
|
using VOL.Model.School.Request;
|
|
using VOL.Model.School.Response;
|
|
|
|
namespace VOL.WebApi.Controllers.Business
|
|
{
|
|
/// <summary>
|
|
/// 学校管理
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
[ApiExplorerSettings(GroupName = "v3")]
|
|
[TypeFilter(typeof(CustomApiResponseFilter))]
|
|
public class SchoolController : ControllerBase
|
|
{
|
|
#region 初始化
|
|
private readonly IS_SchoolService _schoolService;
|
|
public SchoolController(
|
|
IS_SchoolService schoolService)
|
|
{
|
|
_schoolService = schoolService;
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 分页
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetSchoolPageList))]
|
|
public async Task<PageDataDto<SchoolPageListModel>> GetSchoolPageList(SchoolPageListParam paramDto)
|
|
{
|
|
return await _schoolService.GetSchoolPageList(paramDto);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(Add))]
|
|
public async Task<ActionResult> Add([FromBody] AddSchoolParam paramDto)
|
|
{
|
|
await _schoolService.Add(paramDto);
|
|
return Ok("新增成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(Modify))]
|
|
public async Task<ActionResult> Modify([FromBody] AddSchoolParam paramDto)
|
|
{
|
|
await _schoolService.Modify(paramDto);
|
|
return Ok("更新成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新状态
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(ModifyStatus))]
|
|
public async Task<ActionResult> ModifyStatus([FromBody] SchoolStatusParam paramDto)
|
|
{
|
|
await _schoolService.ModifyStatus(paramDto);
|
|
return Ok("更新成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新密码
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(UpdatePwd))]
|
|
public async Task<ActionResult> UpdatePwd([FromBody] SchoolParam paramDto)
|
|
{
|
|
await _schoolService.UpdatePwd(paramDto);
|
|
return Ok("更新成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 详情
|
|
/// </summary>
|
|
/// <param name="classId"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(Details))]
|
|
public async Task<SchoolPageListModel> Details(string schoolCode)
|
|
{
|
|
return await _schoolService.Details(schoolCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 学校性质
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetSchoolNatureList))]
|
|
public async Task<List<SchoolNatureListModel>> GetSchoolNatureList()
|
|
{
|
|
return await _schoolService.GetSchoolNatureList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 验证用户名是否存在
|
|
/// </summary>
|
|
/// <param name="userName"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(UserNameIsExists))]
|
|
public async Task<bool> UserNameIsExists(string userName)
|
|
{
|
|
return await _schoolService.UserNameIsExists(userName);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 验证设备编号是否存在
|
|
/// </summary>
|
|
/// <param name="userName"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(DeviceCodeIsExists))]
|
|
public async Task<bool> DeviceCodeIsExists(string code)
|
|
{
|
|
return await _schoolService.DeviceCodeIsExists(code);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 学校账号预约列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetSchoolAccountApplicationPageList))]
|
|
public async Task<PageDataDto<SchoolAccountApplicationModel>> GetSchoolAccountApplicationPageList(SchoolAccountApplicationParam paramDto)
|
|
{
|
|
return await _schoolService.GetSchoolAccountApplicationPageList(paramDto);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新预约状态
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(UpdateSchoolAccountApplicationStatus))]
|
|
public async Task<ActionResult> UpdateSchoolAccountApplicationStatus([FromBody] UpdateSchoolAccountApplicationStatus paramDto)
|
|
{
|
|
await _schoolService.UpdateSchoolAccountApplicationStatus(paramDto);
|
|
return Ok("更新成功");
|
|
}
|
|
}
|
|
}
|