Commit 5b726456 authored by 吴春's avatar 吴春

提交okr评论

parent 9c6f6bc2
...@@ -50,6 +50,62 @@ namespace Edu.Common.Plugin ...@@ -50,6 +50,62 @@ namespace Edu.Common.Plugin
#endregion #endregion
#region "日期相关" #region "日期相关"
public static string DateFormatToString(DateTime dt)
{
//TimeSpan表示时间间隔
TimeSpan span = (DateTime.Now - dt).Duration();//表示取timespan绝对值
//if (span.TotalDays > 60)
//{
// return dt.ToString("yyyy-MM-dd");
//}
//else if (span.TotalDays > 30)
//{
// return "1个月前";
//}
//else if (span.TotalDays > 14)
//{
// return "2周前";
//}
if (dt.Year == DateTime.Now.Year)
{
if (span.TotalDays > 7)
{
return dt.ToString("yyyy-MM-dd");
}
else if (span.TotalDays > 1)
{
return string.Format("{0}天前", (int)Math.Floor(span.TotalDays));
}
else if (span.TotalHours > 1)
{
return string.Format("{0}小时前", (int)Math.Floor(span.TotalHours));
}
else if (span.TotalMinutes > 1)
{
return string.Format("{0}分钟前", (int)Math.Floor(span.TotalMinutes));
}
else if (span.TotalSeconds >= 1)
{
return string.Format("{0}秒前", (int)Math.Floor(span.TotalSeconds));
}
else
{
return "1秒前";
}
}
else
{
return dt.ToString("yyyy-MM-dd");
}
}
/// <summary> /// <summary>
/// 获取星期的字符串 /// 获取星期的字符串
/// </summary> /// </summary>
...@@ -472,7 +528,8 @@ namespace Edu.Common.Plugin ...@@ -472,7 +528,8 @@ namespace Edu.Common.Plugin
{ {
TotalDay = Saturday + Sunday + 2; TotalDay = Saturday + Sunday + 2;
} }
else { else
{
TotalDay = Saturday + Sunday + 1; TotalDay = Saturday + Sunday + 1;
} }
} }
......
...@@ -9,6 +9,24 @@ namespace Edu.Model.ViewModel.OKR ...@@ -9,6 +9,24 @@ namespace Edu.Model.ViewModel.OKR
[Serializable] [Serializable]
public class RB_OKR_Comment_ViewModel : Model.Entity.OKR.RB_OKR_Comment public class RB_OKR_Comment_ViewModel : Model.Entity.OKR.RB_OKR_Comment
{ {
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 创建人头像
/// </summary>
public string CreateByIco { get; set; }
/// <summary>
/// 操作人
/// </summary>
public string UpdateByName { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public string CreateTimeStr { get; set; }
} }
} }
\ No newline at end of file
This diff is collapsed.
...@@ -37,7 +37,10 @@ namespace Edu.Repository.OKR ...@@ -37,7 +37,10 @@ namespace Edu.Repository.OKR
{ {
where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}"; where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}";
} }
if (demodel.CreateBy > 0)
{
where += $@" and {nameof(RB_OKR_Comment_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc"; string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc";
return GetPage<RB_OKR_Comment_ViewModel>(pageIndex, pageSize, out rowsCount, sql).ToList(); return GetPage<RB_OKR_Comment_ViewModel>(pageIndex, pageSize, out rowsCount, sql).ToList();
} }
...@@ -62,7 +65,10 @@ namespace Edu.Repository.OKR ...@@ -62,7 +65,10 @@ namespace Edu.Repository.OKR
{ {
where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}"; where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}";
} }
if (demodel.CreateBy > 0)
{
where += $@" and {nameof(RB_OKR_Comment_ViewModel.CreateBy)} ={demodel.CreateBy}";
}
string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc"; string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc";
return Get<RB_OKR_Comment_ViewModel>(sql).ToList(); return Get<RB_OKR_Comment_ViewModel>(sql).ToList();
} }
......
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