Files
QYZH.InteractiveMagazine/QYZH.InteractiveMagazine.IService/IBaseService.cs
glz 8ed012bba8 refactor: 重构项目基础架构与实体体系
- 替换原有自定义生命周期接口为通用基础服务体系
- 将所有实体基类替换为带雪花ID的SqlSugarBaseEntity
- 迁移DTO到Models项目并统一管理
- 移除冗余的Repository层实现,改用通用基础服务
- 添加Yitter.IdGenerator雪花ID生成支持
- 重构SqlSugar数据库上下文与依赖注入配置
- 新增微信用户、用户勋章、背包等实体与配套服务
- 整理分页查询与结果封装类
- 优化WebApi控制器结构
2026-06-02 14:10:43 +08:00

40 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Linq.Expressions;
namespace QYZH.InteractiveMagazine.IService;
/// <summary>
/// 基础服务定义
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IBaseService<T> where T : class, new()
{
Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
/// <summary>
/// 根据条件表达式查询单条数据
/// </summary>
/// <param name="expression">表达式</param>
/// <returns>泛型实体</returns>
Task<R> GetByIdAsync<R>(Expression<Func<T, bool>> expression) where R : class;
Task<R> GetByExpressionAsync<R>(Expression<Func<T, bool>> expression) where R : class;
Task<List<T2>> GetListByExpression<T2>(Expression<Func<T, bool>> expression) where T2 : class;
Task<bool> UpdateAsync(T updateObj);
///// <summary>
///// 根据指定条件更新指定列 egUpdate(new SysUser(){ Status = 1 }, it => new { it.Status }, f => f.Userid == 1));
///// 只更新Status列条件是包含
///// </summary>
///// <param name="entity">实体类</param>
///// <param name="expression">要更新列的表达式</param>
///// <param name="where">where表达式</param>
///// <returns></returns>
//Task<bool> UpdateAsync(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where);
Task<bool> UpdateAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
Task<bool> UpdateAsync(Expression<Func<T, bool>> columns, Expression<Func<T, bool>> where);
}