是否可以使用hql仅连接第一行(或只是任何其他行但只有一行)?
select
config.id, mg.modelGroupName, min(deliveryType.id)
from
NotificationConfig config, NotificationConfigEntry configEntry, SettlementModelGroup mg
join
configEntry.notificationConfigEntryPK.user user
join
configEntry.notificationConfigEntryPK.deliveryType deliveryType
join
config.notificationType notifType
join
notifType.objectType objectType
where
config.id = configEntry.notificationConfigEntryPK.notificationConfig.id
and ( mg.modelId = config.objectId or config.objectId is null )
Run Code Online (Sandbox Code Playgroud)
当然,这是我现在拥有的代码
min(deliveryType.id)
Run Code Online (Sandbox Code Playgroud)
不起作用.未映射mg.modelId和config.objectId之间的关系,deliveryType是一个列表.我不能使用不同的原因我需要能够通过deliveryType订购(这没有任何意义,但我还是需要它)和modelGroupName.
我正在使用select
withv-model
并且有选项 withv-for
和 object 作为值。选项是一些由 id 标识的元素。如何根据自定义相等性(在本例中为相等id
字段)预选选项?我正在寻找类似于 angularjs 的东西track by
来自ng-options
.
https://jsfiddle.net/79wsf1n4/5/
如何使用具有相同 id 的值预选输入?
模板:
<div id="vue-instance">
<select v-model="selected">
<option v-for="item in inventory" :value="item" :key="item.id">
{{ item.name }}
</option>
</select>
<p>
{{ selected.id }}
</p>
</div>
Run Code Online (Sandbox Code Playgroud)
js:
var vm = new Vue({
el: '#vue-instance',
data: {
inventory: [
{name: 'MacBook Air', id: 1},
{name: 'MacBook Pro', id: 2},
{name: 'Lenovo W530', id: 3},
{name: 'Acer Aspire One', id: 4} …
Run Code Online (Sandbox Code Playgroud)