|
|
@@ -82,13 +82,13 @@ class Staff extends Api
|
|
|
if (Request::instance()->isGet() == false){
|
|
|
$this->error('非法请求');
|
|
|
}
|
|
|
- $sql = "select rtrim(编号) as 编号,rtrim(名称) as 名称 from 人事_组织结构 where 状态 = '' ";
|
|
|
+ $sql = "select rtrim(编号) as 编号,rtrim(名称) as 名称 from 人事_组织结构 where 状态 = '' order by 编号 asc ";
|
|
|
$list = Db::query($sql);
|
|
|
$data = [];
|
|
|
foreach ($list as $key => $value){
|
|
|
$number = $value['编号'];
|
|
|
- if (strlen($number) == 1 ){//一级菜单
|
|
|
- $sql = "select count(*) as total from 人事_基本资料 where SUBSTRING(部门编码,1,1)='{$number}' and 在职状态 = '在职' and U8在职 = '在职'";
|
|
|
+ if (strlen($number) == 2 ){//一级菜单
|
|
|
+ $sql = "select count(*) as total from 人事_基本资料 where LEFT(部门编码,2)='{$number}' and 在职状态 = '在职' and U8在职 = '在职'";
|
|
|
$res = Db::query($sql);
|
|
|
$value['num'] = $res[0]['total'];
|
|
|
$list[$key] = $value;
|
|
|
@@ -114,7 +114,7 @@ class Staff extends Api
|
|
|
$data[$k]['children'] = [];
|
|
|
foreach ($list as $item){
|
|
|
$num = $item['编号'];
|
|
|
- if (strlen($num) >= 3 && substr($num,0,1) == $k){
|
|
|
+ if (strlen($num) >= 4 && substr($num,0,2) == $k){
|
|
|
if ($item['num'] > 0){
|
|
|
$data[$k]['children'][$i] = $item;
|
|
|
$i++;
|