|
@@ -7,7 +7,8 @@ use think\Db;
|
|
|
use app\common\enum\OrderEnum;
|
|
|
use app\common\Service\OrderService;
|
|
|
use app\common\exception\BusinessException;
|
|
|
-
|
|
|
+use app\common\model\inspection\TypeItem;
|
|
|
+use app\common\model\inspection\Item;
|
|
|
class InspectService
|
|
|
{
|
|
|
/**
|
|
@@ -38,8 +39,15 @@ class InspectService
|
|
|
if (isset($params['name']) && $params['name'] !== '') {
|
|
|
$where['name'] = ['like', '%' . $params['name'] . '%'];
|
|
|
}
|
|
|
+
|
|
|
+ if (isset($params['inspect_type_id']) && $params['inspect_type_id'] !== '') {
|
|
|
+ // 通过关联表查询ID
|
|
|
+ $typeItem = TypeItem::where('type_id', $params['inspect_type_id'])->select();
|
|
|
+ $inspectIds = array_column( collection($typeItem)->toArray(), 'item_id');
|
|
|
+ $where['id'] = ['in', $inspectIds];
|
|
|
+ }
|
|
|
|
|
|
- $query = (new \app\common\model\inspection\Item())->where($where)
|
|
|
+ $query = (new Item())->where($where)
|
|
|
->field('id,name,parent_id,is_required,status,standard_desc');
|
|
|
|
|
|
// 排序
|