2

我可以在 Haskell 中使用 join 进行更新查询吗?也许是这样的:

putPromotionInStoreItemsFromStoreBySItemId :: SItemId -> SItemPromoId -> YesodDB App ()
putPromotionInStoreItemsFromStoreBySItemId siId pId = update $ \(si `InnerJoin` s `InnerJoin` ssi) -> do
  on $ ssi ^. SItemStore ==. s ^. StoreId
  on $ s ^. StoreId ==. si ^. SItemStore
  set ssi [ SItemPromotion =. val pId ]
  where_ $     si ^. SItemId ==. val siId 
           &&. isNothing (ssi ^. SItemDisabled)
4

0 回答 0