AdoS6MoldToolList.cs 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using Admin.NET.Core;
  2. namespace Admin.NET.Plugin.AiDOP.Entity;
  3. /// <summary>
  4. /// S6 模工具台账(复刻 legacy 表 MoldToolList,FUNC-S6-004)。
  5. ///
  6. /// 只映射 CRUD V1 白名单字段 + 主键 + 租户列。其余 legacy 列(gys / gysmc / MoldUsingDepartment /
  7. /// zrr / zt / sm / bypl / fj / xh / bh / gnyyid / MoldMaintenanceReleaseTime /
  8. /// ActiveMaintenanceMoldCount)语义未确认,本批一律不映射、不写入。
  9. /// 写路径全部使用「显式 SetColumns + 显式 WHERE」或 Insertable,不做 delete+reinsert,
  10. /// 故未映射列在更新时天然保留(SAFE-BY-PARTIAL-UPDATE)。
  11. ///
  12. /// [IgnoreTable]:MoldToolList 是外部导入的 legacy 表,表结构由 UpdateScripts 管理。
  13. /// 该特性使实体被 SqlSugarSetup.GetEntityTypesForInit 排除,禁止 CodeFirst 对其
  14. /// ALTER 列 / 改可空性 / 建索引。同理本实体**不得**登记进 Startup.cs 的显式
  15. /// db.CodeFirst.InitTables(...) 列表——那条路径不受 [IgnoreTable] 保护。
  16. ///
  17. /// 租户:tenant_id 为唯一租户边界;实现 ITenantIdFilter 以获得全局查询过滤(defense-in-depth),
  18. /// 但业务代码仍必须在每条读写语句显式带 tenant 条件(全局过滤器对超管不生效)。
  19. /// 唯一键 uk_MoldToolList_tenant_type_code(tenant_id, MoldTypeCode) 由 UpdateScripts 维护。
  20. /// </summary>
  21. [IgnoreTable]
  22. [SugarTable("MoldToolList", "模工具台账(复刻 MoldToolList)")]
  23. public class AdoS6MoldToolList : ITenantIdFilter
  24. {
  25. /// <summary>主键(legacy 自增 int)</summary>
  26. [SugarColumn(ColumnName = "id", ColumnDescription = "主键", IsPrimaryKey = true, IsIdentity = true)]
  27. public int Id { get; set; }
  28. /// <summary>类型(模具 / 工装 / 检具)</summary>
  29. [SugarColumn(ColumnName = "lx", ColumnDescription = "类型", Length = 255, IsNullable = true)]
  30. public string? Lx { get; set; }
  31. /// <summary>名称(DB NOT NULL)</summary>
  32. [SugarColumn(ColumnName = "MoldName", ColumnDescription = "名称", Length = 255)]
  33. public string MoldName { get; set; } = string.Empty;
  34. /// <summary>数量(DB NOT NULL)</summary>
  35. [SugarColumn(ColumnName = "MoldCount", ColumnDescription = "数量")]
  36. public int MoldCount { get; set; }
  37. /// <summary>模具类型编码(DB NOT NULL;租户内唯一业务编码,创建后不可修改)</summary>
  38. [SugarColumn(ColumnName = "MoldTypeCode", ColumnDescription = "模具类型编码", Length = 255)]
  39. public string MoldTypeCode { get; set; } = string.Empty;
  40. /// <summary>工作组 / 功能应用名称(自由文本,源系统同列两名,忠实复刻)</summary>
  41. [SugarColumn(ColumnName = "gnyymc", ColumnDescription = "工作组/功能应用名称", Length = 255, IsNullable = true)]
  42. public string? Gnyymc { get; set; }
  43. /// <summary>对应产品物料编码(自由文本,存量含 "/" 占位值)</summary>
  44. [SugarColumn(ColumnName = "product_material_code", ColumnDescription = "对应产品物料编码", Length = 255, IsNullable = true)]
  45. public string? ProductMaterialCode { get; set; }
  46. /// <summary>对应产品图纸号</summary>
  47. [SugarColumn(ColumnName = "product_drawing_number", ColumnDescription = "对应产品图纸号", Length = 255, IsNullable = true)]
  48. public string? ProductDrawingNumber { get; set; }
  49. /// <summary>对应产品名称</summary>
  50. [SugarColumn(ColumnName = "product_name", ColumnDescription = "对应产品名称", Length = 255, IsNullable = true)]
  51. public string? ProductName { get; set; }
  52. /// <summary>对应工序</summary>
  53. [SugarColumn(ColumnName = "process", ColumnDescription = "对应工序", Length = 255, IsNullable = true)]
  54. public string? Process { get; set; }
  55. /// <summary>租户(唯一租户边界;仅服务端从 JWT 盖章,不接受客户端传入)</summary>
  56. [SugarColumn(ColumnName = "tenant_id", ColumnDescription = "租户", IsNullable = true)]
  57. public long? TenantId { get; set; }
  58. }