<?php
/**
 *
 * @author：llbjj
 * @DateTime：2022/5/6 10:57
 * @Description：
 *
 */

namespace Application\Service\DB\Dictionary;

use Interop\Container\ContainerInterface;

class Itemjob extends \Application\Service\DB\AbstractDb
{
    public function __construct($dbAdapter, ContainerInterface $container)
    {
        $this->tableName = 'yikeen_dictionary_itemjob';
        parent::__construct($dbAdapter, $container);
    }

    /**
     * Notes:获取角色信息，ID为键值，名称+code值为值
     * User: lltyy
     * DateTime: 2022/11/1 15:02
     *
     * @param $where
     * @return array
     */
    public function fetchNameAndCodeById($where){
        $arr = [];
        $cond = [
            'where'=>$where,
            'columns'=>['id','job_name','job_english'],
            'order'=>['job_order asc']
        ];
        $datas = $this->fetchAll($cond);
        if(!empty($datas)){
            foreach($datas as $data){
                $data_id = $data['id'];
                $arr[$data_id] = !empty($data['job_english']) ? $data['job_name'] .'（'.$data['job_english'].'）' : $data['job_name'];
            }
        }
        return $arr;
    }
}