department.php 763 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class department extends DooModel {
  4. public $did;
  5. public $cid;
  6. public $departmentName;
  7. public $_table = 'CLD_department';
  8. public $_primarykey = 'did';
  9. public $_fields = array (
  10. 'cid',
  11. 'departmentName',
  12. 'did'
  13. );
  14. public function getDepartmentBycid($cid = 0) {
  15. Doo::loadClass ( 'XDeode' );
  16. $XDeode = new XDeode ( 5 );
  17. $list=$this->find ( array (
  18. 'where' => "cid= '" . $cid . "' ",
  19. 'asArray' => TRUE
  20. ) );
  21. foreach ($list as $key=>$value){
  22. $list [$key] ['didKey'] = $XDeode->encode ( $value ['did'] );
  23. }
  24. return $list;
  25. }
  26. public function getDepartmentByDid($did = 0) {
  27. return $this->getOne ( array (
  28. 'where' => "did= '" . $did . "' ",
  29. 'asArray' => TRUE
  30. ) );
  31. }
  32. }
  33. ?>