Commit ce487e85 authored by 黄奎's avatar 黄奎

页面修改

parent 5cf01634
......@@ -25,6 +25,7 @@ namespace Edu.Common
try
{
timeStr = Convert.ToDateTime(time.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
}
catch
{
......@@ -47,6 +48,10 @@ namespace Edu.Common
try
{
timeStr = Convert.ToDateTime(time.ToString()).ToString("yyyy-MM-dd");
if (timeStr == "0001-01-01")
{
timeStr = "";
}
}
catch
{
......
......@@ -50,7 +50,7 @@ namespace Edu.Common.Plugin
{
Type type = obj.GetType();
FieldInfo fild = type.GetField(obj.ToString());
if (fild.IsDefined(typeof(EnumFieldAttribute), true))
if (fild!=null && fild.IsDefined(typeof(EnumFieldAttribute), true))
{
EnumFieldAttribute enumField = (EnumFieldAttribute)fild.GetCustomAttribute(typeof(EnumFieldAttribute), true);
return enumField.Name;
......
using Edu.Common.Enum.User;
using System;
namespace Edu.Model.ViewModel.User
{
/// <summary>
/// 后台员工管理实体类
/// </summary>
public class AdminEmp_ViewModel
{
/// <summary>
/// 表主键编号
/// </summary>
public int TabKeyId { get; set; }
/// <summary>
/// 头像
/// </summary>
public string EmployeeIcon { get; set; }
/// <summary>
/// 员工姓名
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 部门编号
/// </summary>
public int Dept_Id { get; set; }
/// <summary>
/// 岗位编号
/// </summary>
public int Post_Id { get; set; }
/// <summary>
/// 性别
/// </summary>
public int Sex { get; set; }
/// <summary>
/// 员工电话
/// </summary>
public string EmployeePhone { get; set; }
/// <summary>
/// 员工生日
/// </summary>
public DateTime BirthDate { get; set; }
/// <summary>
/// 学历
/// </summary>
public EducationEnum Education { get; set; }
/// <summary>
/// 在职状态
/// </summary>
public LeaveStatusEnum LeaveStatus { get; set; }
/// <summary>
/// 账号类型
/// </summary>
public AccountTypeEnum AccountType { get; set; }
/// <summary>
/// 账号
/// </summary>
public string Account { get; set; }
/// <summary>
/// 员工编号
/// </summary>
public int EmployeeId { get; set; }
/// <summary>
/// 离职时间
/// </summary>
public DateTime? LeaveTime { get; set; }
/// <summary>
/// 集团名称
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 校区名称
/// </summary>
public string SchoolName { get; set; }
/// <summary>
/// 部门名称
/// </summary>
public string DeptName { get; set; }
/// <summary>
/// 岗位名称
/// </summary>
public string PostName { get; set; }
/// <summary>
/// 行政备注
/// </summary>
public string Remarks { get; set; }
/// <summary>
/// 入职时间
/// </summary>
public DateTime EntryTime { get; set; }
/// <summary>
/// 入职开始时间
/// </summary>
public string StartEntryTime { get; set; }
/// <summary>
/// 入职结束时间
/// </summary>
public string EndEntryTime { get; set; }
/// <summary>
/// 开始离职时间
/// </summary>
public string StartLeaveTime { get; set; }
/// <summary>
/// 结束离职时间
/// </summary>
public string EndLeaveTime { get; set; }
/// <summary>
/// 开始生日日期
/// </summary>
public string StartBirthDate { get; set; }
/// <summary>
/// 结束生日日期
/// </summary>
public string EndBirthDate { get; set; }
}
}
......@@ -47,34 +47,22 @@ namespace Edu.Module.User
}
/// <summary>
/// 获取管理者分页列表
/// 员工分页列表(管理者、讲师、助教)
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Manager_ViewModel> GetManagerPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Manager_ViewModel query)
public List<AdminEmp_ViewModel> GetAdminEmpPageListModule(int pageIndex, int pageSize, out long rowsCount, AdminEmp_ViewModel query)
{
var list= managerRepository.GetManagerPageListRepository(pageIndex, pageSize, out rowsCount, query);
var list= managerRepository.GetAdminEmpPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
string postIds = string.Join(",", list.Where(qitem => qitem.Post_Id > 0).Select(qitem => qitem.Post_Id));
string deptIds = string.Join(",", list.Where(qitem => qitem.Dept_Id > 0).Select(qitem => qitem.Dept_Id));
List<RB_Post_ViewModel> postList = new List<RB_Post_ViewModel>();
List<RB_Department_ViewModel> deptList = new List<RB_Department_ViewModel>();
if (!string.IsNullOrEmpty(postIds))
{
postList= postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = postIds });
}
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 ?? "";
item.PostName = postList?.Where(qitem => qitem.PostId == item.Post_Id)?.FirstOrDefault()?.PostName ?? "";
}
}
return list;
......
......@@ -56,53 +56,93 @@ WHERE 1=1
}
/// <summary>
/// 获取管理者分页列表
/// 员工分页列表(管理者、讲师、助教)
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Manager_ViewModel> GetManagerPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Manager_ViewModel query)
public List<AdminEmp_ViewModel> GetAdminEmpPageListRepository(int pageIndex, int pageSize, out long rowsCount, AdminEmp_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.SName,IFNULL(account.Account,'') ManagerAccount
FROM rb_manager AS A LEFT JOIN rb_school AS B ON A.School_Id=B.SId
LEFT JOIN rb_account AS account ON (A.MId=account.AccountId and account.AccountType=1)
SELECT A.* ,IFNULL(G.GroupName,'') AS GroupName,IFNULL(s.SName,'') AS SchoolName
,IFNULL(d.DeptName,'') AS DeptName,IFNULL(p.PostName,'') AS PostName
FROM
(
SELECT A.MId AS TabKeyId,A.MName AS EmployeeName,A.School_Id,A.Group_Id,A.Dept_Id,A.Post_Id,IFNULL(A.Sex,0) AS Sex,A.MTel AS EmployeePhone,A.BirthDate,A.Education,A.LeaveStatus,A.LeaveTime
, 1 AS AccountType,IFNULL(B.Account,'') AS Account,IFNULL(B.Id,0) AS EmployeeId,A.MHead AS EmployeeIcon,A.EntryTime
FROM rb_manager AS A LEFT JOIN rb_account AS B ON A.MId=B.AccountId AND B.AccountType=1
UNION ALL
SELECT A.TId AS TabKeyId,A.TeacherName AS EmployeeName,A.School_Id,A.Group_Id,A.Dept_Id,A.Post_Id,IFNULL(A.Sex,0) AS Sex,A.TeacherTel AS EmployeePhone,A.BirthDate,A.Education,A.LeaveStatus,A.LeaveTime
,2 AS AccountType,IFNULL(B.Account,'') AS Account,IFNULL(B.Id,0) AS EmployeeId,A.TeacherHead AS EmployeeIcon,A.EntryTime
FROM rb_teacher AS A LEFT JOIN rb_account AS B ON A.TId=B.AccountId AND B.AccountType=2
UNION ALL
SELECT A.AId AS TabKeyId,A.AssistName AS EmployeeName,A.School_Id,A.Group_Id,A.Dept_Id,A.Post_Id,IFNULL(A.Sex,0) AS Sex,A.AssistTel AS EmployeePhone,A.BirthDate,A.Education,A.LeaveStatus,A.LeaveTime
,3 AS AccountType,IFNULL(B.Account,'') AS Account,IFNULL(B.Id,0) AS EmployeeId,A.AssistIcon AS EmployeeIcon,A.EntryTime
FROM rb_assist AS A LEFT JOIN rb_account AS B ON A.AId=B.AccountId AND B.AccountType=3
) 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
");
if (query != null)
{
if (!string.IsNullOrWhiteSpace(query.MName))
if (!string.IsNullOrWhiteSpace(query.EmployeeName))
{
builder.AppendFormat(" AND a.{0} LIKE @MName ", nameof(RB_Manager_ViewModel.MName));
parameters.Add("MName", "%" + query.MName.Trim() + "%");
}
if (!string.IsNullOrWhiteSpace(query.MTel))
{
builder.AppendFormat(" AND a.{0} LIKE @MTel ", nameof(RB_Manager_ViewModel.MTel));
parameters.Add("MTel", "%" + query.MTel.Trim() + "%");
builder.AppendFormat(" AND (a.{0} LIKE @MName OR A.Account LIKE @MName) ", nameof(AdminEmp_ViewModel.EmployeeName));
parameters.Add("MName", "%" + query.EmployeeName.Trim() + "%");
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Manager_ViewModel.School_Id), query.School_Id);
builder.AppendFormat(" AND a.{0}={1} ", nameof(AdminEmp_ViewModel.School_Id), query.School_Id);
}
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Manager_ViewModel.Group_Id), query.Group_Id);
builder.AppendFormat(" AND a.{0}={1} ", nameof(AdminEmp_ViewModel.Group_Id), query.Group_Id);
}
if (query.MId > 0)
if (query.Dept_Id > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Manager_ViewModel.MId), query.MId);
builder.AppendFormat(" AND a.{0}={1} ", nameof(AdminEmp_ViewModel.Dept_Id), query.Dept_Id);
}
if (query.Status >= 0)
if (query.Post_Id > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Manager_ViewModel.Status), (int)query.Status);
builder.AppendFormat(" AND a.{0}={1} ", nameof(AdminEmp_ViewModel.Post_Id), query.Post_Id);
}
if (query.LeaveStatus >= 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(AdminEmp_ViewModel.LeaveStatus), (int)query.LeaveStatus);
}
if (!string.IsNullOrEmpty(query.StartEntryTime))
{
builder.AppendFormat(" AND a.{0}>='{1}' ", nameof(AdminEmp_ViewModel.EntryTime), query.StartEntryTime);
}
if (!string.IsNullOrEmpty(query.EndEntryTime))
{
builder.AppendFormat(" AND a.{0}<='{1} 23:59:59' ", nameof(AdminEmp_ViewModel.EntryTime), query.EndEntryTime);
}
if (!string.IsNullOrEmpty(query.StartLeaveTime))
{
builder.AppendFormat(" AND a.{0}>='{1}' ", nameof(AdminEmp_ViewModel.LeaveTime), query.StartLeaveTime);
}
if (!string.IsNullOrEmpty(query.EndLeaveTime))
{
builder.AppendFormat(" AND a.{0}<='{1} 23:59:59' ", nameof(AdminEmp_ViewModel.LeaveTime), query.EndLeaveTime);
}
if (!string.IsNullOrEmpty(query.StartBirthDate))
{
}
if (!string.IsNullOrEmpty(query.EndBirthDate))
{
}
}
return GetPage<RB_Manager_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
return GetPage<AdminEmp_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
\ No newline at end of file
......@@ -623,23 +623,27 @@ namespace Edu.WebApi.Controllers.User
public ApiResult GetManagerPageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Manager_ViewModel>(RequestParm.Msg.ToString());
var query = Common.Plugin.JsonHelper.DeserializeObject<AdminEmp_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
//query.School_Id = base.UserInfo.School_Id;
var list = managerModule.GetManagerPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
if (item.UpdateBy > 0)
{
item.UpdateByName = UserReidsCache.GetUserLoginInfo(item.UpdateBy)?.AccountName ?? "";
}
}
var list = managerModule.GetAdminEmpPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
pageModel.PageData = list.Select(qitem => new
{
qitem.TabKeyId,
qitem.EmployeeIcon,
qitem.EmployeeName,
qitem.SchoolName,
qitem.DeptName,
qitem.PostName,
Sex = qitem.Sex == 0 ? "男" : "女",
BirthDate = Common.ConvertHelper.FormatDate(qitem.BirthDate),
Education = qitem.Education.ToName(),
LeaveStatus=qitem.LeaveStatus.ToName(),
qitem.EmployeeId,
qitem.Account,
qitem.AccountType,
});
return ApiResult.Success(data: pageModel);
}
......
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