<?php
Doo::loadCore ( 'db/DooModel' );
class department extends DooModel {
	public $did;
	public $cid;
	public $departmentName;
	public $_table = 'CLD_department';
	public $_primarykey = 'did';
	public $_fields = array (
			'cid',
			'departmentName',
			'did' 
	);
	public function getDepartmentBycid($cid = 0) {
		Doo::loadClass ( 'XDeode' );
		$XDeode = new XDeode ( 5 );
		
		$list=$this->find ( array (
				'where' => "cid= '" . $cid . "' ",
				'asArray' => TRUE 
		) );
		
		foreach ($list as $key=>$value){
			$list [$key] ['didKey'] = $XDeode->encode ( $value ['did'] );
		}
		
		return $list;
	}
	public function getDepartmentByDid($did = 0) {
		return $this->getOne ( array (
				'where' => "did= '" . $did . "' ",
				'asArray' => TRUE 
		) );
	}
}
?>