Commit 41d653dc authored by 黄奎's avatar 黄奎

新增教师团队接口

parent 75b682ba
......@@ -131,5 +131,10 @@ namespace Edu.Model.Entity.StudyAbroad
/// 部门负责人审核时间
/// </summary>
public DateTime? ManagerAuditTime { get; set; }
/// <summary>
/// 封面图
/// </summary>
public string ImgCover { get; set; }
}
}
using Edu.Common.Enum;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Web
{
/// <summary>
/// 教师团队管理实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Web_Teacher
{
/// <summary>
/// 主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 教师姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 头像
/// </summary>
public string Icon { get; set; }
/// <summary>
/// 教师介绍
/// </summary>
public string Intro { get; set; }
/// <summary>
/// 类型(1-日语培训老师,2-留学服务老师)
/// </summary>
public int Type { get; set; }
/// <summary>
/// 性别
/// </summary>
public int Sex { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 创建人编号
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
using Edu.Model.Entity.Web;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Web
{
/// <summary>
/// 教师团队管理视图实体类
/// </summary>
public class RB_Web_Teacher_ViewModel : RB_Web_Teacher
{
}
}
......@@ -143,6 +143,7 @@ namespace Edu.Module.StudyAbroad
{ nameof(RB_StudyAbroad_ViewModel.SupplierContract),model.SupplierContract},
{ nameof(RB_StudyAbroad_ViewModel.Remark),model.Remark},
{ nameof(RB_StudyAbroad_ViewModel.School_Id),model.School_Id},
{ nameof(RB_StudyAbroad_ViewModel.ImgCover),model.ImgCover},
};
flag = studyAbroadRepository.Update(fileds, new WhereHelper(nameof(RB_StudyAbroad_ViewModel.Id), model.Id));
}
......
using Edu.Model.ViewModel.Web;
using Edu.Repository.Web;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Module.Web
{
/// <summary>
/// 教师团队管理处理类
/// </summary>
public class WebTeacherModule
{
/// <summary>
/// 教师团队管理仓储层对象
/// </summary>
private readonly RB_Web_TeacherRepository web_TeacherRepository = new RB_Web_TeacherRepository();
/// <summary>
/// 获取教师团队分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Teacher_ViewModel> GetWebTeacherPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_Teacher_ViewModel query)
{
return web_TeacherRepository.GetWebTeacherPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取教师团队列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Teacher_ViewModel> GetWebTeacherListModule(RB_Web_Teacher_ViewModel query)
{
return web_TeacherRepository.GetWebTeacherListRepository(query);
}
/// <summary>
/// 新增修改教师团队
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetWebTeacherModule(RB_Web_Teacher_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_Teacher_ViewModel.Name),model.Name },
{nameof(RB_Web_Teacher_ViewModel.Icon),model.Icon },
{nameof(RB_Web_Teacher_ViewModel.Intro),model.Intro },
{nameof(RB_Web_Teacher_ViewModel.Type),model.Type },
{nameof(RB_Web_Teacher_ViewModel.Sex),model.Sex },
};
flag = web_TeacherRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Teacher_ViewModel.Id), model.Id));
}
else
{
var newId = web_TeacherRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取教师团队详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Web_Teacher_ViewModel GetWebTeacherModule(object Id)
{
return web_TeacherRepository.GetEntity<RB_Web_Teacher_ViewModel>(Id);
}
/// <summary>
/// 修改教师团队状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status">0-正常,1-删除</param>
/// <returns></returns>
public bool RemoveWebTeacherStatusModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_Teacher_ViewModel.Status),Status },
};
var flag = web_TeacherRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Teacher_ViewModel.Id), Id));
return flag;
}
}
}
\ No newline at end of file
using Edu.Common.Enum;
using Edu.Model.Entity.Web;
using Edu.Model.ViewModel.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Web
{
/// <summary>
/// 教师团队管理仓储层
/// </summary>
public class RB_Web_TeacherRepository : BaseRepository<RB_Web_Teacher>
{
/// <summary>
/// 获取教师团队分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Teacher_ViewModel> GetWebTeacherPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Web_Teacher_ViewModel query)
{
rowsCount = 0;
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Web_Teacher AS A
WHERE 1=1
");
if (query == null)
{
return new List<RB_Web_Teacher_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Teacher_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.Name))
{
builder.AppendFormat(" AND A.{0} LIKE @Name ", nameof(RB_Web_Teacher_ViewModel.Name));
parameters.Add("Name", "%" + query.Name.Trim() + "%");
}
if (query.Status >= 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Teacher_ViewModel.Status), (int)query.Status);
}
if (query.Type > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Teacher_ViewModel.Type), query.Type);
}
}
return GetPage<RB_Web_Teacher_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取教师团队列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Teacher_ViewModel> GetWebTeacherListRepository(RB_Web_Teacher_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Web_Teacher AS A
WHERE 1=1
");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Teacher_ViewModel.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_Web_Teacher_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Teacher_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.Name))
{
builder.AppendFormat(" AND A.{0} LIKE @Name ", nameof(RB_Web_Teacher_ViewModel.Name));
parameters.Add("Name", "%" + query.Name.Trim() + "%");
}
if (query.Type > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Teacher_ViewModel.Type), query.Type);
}
}
return Get<RB_Web_Teacher_ViewModel>(builder.ToString()).ToList();
}
}
}
......@@ -268,6 +268,7 @@ namespace Edu.WebApi.Controllers.StudyAbroad
item.ManagerStatus,
item.ManagerOpinion,
ManagerAuditTime = Common.ConvertHelper.FormatTime(item.ManagerAuditTime),
item.ImgCover,
});
}
pageModel.Count = rowsCount;
......@@ -343,6 +344,7 @@ namespace Edu.WebApi.Controllers.StudyAbroad
item.ManagerStatus,
item.ManagerOpinion,
ManagerAuditTime = Common.ConvertHelper.FormatTime(item.ManagerAuditTime),
item.ImgCover,
});
}
pageModel.Count = rowsCount;
......@@ -405,6 +407,7 @@ namespace Edu.WebApi.Controllers.StudyAbroad
UpdateTime = DateTime.Now,
Group_Id = this.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("School_Id"),
ImgCover=base.ParmJObj.GetStringValue("ImgCover"),
};
extModel.SaleState =Common.Enum.Sale.SaleStateEnum.NoPerfect;
bool flag = studyAbroadModule.SetStudyAbroadModule(extModel);
......@@ -494,6 +497,7 @@ namespace Edu.WebApi.Controllers.StudyAbroad
ManagerAuditTimeStr= Common.ConvertHelper.FormatTime(extModel.ManagerAuditTime),
ManagerName = UserReidsCache.GetUserLoginInfo(extModel.ManagerId)?.AccountName ?? "",
extModel.PreferentialList,
extModel.ImgCover,
};
return ApiResult.Success(data: obj);
}
......
......@@ -32,6 +32,11 @@ namespace Edu.WebApi.Controllers.Web
/// </summary>
private readonly WebNewsModule newsModule = new WebNewsModule();
/// <summary>
/// 教师团队管理处理类对象
/// </summary>
private readonly WebTeacherModule teacherModule = new WebTeacherModule();
#region 网站导航管理
/// <summary>
/// 获取网站导航列表
......@@ -401,5 +406,97 @@ namespace Edu.WebApi.Controllers.Web
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 教师团队管理
/// <summary>
/// 获取教师团队列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetWebTeacherList()
{
var query = new RB_Web_Teacher_ViewModel()
{
Name = base.ParmJObj.GetStringValue("Name"),
Type = base.ParmJObj.GetInt("Type"),
};
query.Group_Id = base.UserInfo.Group_Id;
var list = teacherModule.GetWebTeacherListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取教师团队分页
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetWebTeacherPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Web_Teacher_ViewModel()
{
Name = base.ParmJObj.GetStringValue("Name"),
Type = base.ParmJObj.GetInt("Type"),
Status = (DateStateEnum)base.ParmJObj.GetInt("Status"),
};
query.Group_Id = base.UserInfo.Group_Id;
var list = teacherModule.GetWebTeacherPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 新增修改教师团队
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetWebTeacher()
{
var extModel = new RB_Web_Teacher_ViewModel()
{
Id = base.ParmJObj.GetInt("Id"),
Name = base.ParmJObj.GetStringValue("Name"),
Icon = base.ParmJObj.GetStringValue("Icon"),
Intro = base.ParmJObj.GetStringValue("Intro"),
Type = base.ParmJObj.GetInt("Type"),
Sex = base.ParmJObj.GetInt("Sex"),
};
extModel.School_Id = base.UserInfo.School_Id;
extModel.Group_Id = base.UserInfo.Group_Id;
extModel.CreateBy = base.UserInfo.Id;
extModel.CreateDate = DateTime.Now;
extModel.Status = DateStateEnum.Normal;
bool flag = teacherModule.SetWebTeacherModule(extModel);
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取教师团队详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetWebTeacher()
{
var Id = base.ParmJObj.GetInt("Id", 0);
var extModel = teacherModule.GetWebTeacherModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 修改教师团队状态
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveWebTeacherStatus()
{
var Id = base.ParmJObj.GetInt("Id", 0);
var Status = base.ParmJObj.GetInt("Status", 0);
var flag = teacherModule.RemoveWebTeacherStatusModule(Id, Status);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment