42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\common\service;
|
|
|
|
use app\admin\validate\SysDictItemValidate;
|
|
use app\common\logic\SysDictItemLogic;
|
|
use app\common\logic\SysDictLogic;
|
|
use app\common\traits\crud\CrudServiceTrait;
|
|
use app\common\model\SysDictItem;
|
|
use support\exception\BusinessException;
|
|
use support\Request;
|
|
|
|
class SysDictItemService
|
|
{
|
|
|
|
protected $logic;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->logic = (new SysDictItemLogic());
|
|
}
|
|
|
|
/**
|
|
* 获取系统list
|
|
*/
|
|
public function getList($params)
|
|
{
|
|
if (empty($params['dict_id']) && empty($params['dict_code']))
|
|
throw new BusinessException('未明确要查询的字典组');
|
|
$where = [];
|
|
if(isset($params['dict_id']) && $params['dict_id'])
|
|
$where[] = ['dict_id', '=', $params['dict_id']];
|
|
if(isset($params['dict_code']) && $params['dict_code']){
|
|
$dict = (new SysDictLogic)->getDictByCode($params['dict_code']);
|
|
if (empty($dict['id']))
|
|
throw new BusinessException('字典组code错误');
|
|
$where[] = ['dict_id', '=', $dict['id']];
|
|
}
|
|
|
|
return $this->logic->getList($where);
|
|
}
|
|
} |