70 lines
2.5 KiB
C#
70 lines
2.5 KiB
C#
using Hncore.Infrastructure.Service;
|
|
using Hncore.Pass.BaseInfo.Models;
|
|
using Hncore.Pass.BaseInfo.Request.User;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq.Expressions;
|
|
using System.Threading.Tasks;
|
|
using Hncore.Infrastructure.Extension;
|
|
using Hncore.Infrastructure.EntitiesExtension;
|
|
using Hncore.Infrastructure.Data;
|
|
using System.Linq;
|
|
|
|
namespace Hncore.Pass.BaseInfo.Service
|
|
{
|
|
public class UserScoreService : ServiceBase<UserScore>, IFindService
|
|
{
|
|
private UserDbContext m_DbContext;
|
|
public UserScoreService(UserDbContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
|
{
|
|
m_DbContext = dbContext;
|
|
}
|
|
|
|
public bool ExistTaoBaoScore(string orderNo)
|
|
{
|
|
return this.Exist(m => m.ScoreType == ScoreType.TaoBaoAdd && m.Remark == orderNo);
|
|
}
|
|
|
|
public async Task<List<UserScore>> Details(int userId)
|
|
{
|
|
return await this.Query(m => m.UserId == userId).OrderByDescending(m => m.Id).ToListAsync();
|
|
}
|
|
|
|
public async Task<PageData<UserScore>> Details(QueryAmountRequest request)
|
|
{
|
|
|
|
Expression<Func<UserScore, bool>> exp = m => true;
|
|
|
|
if (request.KeyWord.Has())
|
|
{
|
|
exp = exp.And(m => m.UserName.Contains(request.KeyWord) || m.OperateUserName.Contains(request.KeyWord) || m.ScoreTypeName.Contains(request.KeyWord) || m.Remark.Contains(request.KeyWord));
|
|
}
|
|
if (request.Type.HasValue&&request.Type>0)
|
|
{
|
|
exp = exp.And(m => m.ScoreType == (ScoreType)request.Type);
|
|
}
|
|
|
|
return await this.Query(exp).OrderByDescending(m=>m.Id).ListPagerAsync(request.PageSize, request.PageIndex,true);
|
|
}
|
|
|
|
|
|
public async Task<List<UserScore>> DetailsAll(QueryAmountRequest request)
|
|
{
|
|
|
|
Expression<Func<UserScore, bool>> exp = m => true;
|
|
|
|
if (request.KeyWord.Has())
|
|
{
|
|
exp = exp.And(m => m.UserName.Contains(request.KeyWord) || m.OperateUserName.Contains(request.KeyWord));
|
|
}
|
|
if (request.Type.HasValue && request.Type > 0)
|
|
{
|
|
exp = exp.And(m => m.ScoreType == (ScoreType)request.Type);
|
|
}
|
|
|
|
return await this.Query(exp).OrderByDescending(m => m.Id).ToListAsync();
|
|
}
|
|
}
|
|
} |