34 lines
788 B
PHP
34 lines
788 B
PHP
<?php
|
|
|
|
class Series_number_model extends MY_Model
|
|
{
|
|
protected $table = 'series_number';
|
|
protected $join = [
|
|
[
|
|
'table'=>'sample as s',
|
|
'on'=>'base.id = s.series_id',
|
|
'type'=>'left'
|
|
]
|
|
];
|
|
protected $keyword_field = ['device_id'];
|
|
protected $list_field = 'base.*,s.id as sample_id,s.create_time as time_bind';
|
|
protected $has_update_time = false;
|
|
protected $where_field_map = [
|
|
'sample_id'=>'s.id'
|
|
];
|
|
protected $null_field = ['s.id'];
|
|
protected $unique_field = 'device_id';
|
|
|
|
function aaaaadd($entity)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('package as p');
|
|
$this->db->where('device_id',$entity['device_id']);
|
|
$result = $this->db->get()->row_array();
|
|
if($result){
|
|
return $entity['device_id'].'已存在';
|
|
}
|
|
return $this->db->insert($entity);
|
|
}
|
|
}
|