Commit 841c9b8d authored by 黄奎's avatar 黄奎

页面修改

parent 3a77287a
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.User
{
/// <summary>
/// 部门岗位关联表实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Department_Post
{
/// <summary>
/// 部门岗位关联表主键Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 部门编号
/// </summary>
public int Dept_Id { get; set; }
/// <summary>
/// 岗位编号
/// </summary>
public int PostId { get; set; }
}
}
......@@ -21,11 +21,6 @@ namespace Edu.Model.Entity.User
/// </summary>
public string PostName { get; set; }
/// <summary>
/// 部门编号
/// </summary>
public int RB_Dept_Id { get; set; }
/// <summary>
/// 集团编号
/// </summary>
......
using Edu.Model.Entity.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User
{
/// <summary>
/// 部门岗位关联表视图实体类
/// </summary>
public class RB_Department_Post_ViewModel: RB_Department_Post
{
/// <summary>
/// 岗位名称
/// </summary>
public string PostName { get; set; }
/// <summary>
/// 部门编号【查询使用,逗号分隔】
/// </summary>
public string QDeptIds { get; set; }
}
}
......@@ -65,5 +65,15 @@ namespace Edu.Model.ViewModel.User
return Common.ConvertHelper.StringToList(this.ManagerIds);
}
}
/// <summary>
/// 部门管理岗位列表
/// </summary>
public List<RB_Department_Post_ViewModel> DeptPostList { get; set; }
/// <summary>
/// 选择的岗位
/// </summary>
public List<int> ChoosePostList { get; set; }
}
}
\ No newline at end of file
......@@ -43,11 +43,6 @@ namespace Edu.Model.ViewModel.User
}
}
/// <summary>
/// 所属部门
/// </summary>
public string DeptName { get; set; }
/// <summary>
/// 岗位编号查询
/// </summary>
......
......@@ -507,14 +507,10 @@ namespace Edu.Module.Course
{
extModel.DefaultTimeList = Common.Plugin.JsonHelper.DeserializeObject<List<RB_Class_Time_ViewModel>>(extModel.DefaultTimeJson);
}
if (!string.IsNullOrEmpty(extModel.DateJson))
if (!string.IsNullOrEmpty(extModel.DateJson) && extModel.ClassStyle!= Common.Enum.Course.ClassStyleEnum.OnLine)
{
extModel.WeekDayList= Common.Plugin.JsonHelper.DeserializeObject<List<string>>(extModel.DateJson);
}
if (extModel.ClassStyle == Common.Enum.Course.ClassStyleEnum.Month)
{
}
}
return extModel;
}
......
......@@ -21,12 +21,16 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 岗位仓储层对象
/// </summary>
private readonly RB_PostRepository postRepository = new RB_PostRepository();
/// <summary>
/// 部门岗位关联表仓储层对象
/// </summary>
private readonly RB_Department_PostRepository department_PostRepository = new RB_Department_PostRepository();
/// <summary>
/// 获取部门分页列表
/// </summary>
......@@ -40,6 +44,7 @@ namespace Edu.Module.User
var list = departmentRepository.GetDepartmentPageListRepository(pageIndex, pageSize, out rowsCount, query);
List<RB_Department_ViewModel> parentList = new List<RB_Department_ViewModel>();
List<Employee_ViewModel> empList = new List<Employee_ViewModel>();
List<RB_Department_Post_ViewModel> deptPostList = new List<RB_Department_Post_ViewModel>();
if (list != null && list.Count > 0)
{
//查询部门列表
......@@ -54,6 +59,12 @@ namespace Edu.Module.User
{
empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = persion });
}
string qDeptIds = string.Join(",", list.Select(qitem => qitem.DeptId));
if (!string.IsNullOrEmpty(qDeptIds))
{
deptPostList = department_PostRepository.GetDepartmentPostListRepository(new RB_Department_Post_ViewModel() { QDeptIds = qDeptIds });
}
}
foreach (var item in list)
{
......@@ -73,6 +84,7 @@ namespace Edu.Module.User
persionName = persionName.Substring(1);
}
item.ManagerName = persionName;
item.DeptPostList = deptPostList?.Where(qitem => qitem.Dept_Id == item.DeptId)?.ToList() ?? new List<RB_Department_Post_ViewModel>();
}
return list;
}
......@@ -217,22 +229,22 @@ namespace Edu.Module.User
#region 添加岗位
if (isQueryPost)
{
var tempPostList = postList?.Where(qitem => qitem.RB_Dept_Id == fItem.DeptId)?.ToList();
if (tempPostList != null && tempPostList.Count > 0)
{
foreach (var pItem in tempPostList)
{
tModel.ChildList.Add(new DepartmentTree_ViewModel()
{
DeptId = pItem.PostId,
DeptName = pItem.PostName,
ParentId = 0,
ChildList = new List<DepartmentTree_ViewModel>(),
School_Id = fItem.School_Id,
DataType = 3,
});
}
}
//var tempPostList = postList?.Where(qitem => qitem.RB_Dept_Id == fItem.DeptId)?.ToList();
//if (tempPostList != null && tempPostList.Count > 0)
//{
// foreach (var pItem in tempPostList)
// {
// tModel.ChildList.Add(new DepartmentTree_ViewModel()
// {
// DeptId = pItem.PostId,
// DeptName = pItem.PostName,
// ParentId = 0,
// ChildList = new List<DepartmentTree_ViewModel>(),
// School_Id = fItem.School_Id,
// DataType = 3,
// });
// }
//}
}
#endregion
......@@ -296,22 +308,22 @@ namespace Edu.Module.User
#region 添加岗位
if (postList != null && postList.Count > 0)
{
var tempPostList = postList?.Where(qitem => qitem.RB_Dept_Id == item.DeptId)?.ToList();
if (tempPostList != null && tempPostList.Count > 0)
{
foreach (var pItem in tempPostList)
{
model.ChildList.Add(new DepartmentTree_ViewModel()
{
DeptId = pItem.PostId,
DeptName = pItem.PostName,
ParentId = 0,
ChildList = new List<DepartmentTree_ViewModel>(),
School_Id = item.School_Id,
DataType = 3,
});
}
}
//var tempPostList = postList?.Where(qitem => qitem.RB_Dept_Id == item.DeptId)?.ToList();
//if (tempPostList != null && tempPostList.Count > 0)
//{
// foreach (var pItem in tempPostList)
// {
// model.ChildList.Add(new DepartmentTree_ViewModel()
// {
// DeptId = pItem.PostId,
// DeptName = pItem.PostName,
// ParentId = 0,
// ChildList = new List<DepartmentTree_ViewModel>(),
// School_Id = item.School_Id,
// DataType = 3,
// });
// }
//}
}
#endregion
......@@ -399,7 +411,7 @@ namespace Edu.Module.User
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetDepartmentModule(RB_Department_ViewModel extModel)
public virtual bool SetDepartmentModule(RB_Department_ViewModel extModel)
{
bool flag;
if (extModel.DeptId > 0)
......@@ -425,6 +437,20 @@ namespace Edu.Module.User
extModel.DeptId = newId;
flag = newId > 0;
}
department_PostRepository.DeleteOne(new WhereHelper(nameof(RB_Department_Post_ViewModel.Dept_Id), extModel.DeptId));
if (extModel.ChoosePostList != null && extModel.ChoosePostList.Count > 0)
{
foreach (var item in extModel.ChoosePostList)
{
var deptPostModel = new RB_Department_Post_ViewModel()
{
Id = 0,
Dept_Id = extModel.DeptId,
PostId = item
};
department_PostRepository.Insert(deptPostModel);
}
}
return flag;
}
......@@ -435,7 +461,22 @@ namespace Edu.Module.User
/// <returns></returns>
public RB_Department_ViewModel GetDepartmentModule(object DeptId)
{
return departmentRepository.GetEntity<RB_Department_ViewModel>(DeptId);
var extModel = departmentRepository.GetEntity<RB_Department_ViewModel>(DeptId);
if (extModel != null && extModel.DeptId > 0)
{
var deptPostList = department_PostRepository.GetDepartmentPostListRepository(new RB_Department_Post_ViewModel()
{
Dept_Id = extModel.DeptId
});
extModel.ChoosePostList = new List<int>();
if (deptPostList != null && deptPostList.Count > 0)
{
}
extModel.DeptPostList = deptPostList;
}
return extModel;
}
/// <summary>
......
......@@ -61,7 +61,6 @@ namespace Edu.Module.User
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Post_ViewModel.PostName),extModel.PostName },
{nameof(RB_Post_ViewModel.RB_Dept_Id),extModel.RB_Dept_Id },
{nameof(RB_Post_ViewModel.UpdateBy),extModel.UpdateBy },
{nameof(RB_Post_ViewModel.UpdateTime),extModel.UpdateTime },
};
......
using Edu.Model.Entity.User;
using Edu.Model.ViewModel.User;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.User
{
/// <summary>
/// 部门岗位关联表仓储层
/// </summary>
public class RB_Department_PostRepository : BaseRepository<RB_Department_Post>
{
/// <summary>
/// 获取部门管理岗位列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Department_Post_ViewModel> GetDepartmentPostListRepository(RB_Department_Post_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.PostName,'') AS PostName
FROM rb_department_post AS A LEFT JOIN rb_post AS B ON A.PostId=B.PostId
WHERE 1=1
");
if (query == null)
{
return new List<RB_Department_Post_ViewModel>();
}
else
{
if (query.Dept_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Department_Post_ViewModel.Dept_Id), query.Dept_Id);
}
if (!string.IsNullOrEmpty(query.QDeptIds))
{
builder.AppendFormat(" AND {0} IN ({1}) ", nameof(RB_Department_Post_ViewModel.Dept_Id), query.QDeptIds);
}
}
return Get<RB_Department_Post_ViewModel>(builder.ToString()).ToList();
}
}
}
......@@ -27,8 +27,8 @@ namespace Edu.Repository.User
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.DeptName,'') AS DeptName
FROM rb_post AS A LEFT JOIN rb_department AS B ON A.RB_Dept_Id=B.DeptId
SELECT A.*
FROM rb_post AS A
WHERE 1=1
");
if (query != null)
......@@ -83,10 +83,6 @@ WHERE 1=1
{
builder.Append($" AND A.{nameof(RB_Post_ViewModel.PostId)}={query.PostId} ");
}
if (query.RB_Dept_Id > 0)
{
builder.Append($" AND A.{nameof(RB_Post_ViewModel.RB_Dept_Id)}={query.RB_Dept_Id} ");
}
if (!string.IsNullOrEmpty(query.QPostIds))
{
builder.Append($" AND A.{nameof(RB_Post_ViewModel.PostId)} IN({query.QPostIds}) ");
......
......@@ -1217,7 +1217,6 @@ namespace Edu.WebApi.Controllers.User
var query = new RB_Post_ViewModel()
{
Group_Id = base.UserInfo.Group_Id,
RB_Dept_Id = base.ParmJObj.GetInt("RB_Dept_Id"),
};
var list = postModule.GetPostListModule(query);
return ApiResult.Success(data: list);
......
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