48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
using Furion.DependencyInjection;
|
|
using RoadFlow.Utility;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace RoadFlow.Data
|
|
{
|
|
public class FlowComment:RoadFlowRepository<RoadFlow.Model.rf_flowcomment>,IFlowComment, ITransient
|
|
{
|
|
/// <summary>
|
|
/// 得到一个用户可以使用的意见
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
/// <returns></returns>
|
|
public List<Model.rf_flowcomment> GetListByUserId(string userId)
|
|
{
|
|
var all = GetAll();
|
|
return all.FindAll(p => p.UserId == string.Empty || p.UserId == userId).Distinct(new Model.rf_flowcomment()).OrderBy(p => p.AddType).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询一页数据
|
|
/// </summary>
|
|
/// <param name="count"></param>
|
|
/// <param name="size"></param>
|
|
/// <param name="number"></param>
|
|
/// <param name="comment"></param>
|
|
/// <param name="userId"></param>
|
|
/// <param name="order"></param>
|
|
/// <returns></returns>
|
|
public List<Model.rf_flowcomment> GetPagerList(out int count, int size, int number, string comment, string userId, string order)
|
|
{
|
|
int total = 0;
|
|
var rtn =db.Queryable<Model.rf_flowcomment>()
|
|
.WhereIF(!comment.IsNullOrWhiteSpace(), x => x.Comments.Contains(comment))
|
|
.WhereIF(userId.IsGuid(), x => x.UserId == userId)
|
|
.OrderByIF(!order.IsNullOrWhiteSpace(), order)
|
|
.ToPageList(number, size, ref total);
|
|
count = total;
|
|
return rtn;
|
|
}
|
|
|
|
}
|
|
}
|