Commit 93b710f2 authored by 吴春's avatar 吴春

提交评论

parent 634e13c9
......@@ -2086,5 +2086,62 @@ namespace Edu.Module.OKR
}
#endregion
#region okr 任务评论
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_Comment_ViewModel> GetCommentPageList(int pageIndex, int pageSize, out long rowsCount, RB_OKR_Comment_ViewModel demodel)
{
return oKR_CommentRepository.GetPageList(pageIndex, pageSize, out rowsCount, demodel);
}
/// <summary>
/// 获取评论列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_Comment_ViewModel> GetCommentList(RB_OKR_Comment_ViewModel demodel)
{
return oKR_CommentRepository.GetList(demodel);
}
/// <summary>
/// 新增/修改ork评论
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetOKRComment(RB_OKR_Comment_ViewModel model)
{
if (model.Id == 0)
{
return oKR_CommentRepository.Insert(model) > 0;
}
else
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_Comment_ViewModel.State),model.State},
{ nameof(RB_OKR_Comment_ViewModel.UpdateBy),model.UpdateBy},
{ nameof(RB_OKR_Comment_ViewModel.UpdateTime),DateTime.Now},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_OKR_Comment_ViewModel.Id),
FiledValue=model.Id,
OperatorEnum=OperatorEnum.Equal
}
};
return oKR_CommentRepository.Update(keyValues, wheres);
}
}
#endregion
}
}
......@@ -741,7 +741,91 @@ namespace Edu.WebApi.Controllers.OKR
#endregion
#endregion
#region okr评论管理
/// <summary>
/// 获取评论分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCommentPageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_OKR_Comment_ViewModel()
{
School_Id = base.ParmJObj.GetInt("School_Id"),
State = base.ParmJObj.GetInt("State", 0),
PeriodId = base.ParmJObj.GetInt("PeriodId", 0)
};
query.Group_Id = base.UserInfo.Group_Id;
var list = okrPeriodModule.GetCommentPageList(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
item.CreateByIco = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.UserIcon ?? "";
}
if (item.UpdateBy > 0)
{
item.UpdateByName = UserReidsCache.GetUserLoginInfo(item.UpdateBy)?.AccountName ?? "";
}
item.CreateTimeStr = StringHelper.DateFormatToString(item.CreateTime);
}
pageModel.Count = rowsCount;
pageModel.PageData = list.Select(x => new { x.CreateByName, x.CreateByIco, x.UpdateByName, x.Content, x.CreateTimeStr });
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 新增评论状态
/// </summary>
/// <returns></returns>
public ApiResult SetComment()
{
var extModel = new RB_OKR_Comment_ViewModel()
{
School_Id = base.ParmJObj.GetInt("School_Id"),
PeriodId = base.ParmJObj.GetInt("PeriodId"),
Content = base.ParmJObj.GetStringValue("Content"),
};
extModel.CreateBy = base.UserInfo.Id;
extModel.State = 1;
extModel.CreateTime = System.DateTime.Now;
extModel.UpdateTime = System.DateTime.Now;
extModel.UpdateBy = base.UserInfo.Id;
extModel.Group_Id = base.UserInfo.Group_Id;
bool flag = okrPeriodModule.SetOKRComment(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 修改评论状态
/// </summary>
/// <returns></returns>
public ApiResult SetCommentStatus()
{
var extModel = new RB_OKR_Comment_ViewModel()
{
Id = base.ParmJObj.GetInt("Id"),
State = base.ParmJObj.GetInt("State"),
};
if (extModel.Id <= 0)
{
return ApiResult.ParamIsNull(message: "未获取到评论编号,请刷新页面重试!");
}
if (extModel.State <= 0)
{
return ApiResult.ParamIsNull(message: "请传递评论状态!");
}
extModel.UpdateBy = base.UserInfo.Id;
bool flag = okrPeriodModule.SetOKRComment(extModel);
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