使用ui_component写的list,目前默认查询出表里的全部数据,怎样给查询的数据添加where条件?

4.33K 浏览开发笔记

使用ui_component写的list,目前默认查询出表里的全部数据,怎样给查询的数据添加where条件?

使用ui_component写的list,目前默认查询出表里的全部数据,现在我需要查询某个字段不为空的所有数据,我应该在哪写where条件?因为对magento2语法不是很清楚,求大神给出具体解决方案,最好带有sql,万分感谢!

0

https://devdocs.magento.com/guides/v2.3/ui_comp_guide/concepts/ui_comp_data_source.html#declaring-the-xml
在你定义的数据提供类里写就行了,getCollection()->->addFieldToFilter('ean', array('neq' => ''))的写法。
[YourNameSpace][YourModule]UiDataProvider[YourComponentName]DataProvider

0

ok,已解决,谢谢

0