Blame view

美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Helpers/LabelTemplateQueryHelper.cs 1.37 KB
14afbc16   李曜臣   2026-6-22
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  using FoodLabeling.Application.Services.DbModels;
  using SqlSugar;
  
  namespace FoodLabeling.Application.Helpers;
  
  /// <summary>
  /// 标签模板查询列投影:仅映射库内真实列,避免 ORM 元数据缓存或旧实体仍 SELECT 不存在的 scope 列。
  /// </summary>
  public static class LabelTemplateQueryHelper
  {
      /// <summary>
      /// 列表/详情/引用校验等只读场景:强制 SQL 不含 <c>AppliedPartnerType</c> / <c>AppliedRegionType</c>
      /// </summary>
      public static ISugarQueryable<FlLabelTemplateDbEntity> ProjectListColumns(
          ISugarQueryable<FlLabelTemplateDbEntity> 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
          });
  }