ColdFusion 9 ORM CFGird 连接多个表

发布于 2024-11-06 09:05:45 字数 1980 浏览 7 评论 0原文

使用 ColdFusion ORM 时,如果您有多个具有关系的表,我可以将 CFC 绑定到 CFGrid 以获取我想要显示的所有列吗?

例如,如果我在当前应用程序上有一个包含 7 个联接的查询,我正在努力获取我想要显示的所有字段。如何显示 CFGrid 中的所有字段 我可以使用绑定将 ORM CFC 连接到网格吗?或者我需要做其他事情吗?

SELECT 'PRIMARY' AS TMSType,
  'Request'      AS shopTypeTitle,
  rfc_shopsheet.shopsheetid,
  locked,
  isDraft,
  shoptype,
  rfc_shopsheet.createdon,
  FacilitatorCompleted,
  Details.myshopfolderid   AS RecordId,
  Details.subject          AS ShopSubject,
  Details.solostandmodelid AS DisplayModelid,
  ShopVACM.solostandmodel  AS DisplayModel,
  Details.myshoplevelid,
  Details.divisionid,
  val_myshoplevel.name,
  divisionname,
  GROUP_CONCAT_solostandSERIES(rfc_shopsheet.shopsheetid) AS Series,
  MAX(RequestDTGs.sortdate)                               AS RSortDate,
  MAX(RequestDTGs.sortsequence)                           AS RSeq,
  rfc_shopsheet.CreatedOn                                 AS holdshopCreateDate,
  Details.AIRSNbr
FROM rfc_shopsheet
JOIN rfc_myshopfolder Details
ON rfc_shopsheet.myshopFolderId = Details.myshopFolderId
LEFT OUTER JOIN rfc_shopsigner
ON rfc_shopsheet.shopsheetid = rfc_shopsigner.shopsheetid
LEFT OUTER JOIN rfc_requestdtg RequestDTGs
ON RequestDTGs.myshopfolderid = Details.myshopfolderid
LEFT OUTER JOIN rfc_engshop
ON rfc_shopsheet.shopsheetid = rfc_engshop.shopsheetid
LEFT OUTER JOIN rfc_requestaircraft RequestAC
ON Details.myshopfolderid = RequestAC.myshopfolderid
LEFT OUTER JOIN rfc_requestfacilitator RequestFac
ON Details.myshopfolderid = RequestFac.myshopfolderid
LEFT OUTER JOIN val_solostandseries shopVAC
ON RequestAC.solostandseriesid = shopVAC.solostandseriesid
LEFT OUTER JOIN val_solostandmodel shopVACM
ON Details.solostandmodelid = shopVACM.solostandmodelid
LEFT OUTER JOIN val_myshoplevel
ON Details.myshoplevelid = val_myshoplevel.myshoplevelid
LEFT OUTER JOIN val_division
ON Details.divisionid = val_division.divisionid
WHERE shopType        = 'F'

我想找到一种方法让 ORM 加入所有这些列,这样我就可以将它们放入 ORM 中。

When using ColdFusion ORM where you have several tables with relationships can I bind a CFC to a CFGrid to get all of the columns I would like to have displayed?

Example if I have a query with 7 joins on the current application I am working on to get all of the fields I want displayed. How can I display all of the fields in CFGrid can I use bind to connect the ORM CFC to the Grid? or Do I need to do something else?

SELECT 'PRIMARY' AS TMSType,
  'Request'      AS shopTypeTitle,
  rfc_shopsheet.shopsheetid,
  locked,
  isDraft,
  shoptype,
  rfc_shopsheet.createdon,
  FacilitatorCompleted,
  Details.myshopfolderid   AS RecordId,
  Details.subject          AS ShopSubject,
  Details.solostandmodelid AS DisplayModelid,
  ShopVACM.solostandmodel  AS DisplayModel,
  Details.myshoplevelid,
  Details.divisionid,
  val_myshoplevel.name,
  divisionname,
  GROUP_CONCAT_solostandSERIES(rfc_shopsheet.shopsheetid) AS Series,
  MAX(RequestDTGs.sortdate)                               AS RSortDate,
  MAX(RequestDTGs.sortsequence)                           AS RSeq,
  rfc_shopsheet.CreatedOn                                 AS holdshopCreateDate,
  Details.AIRSNbr
FROM rfc_shopsheet
JOIN rfc_myshopfolder Details
ON rfc_shopsheet.myshopFolderId = Details.myshopFolderId
LEFT OUTER JOIN rfc_shopsigner
ON rfc_shopsheet.shopsheetid = rfc_shopsigner.shopsheetid
LEFT OUTER JOIN rfc_requestdtg RequestDTGs
ON RequestDTGs.myshopfolderid = Details.myshopfolderid
LEFT OUTER JOIN rfc_engshop
ON rfc_shopsheet.shopsheetid = rfc_engshop.shopsheetid
LEFT OUTER JOIN rfc_requestaircraft RequestAC
ON Details.myshopfolderid = RequestAC.myshopfolderid
LEFT OUTER JOIN rfc_requestfacilitator RequestFac
ON Details.myshopfolderid = RequestFac.myshopfolderid
LEFT OUTER JOIN val_solostandseries shopVAC
ON RequestAC.solostandseriesid = shopVAC.solostandseriesid
LEFT OUTER JOIN val_solostandmodel shopVACM
ON Details.solostandmodelid = shopVACM.solostandmodelid
LEFT OUTER JOIN val_myshoplevel
ON Details.myshoplevelid = val_myshoplevel.myshoplevelid
LEFT OUTER JOIN val_division
ON Details.divisionid = val_division.divisionid
WHERE shopType        = 'F'

I would like to find a way to get ORM to join all of these columns so I can put them in ORM.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

So尛奶瓶 2024-11-13 09:05:45

据我了解,您还没有构建任何 ORM 实体? (每个表的 CFC)

如果还没有,您所要做的就是设置所有表(使用带有 RDS 连接的 cfbuilder 来构建 ORM CFC 文件)

一旦您在 ORM Persisted CFC 文件中引用了所有表,您就可以使用 cfquery 标签和 dbtype = "HQL" 执行此操作,并使用 QueryConvertForGrid() 返回数据

然后只需通过 json 将所需的数据返回到 cfgrid 或直接在页面上返回到 cfgrid 标签。

So that I understand, you have not yet built any ORM Entities? (CFC for each table)

If you have not, all you have to do is setup all your tables (use cfbuilder with a RDS connection to build your ORM CFC files)

Once you have all your tables referenced in ORM Persisted CFC files, you can do this with a cfquery tag and dbtype = "HQL" and return the data with QueryConvertForGrid()

Then just return the data you want to your cfgrid via json or directly on the page into the cfgrid tag.

扶醉桌前 2024-11-13 09:05:45

并不关心你是否使用 ORM。

因此,只需使用 进行连接,并在远程函数中使用 QueryConvertForGrid() 返回结果即可。如果您不使用绑定,则只需向 提供实际查询即可。

<cfgrid> doesn't freaking care whether you're using ORM or not.

So just do your joins using <cfquery>, and return the result using QueryConvertForGrid() in your remote function. If you're not using bind, then just feed <cfgrid> with the actual query.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文