Commit c4d58b1e authored by liudong1993's avatar liudong1993

我的对齐视图

parent 5e75b49c
......@@ -18,5 +18,10 @@ namespace Edu.Model.ViewModel.OKR
/// 来源名称
/// </summary>
public string SourceName { get; set; }
/// <summary>
/// 创建人ids
/// </summary>
public string CreateByIds { get; set; }
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -45,5 +45,16 @@ namespace Edu.Repository.OKR
string sql = $@" select ObjectiveId,COUNT(0) AS ParentId from RB_OKR_ObjectiveRelation WHERE ObjectiveId in({ObjectiveIds}) GROUP BY ObjectiveId";
return Get<RB_OKR_ObjectiveRelation>(sql).ToList();
}
/// <summary>
/// 获取下对齐数量
/// </summary>
/// <param name="ObjectiveIds"></param>
/// <returns></returns>
public List<RB_OKR_ObjectiveRelation> GetChildAlignNum(string ObjectiveIds)
{
string sql = $@" select ParentId,COUNT(0) AS ObjectiveId from RB_OKR_ObjectiveRelation WHERE ParentId in({ObjectiveIds}) GROUP BY ParentId";
return Get<RB_OKR_ObjectiveRelation>(sql).ToList();
}
}
}
......@@ -127,19 +127,69 @@ namespace Edu.Repository.OKR
if (!string.IsNullOrEmpty(demodel.ObjectiveIds))
{
where += $@" and r.{nameof(RB_OKR_ObjectiveRelation.ObjectiveId)} in({demodel.ObjectiveIds})";
string sql = $@" select o.*,r.ObjectiveId,r.ParentId,e.EmName,e.EmPhoto from RB_OKR_Objective o
inner join rb_okr_objectiverelation r on o.Id = r.ParentId
left join rb_employee e on o.CreateBy = e.EmployeeId
where {where} order by o.Id desc";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
if (!string.IsNullOrEmpty(demodel.ParentIds))
{
where += $@" and r.{nameof(RB_OKR_ObjectiveRelation.ParentId)} in({demodel.ParentIds})";
}
string sql = $@" select o.*,r.ObjectiveId,r.ParentId,e.EmName,e.EmPhoto from RB_OKR_Objective o
inner join rb_okr_objectiverelation r on o.Id = r.ParentId
string sql = $@" select o.*,r.ObjectiveId,r.ParentId,e.EmName,e.EmPhoto from RB_OKR_Objective o
inner join rb_okr_objectiverelation r on o.Id = r.ObjectiveId
left join rb_employee e on o.CreateBy = e.EmployeeId
where {where} order by o.Id desc";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
return new List<RB_OKR_Objective_ViewModel>();
}
public List<RB_OKR_Objective_ViewModel> GetListForEmName(RB_OKR_Objective_ViewModel demodel)
{
string where = $@" 1=1 and o.Status <>5";
if (demodel.Group_Id > 0)
{
where += $@" and o.{nameof(RB_OKR_Objective_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.Id > 0)
{
where += $@" and o.{nameof(RB_OKR_Objective_ViewModel.Id)} ={demodel.Id}";
}
if (!string.IsNullOrEmpty(demodel.ObjectiveIds))
{
where += $@" and o.{nameof(RB_OKR_Objective_ViewModel.Id)} in({demodel.ObjectiveIds})";
}
if (demodel.PeriodId > 0)
{
where += $@" and o.{nameof(RB_OKR_Objective_ViewModel.PeriodId)} ={demodel.PeriodId}";
}
if (!string.IsNullOrEmpty(demodel.Title))
{
where += $@" and o.{nameof(RB_OKR_Objective_ViewModel.Title)} like '%{demodel.Title}%'";
}
if (demodel.ProgressState > 0)
{
where += $@" and o.{nameof(RB_OKR_Objective_ViewModel.ProgressState)} ={(int)demodel.ProgressState}";
}
if (demodel.CreateBy > 0)
{
where += $@" and o.{nameof(RB_OKR_Objective_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
if (demodel.Status > 0)
{
where += $@" and o.{nameof(RB_OKR_Objective_ViewModel.Status)} ={demodel.Status}";
}
string sql = $@" select o.*,e.EmName,e.EmPhoto from RB_OKR_Objective o
left join rb_employee e on o.CreateBy = e.EmployeeId
where {where} order by o.Sort asc";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取最大的Sort
/// </summary>
......
......@@ -94,6 +94,10 @@ namespace Edu.Repository.OKR
{
where += $@" and {nameof(RB_OKR_Permission_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
if (!string.IsNullOrEmpty(demodel.CreateByIds))
{
where += $@" and {nameof(RB_OKR_Permission_ViewModel.CreateBy)} in({demodel.CreateByIds})";
}
string sql = $@" select * from RB_OKR_Permission where {where} order by Id desc";
return Get<RB_OKR_Permission_ViewModel>(sql).ToList();
......
......@@ -1186,6 +1186,29 @@ namespace Edu.WebApi.Controllers.OKR
return ApiResult.Success("", obj);
}
/// <summary>
/// 获取我的对齐视图 再下一级
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRMyAlignViewNext() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);
int ObjectiveId = parms.GetInt("ObjectiveId", 0);//目标id
int Type = parms.GetInt("Type", 1);//类型 1向上 2向下
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull("请传递周期id");
}
if (ObjectiveId <= 0) {
return ApiResult.ParamIsNull("请传递关联目标id");
}
var obj = okrPeriodModule.GetOKRMyAlignViewNext(PeriodId, ObjectiveId, Type, userInfo);
return ApiResult.Success("", obj);
}
#endregion
#region 后台管理
......
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