|
@@ -148,7 +148,7 @@ class CompanyItem extends BaseController
|
|
|
public function update()
|
|
|
{
|
|
|
|
|
|
- $param = $this->request->only(['id', 'companyNo', 'name', 'pid', 'level' => 1, 'weight' => 1,], 'post', 'trim');
|
|
|
+ $param = $this->request->only(['id', 'companyNo', 'name', 'pid', 'level' => 1, 'weight' => 1], 'post', 'trim');
|
|
|
|
|
|
$val = Validate::rule([
|
|
|
'id' => 'require|number|gt:0',
|
|
@@ -236,14 +236,17 @@ class CompanyItem extends BaseController
|
|
|
->field('companyNo')
|
|
|
->where($where)
|
|
|
->group('companyNo')
|
|
|
- ->buildSql();
|
|
|
+ ->column('companyNo');
|
|
|
|
|
|
- $company = Db::name('headquarters')
|
|
|
- ->field('id,code,name,type')
|
|
|
- ->where('is_del', 0)
|
|
|
- ->where('code IN ' . $companyNo)
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
+ $company_1 = Db::name('headquarters')
|
|
|
+ ->where(['is_del' => 0, 'code' => $companyNo])
|
|
|
+ ->column('id,code,name,type', 'code');
|
|
|
+
|
|
|
+ $company_2 = Db::name('headquarters')
|
|
|
+ ->where(['is_del' => 0, 'relation_code' => $companyNo])
|
|
|
+ ->column('id,relation_code code,name,type', 'relation_code');
|
|
|
+
|
|
|
+ $company = array_merge($company_1, $company_2);
|
|
|
|
|
|
foreach ($company as &$value) {
|
|
|
$value['child'] = Db::name('company_item')
|
|
@@ -257,7 +260,7 @@ class CompanyItem extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return json_show(0, '获取成功', $company);
|
|
|
+ return json_show(0, '获取成功', array_values($company));
|
|
|
|
|
|
}
|
|
|
|