Blame view

domain/device/CreateBatchRepository.php 1.78 KB
931eed21   xu   1. A授权接口开发
1
2
3
4
<?php

namespace domain\device;

a0935a2c   xu   1. F 数据统计添加多个统计维度
5
use domain\device\models\CreateBatch as CreateBatchModel;
ff8327f6   xu   1. F 删除冗余代码
6
use yii\db\Query;
931eed21   xu   1. A授权接口开发
7

ff8327f6   xu   1. F 删除冗余代码
8
9
class CreateBatchRepository
{
ff8327f6   xu   1. F 删除冗余代码
10
11
12
13
    /**
     * @param $condition
     * @return null|static
     */
a0935a2c   xu   1. F 数据统计添加多个统计维度
14
    static function findOne($condition)
ff8327f6   xu   1. F 删除冗余代码
15
    {
931eed21   xu   1. A授权接口开发
16
17
18
19
20
21
22
23
24
25
26
27
28
29
        return CreateBatchModel::findOne($condition);
    }

    /**
     * @param $type
     * @param $keyword
     * @return array
     */
    static function getSerialNoComponent($type, $keyword)
    {
        if ('manufacture' == $type) {
            $q = new Query();
            $q->select('id,manufacture_no, name');
            $q->from('manufacture');
b60f5eda   xu   1. 删除部分冗余代码
30
            $q->where('name like "%'.$keyword.'%" or manufacture_no like "%'.$keyword.'%"');
931eed21   xu   1. A授权接口开发
31
32
            $q->limit(20);
            $list = $q->all();
b60f5eda   xu   1. 删除部分冗余代码
33

931eed21   xu   1. A授权接口开发
34
35
36
            return $list;
        } elseif('project' == $type) {
            $q = new Query();
b9c38308   xu   1. A OTA版本和APP版本录...
37
            $q->select('id,project_no, name');
931eed21   xu   1. A授权接口开发
38
            $q->from('project');
b60f5eda   xu   1. 删除部分冗余代码
39
            $q->where('name like "%'.$keyword.'%" or project_no like "%'.$keyword.'%"');
b9c38308   xu   1. A OTA版本和APP版本录...
40
            $q->limit(20);
931eed21   xu   1. A授权接口开发
41
42
43
44
45
            $list = $q->all();

            return $list;
        } elseif ('model' == $type) {
            $q = new Query();
b9c38308   xu   1. A OTA版本和APP版本录...
46
            $q->select('id,model_no, name');
931eed21   xu   1. A授权接口开发
47
            $q->from('model');
b60f5eda   xu   1. 删除部分冗余代码
48
            $q->where('name like "%'.$keyword.'%" or model_no like "%'.$keyword.'%"');
b9c38308   xu   1. A OTA版本和APP版本录...
49
            $q->limit(20);
931eed21   xu   1. A授权接口开发
50
51
52
53
54
            $list = $q->all();

            return $list;
        } elseif ('production' == $type) {
            $q = new Query();
b9c38308   xu   1. A OTA版本和APP版本录...
55
            $q->select('id,production_no, name');
931eed21   xu   1. A授权接口开发
56
            $q->from('production');
b60f5eda   xu   1. 删除部分冗余代码
57
            $q->where('name like "%'.$keyword.'%" or production_no like "%'.$keyword.'%"');
931eed21   xu   1. A授权接口开发
58
59
60
61
62
            $q->limit(20);
            $list = $q->all();

            return $list;
        } else {
b9c38308   xu   1. A OTA版本和APP版本录...
63
            return [];
931eed21   xu   1. A授权接口开发
64
        }
b60f5eda   xu   1. 删除部分冗余代码
65
    }
931eed21   xu   1. A授权接口开发
66
67

}
ff8327f6   xu   1. F 删除冗余代码

a0935a2c   xu   1. F 数据统计添加多个统计维度

ff8327f6   xu   1. F 删除冗余代码

a0935a2c   xu   1. F 数据统计添加多个统计维度

54761512   xu   1. A 添加删除序列号列表

a0935a2c   xu   1. F 数据统计添加多个统计维度

ff8327f6   xu   1. F 删除冗余代码

a0935a2c   xu   1. F 数据统计添加多个统计维度

ff8327f6   xu   1. F 删除冗余代码

a0935a2c   xu   1. F 数据统计添加多个统计维度

ff8327f6   xu   1. F 删除冗余代码

a0935a2c   xu   1. F 数据统计添加多个统计维度

ff8327f6   xu   1. F 删除冗余代码

d1ded260   xu   1. F 版本管理列表增加显示项目和型号

931eed21   xu   1. A授权接口开发