<?php /** * 公司与部门关联模型 */ class CompanyRelationModel extends RelationModel{ //主表名称 protected $tableName = 'company'; //定义关联关系 protected $_link = array( //关联表名称 'department' => array( 'mapping_type' => MANY_TO_MANY, //多对多关系 'foreign_key' => 'company_id', //主表外键 'relation_key' => 'department_id', //关联表外键 'relation_table' => 'sys_company_department', //中间表(员工对应角色表), 'mapping_fields' => 'id, name, pId' //关联表显示字段 ) ); } ?>
时间: 2024-10-27 04:40:38