add attachment table name define in Reference module
This commit is contained in:
parent
6f6b0ecb9a
commit
649edb70b5
|
@ -46,6 +46,7 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
|
||||||
$this->table->metadata_reference = "mdref";
|
$this->table->metadata_reference = "mdref";
|
||||||
$this->table->reference_tag = "ref_tag";
|
$this->table->reference_tag = "ref_tag";
|
||||||
$this->table->metadata = "metadata";
|
$this->table->metadata = "metadata";
|
||||||
|
$this->table->attachments = "attachments";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -398,9 +399,20 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
|
||||||
//获得reference类型的附件
|
//获得reference类型的附件
|
||||||
public function getReferenceFiles()
|
public function getReferenceFiles()
|
||||||
{
|
{
|
||||||
|
$wheresql = [
|
||||||
|
"att.filetype='literature'",
|
||||||
|
];
|
||||||
|
|
||||||
|
if(!empty($this->keyword))
|
||||||
|
{
|
||||||
|
$wheresql[] = " (att.realname LIKE '%{$this->keyword}%' OR att.filename LIKE '%{$this->keyword}%') ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$wheresql = " WHERE ".join(" AND ",$wheresql);
|
||||||
|
|
||||||
$sql = "SELECT att.*,ref.attid,ref.id as refid FROM {$this->table->attachments} att
|
$sql = "SELECT att.*,ref.attid,ref.id as refid FROM {$this->table->attachments} att
|
||||||
LEFT JOIN {$this->table->reference} ref ON att.id=ref.attid
|
LEFT JOIN {$this->table->reference} ref ON att.id=ref.attid
|
||||||
WHERE att.filetype='literature'";
|
$wheresql";
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
$rows = $rs->fetchAll();
|
$rows = $rs->fetchAll();
|
||||||
return $rows;
|
return $rows;
|
||||||
|
|
Loading…
Reference in New Issue