Commit bf363bff authored by 黄奎's avatar 黄奎

页面修改

parent 226d0683
......@@ -66,10 +66,6 @@ namespace Edu.Model.Entity.User
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 角色列表
/// </summary>
public string RoleAuth { get; set; }
/// <summary>
/// 部门编号
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User
{
/// <summary>
/// 员工视图实体类
/// </summary>
public class Employee_ViewModel : Model.Entity.User.RB_Account
{
/// <summary>
/// 员工姓名
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// 集团名称
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 学校名称
/// </summary>
public string SchoolName { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string UserIcon { get; set; }
/// <summary>
/// 部门编号
/// </summary>
public int Dept_Id { get; set; }
/// <summary>
/// 岗位编号
/// </summary>
public int Post_Id { get; set; }
/// <summary>
/// 部门名称
/// </summary>
public string DeptName { get; set; }
/// <summary>
/// 岗位名称
/// </summary>
public string PostName { get; set; }
/// <summary>
/// 岗位编号【查询使用,逗号分隔】
/// </summary>
public string QPostIds { get; set; }
/// <summary>
/// 部门编号【查询使用,逗号分隔】
/// </summary>
public string QDeptIds { get; set; }
/// <summary>
/// 人员类型【查询使用,逗号分隔】
/// </summary>
public string AccountTypeStr { get; set; }
}
}
......@@ -35,16 +35,6 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public string SName { get; set; }
/// <summary>
/// 角色列表
/// </summary>
public List<int> RoleList
{
get {
return Common.ConvertHelper.StringToList(this.RoleAuth);
}
}
/// <summary>
/// 管理者账号
/// </summary>
......
......@@ -45,5 +45,10 @@ namespace Edu.Model.ViewModel.User
return this.UpdateTime.FormatTime();
}
}
/// <summary>
/// 部门名称
/// </summary>
public string DeptName { get; set; }
}
}
......@@ -97,7 +97,6 @@ namespace Edu.Module.User
{ nameof(RB_Manager_ViewModel.MHead),model.MHead },
{ nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy },
{ nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime },
{ nameof(RB_Manager_ViewModel.RoleAuth),model.RoleAuth },
{ nameof(RB_Manager_ViewModel.Dept_Id),model.Dept_Id },
{ nameof(RB_Manager_ViewModel.Post_Id),model.Post_Id },
};
......
......@@ -17,6 +17,11 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 部门仓储层对象
/// </summary>
private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository();
/// <summary>
/// 获取学校列表
/// </summary>
......@@ -24,7 +29,7 @@ namespace Edu.Module.User
/// <returns></returns>
public List<RB_School_ViewModel> GetSchoolListModule(RB_School_ViewModel query)
{
return schoolRepository.GetSchoolListRepository(query);
return schoolRepository.GetSchoolListRepository(query); ;
}
/// <summary>
......@@ -37,7 +42,24 @@ namespace Edu.Module.User
/// <returns></returns>
public List<RB_School_ViewModel> GetSchoolPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_School_ViewModel query)
{
return schoolRepository.GetSchoolPageListRepository(pageIndex, pageSize, out rowsCount, query);
var list= schoolRepository.GetSchoolPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
List<RB_Department_ViewModel> deptList = new List<RB_Department_ViewModel>();
string deptIds = string.Join(",", list.Where(qitem => qitem.Dept_Id > 0).Select(qitem => qitem.Dept_Id));
if (!string.IsNullOrEmpty(deptIds))
{
deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel()
{
QDeptIds = deptIds
});
}
foreach (var item in list)
{
item.DeptName = deptList?.Where(qitem => qitem.DeptId == item.Dept_Id)?.FirstOrDefault()?.DeptName ?? "";
}
}
return list;
}
/// <summary>
......@@ -71,7 +93,8 @@ namespace Edu.Module.User
{nameof(RB_School_ViewModel.Remark),model.Remark },
{nameof(RB_School_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_School_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_School_ViewModel.Status),model.Status }
{nameof(RB_School_ViewModel.Status),model.Status },
{nameof(RB_School_ViewModel.Dept_Id),model.Dept_Id }
};
flag = schoolRepository.Update(fileds, new WhereHelper(nameof(RB_School_ViewModel.SId), model.SId));
}
......
......@@ -153,5 +153,97 @@ FROM
var list = Get<RB_Account_ViewModel>(builder.ToString()).ToList();
return list;
}
/// <summary>
/// 获取员工列表【管理者、讲师、助教】
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<Employee_ViewModel> GetEmployeeListRepository(Employee_ViewModel query)
{
DynamicParameters parameters = new DynamicParameters();
StringBuilder where = new StringBuilder();
StringBuilder where2 = new StringBuilder();
if (query != null)
{
if (query.Group_Id > 0)
{
where.AppendFormat(" AND A.{0}={1} ", nameof(Employee_ViewModel.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
where.AppendFormat(" AND A.{0}={1} ", nameof(Employee_ViewModel.School_Id), query.School_Id);
}
if (!string.IsNullOrWhiteSpace(query.Account))
{
where.AppendFormat(" AND A.{0}='{1}' ", nameof(Employee_ViewModel.Account), query.Account.Trim());
}
if (query.AccountType > 0)
{
where.AppendFormat(" AND A.{0}={1} ", nameof(Employee_ViewModel.AccountType), (int)query.AccountType);
}
if (query.Id > 0)
{
where.AppendFormat(" AND A.{0}={1} ", nameof(Employee_ViewModel.Id), query.Id);
}
if (query.AccountId > 0)
{
where.AppendFormat(" AND A.{0}={1} ", nameof(Employee_ViewModel.AccountId), query.AccountId);
}
if (query.Post_Id > 0)
{
where.AppendFormat(" AND B.{0}={1} ", nameof(Employee_ViewModel.Post_Id), query.Post_Id);
}
if (!string.IsNullOrEmpty(query.QPostIds))
{
where.AppendFormat(" AND B.{0} IN({1}) ", nameof(Employee_ViewModel.Post_Id), query.QPostIds);
}
if (query.Dept_Id > 0)
{
where.AppendFormat(" AND B.{0}={1} ", nameof(Employee_ViewModel.Dept_Id), query.Dept_Id);
}
if (!string.IsNullOrEmpty(query.QDeptIds))
{
where.AppendFormat(" AND B.{0} IN({1}) ", nameof(Employee_ViewModel.Dept_Id), query.QDeptIds);
}
//员工姓名
if (!string.IsNullOrEmpty(query.EmployeeName))
{
where2.AppendFormat(" AND A.{0} LIKE @EmployeeName ", nameof(Employee_ViewModel.EmployeeName));
parameters.Add("EmployeeName", "%" + query.EmployeeName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.AccountTypeStr))
{
where2.AppendFormat(" AND A.{0} IN({1}) ", nameof(Employee_ViewModel.AccountType), query.AccountTypeStr);
}
}
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.Id,A.Account,A.Group_Id,A.School_Id,IFNULL(G.GroupName,'') AS GroupName,IFNULL(s.SName,'') AS SchoolName
,IFNULL(d.DeptName,'') AS DeptName,IFNULL(p.PostName,'') AS PostName
FROM
(
SELECT A.*,IFNULL(B.MName,'') AS EmployeeName,B.MHead AS UserIcon,B.Dept_Id,B.Post_Id
FROM rb_account AS A INNER JOIN rb_manager AS B ON A.AccountId=B.MId AND A.AccountType=1
WHERE 1=1 {0}
UNION ALL
SELECT A.*,IFNULL(B.TeacherName,'') AS EmployeeName,B.TeacherIcon AS UserIcon,B.Dept_Id,B.Post_Id
FROM rb_account AS A INNER JOIN rb_teacher AS B ON A.AccountId=B.TId AND A.AccountType=2
WHERE 1=1 {0}
UNION ALL
SELECT A.*,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id
FROM rb_account AS A INNER JOIN rb_assist AS B ON A.AccountId=B.AId AND A.AccountType=3
WHERE 1=1 {0}
) AS A LEFT JOIN rb_group AS g ON A.Group_Id=g.GId
LEFT JOIN rb_school AS s ON A.School_Id=s.SId
LEFT JOIN rb_department AS d ON A.Dept_Id=d.DeptId
LEFT JOIN rb_post AS p ON A.Post_Id=p.PostId
WHERE 1=1 {1}
", where.ToString(),where2.ToString());
var list = Get<Employee_ViewModel>(builder.ToString(),parameters).ToList();
return list;
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using Edu.AOP;
using Edu.Cache.User;
using Edu.Common.API;
using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.User;
using Edu.Module.User;
......@@ -64,6 +66,11 @@ namespace Edu.WebApi.Controllers.User
/// </summary>
private readonly DepartmentModule departmentModule = AOPHelper.CreateAOPObject<DepartmentModule>();
/// <summary>
/// 员工处理类对象
/// </summary>
private readonly EmployeeModule employeeModule = new EmployeeModule();
#region 用户账户管理
/// <summary>
......@@ -280,7 +287,6 @@ namespace Edu.WebApi.Controllers.User
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Teacher_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
//query.School_Id = base.UserInfo.School_Id;
var list = teacherModule.GetTeacherPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
......@@ -769,11 +775,11 @@ namespace Edu.WebApi.Controllers.User
[HttpPost]
public ApiResult GetOrganizationChart()
{
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Department_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
var rootModel = groupModule.GetGroupEntityModule(query.Group_Id);
var obj = departmentModule.GetOrganizationChartModule(rootModel,query);
var obj = departmentModule.GetOrganizationChartModule(rootModel, query);
return ApiResult.Success(data: obj);
}
......@@ -909,5 +915,48 @@ namespace Edu.WebApi.Controllers.User
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 员工查询
/// <summary>
/// 获取岗位列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetEmployeeList()
{
var query = new Employee_ViewModel()
{
School_Id = base.ParmJObj.GetInt("School_Id"),
Account = base.ParmJObj.GetStringValue("Account"),
AccountType = (AccountTypeEnum)base.ParmJObj.GetInt("AccountType"),
Id = base.ParmJObj.GetInt("Id"),
AccountId = base.ParmJObj.GetInt("AccountId"),
Post_Id = base.ParmJObj.GetInt("Post_Id"),
QPostIds = base.ParmJObj.GetStringValue("QPostIds"),
Dept_Id = base.ParmJObj.GetInt("Dept_Id"),
QDeptIds = base.ParmJObj.GetStringValue("QDeptIds"),
EmployeeName = base.ParmJObj.GetStringValue("EmployeeName"),//姓名
AccountTypeStr=base.ParmJObj.GetStringValue("AccountTypeStr"),//人员类型【逗号分割】
};
query.Group_Id = base.UserInfo.Group_Id;
var list = employeeModule.GetEmployeeListModule(query);
return ApiResult.Success(data: list?.Select(qitem => new
{
qitem.Id,
qitem.Account,
qitem.Group_Id,
qitem.GroupName,
qitem.School_Id,
qitem.SchoolName,
qitem.EmployeeName,
qitem.UserIcon,
qitem.Dept_Id,
qitem.DeptName,
qitem.Post_Id,
qitem.PostName
}));
}
#endregion
}
}
\ No newline at end of file
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