using FoodLabeling.Application.Services.DbModels;
using SqlSugar;
namespace FoodLabeling.Application.Helpers;
///
/// 标签查询列投影:不含 AppliedRegionType(未迁移时由 读写)。
///
public static class LabelQueryHelper
{
/// 只读查询入口:强制列投影。
public static ISugarQueryable QueryProjected(ISqlSugarClient db) =>
ProjectListColumns(db.Queryable());
/// 列表/详情/引用校验等只读场景:SQL 不含 AppliedRegionType。
public static ISugarQueryable ProjectListColumns(
ISugarQueryable query) =>
query.Select(x => new FlLabelDbEntity
{
Id = x.Id,
IsDeleted = x.IsDeleted,
CreationTime = x.CreationTime,
CreatorId = x.CreatorId,
LastModifierId = x.LastModifierId,
LastModificationTime = x.LastModificationTime,
ConcurrencyStamp = x.ConcurrencyStamp,
LabelCode = x.LabelCode,
LabelName = x.LabelName,
TemplateId = x.TemplateId,
LocationId = x.LocationId,
LabelCategoryId = x.LabelCategoryId,
LabelTypeId = x.LabelTypeId,
LabelType = x.LabelType,
State = x.State,
LabelInfoJson = x.LabelInfoJson
});
}