Merge remote-tracking branch 'master/master'

This commit is contained in:
Putoo
2026-07-04 18:07:47 +08:00
7 changed files with 247 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Application.Domain
{
public interface IUnitUserPractiseService
{
Task<bool> DelPractise(string practiseId);
Task<bool> AddPractise(unit_user_practise practise);
Task<unit_user_practise> GetUserPractiseInfo(string practiseId);
Task<List<unit_user_practise>> GetUserPractiseList(string userId, int page, int limit, RefAsync<int> total);
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Application.Domain
{
public class UnitUserPractiseService(ISqlSugarClient DbClient, IRedisCache redis) : IUnitUserPractiseService, ITransient
{
public async Task<bool> DelPractise(string practiseId)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_practise>();
return await db.Deleteable<unit_user_practise>().Where(i => i.practiseId == practiseId).ExecuteCommandAsync() > 0;
}
public async Task<bool> AddPractise(unit_user_practise practise)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_practise>();
return await db.Insertable(practise).ExecuteCommandAsync() > 0;
}
public async Task<unit_user_practise> GetUserPractiseInfo(string practiseId)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_practise>();
return await db.Queryable<unit_user_practise>().Where(i => i.practiseId == practiseId).SingleAsync();
}
public async Task<List<unit_user_practise>> GetUserPractiseList(string userId, int page, int limit, RefAsync<int> total)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_practise>();
return await db.Queryable<unit_user_practise>().Where(i => i.userId == userId).ToPageListAsync(page, limit, total);
}
}
}