我有这个问题:
Time_Sheet_Details.findAll({
include: [
{
model: timesheetNotesSubcon,
required: false,
attributes:["note","file_name", "id", "working_hrs", "timestamp", "has_screenshot", "notes_category", "userid"],
},
{
model: Timesheet,
attributes:["id","leads_id","userid","subcontractors_id"],
where: clientWhere, // Client
include:[
{
model: Lead_Info, attributes:["id","fname","lname","email","hiring_coordinator_id","status"],
where: scWhere, // SC
include:[{
model: adminInfoSchema,
required: false,
attributes:["admin_id","admin_fname", "admin_lname", "admin_email", "signature_contact_nos", "signature_company"],
}]
},
{
model:Personal_Info,attributes:["userid","fname","lname","email"],
}
]
}],
where: {
reference_date: filters.reference_date
},
order:[
["id","DESC"]
],
offset:((page-1)*limit),
limit : limit,
subQuery:false
}).then(function(foundObject){
willFulfillDeferred.resolve(foundObject);
});
我的设置是Timesheet
TimesheetDetails
有timesheetNotesSubcon
个TimesheetDetails
。我将所有timesheetNotesSubcon
与timesheetNotesSubcon
一起提取timesheetNotesSubcon
。
它工作正常,但是如果我只想获取TimesheetDetails
具有等于或大于1 timesheetNotesSubcon
的记录的内容,那么所有move
的结果为{{1}不会被提取。
答案 0 :(得分:0)
您需要制作包含的模型required
。
Time_Sheet_Details.findAll({
include: [
{
model: timesheetNotesSubcon,
required: true,
...