<?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'                //关联表显示字段
        )
    );
    
}
?>

 

相关文章:

  • 2021-07-17
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-11-28
  • 2021-11-15
猜你喜欢
  • 2022-12-23
  • 2021-11-09
  • 2022-01-16
  • 2021-08-15
  • 2021-05-23
  • 2022-12-23
  • 2021-05-23
相关资源
相似解决方案