using FoodLabeling.Application.Services.DbModels;
using SqlSugar;
namespace FoodLabeling.Application.Helpers;
///
/// 标签模板查询列投影:仅映射库内真实列,避免 ORM 元数据缓存或旧实体仍 SELECT 不存在的 scope 列。
///
public static class LabelTemplateQueryHelper
{
///
/// 列表/详情/引用校验等只读场景:强制 SQL 不含 AppliedPartnerType / AppliedRegionType。
///
public static ISugarQueryable ProjectListColumns(
ISugarQueryable query) =>
query.Select(x => new FlLabelTemplateDbEntity
{
Id = x.Id,
IsDeleted = x.IsDeleted,
CreationTime = x.CreationTime,
CreatorId = x.CreatorId,
LastModifierId = x.LastModifierId,
LastModificationTime = x.LastModificationTime,
ConcurrencyStamp = x.ConcurrencyStamp,
TemplateCode = x.TemplateCode,
TemplateName = x.TemplateName,
LabelType = x.LabelType,
Unit = x.Unit,
Width = x.Width,
Height = x.Height,
AppliedLocationType = x.AppliedLocationType,
ShowRuler = x.ShowRuler,
ShowGrid = x.ShowGrid,
VersionNo = x.VersionNo,
State = x.State
});
}