12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace app\api\model;
- use think\Model;
- class SamplePesticides extends Model
- {
- public function saveItem($data)
- {
- return parent::saveAll($data);
- }
- public function getItemByTestIdAndSampleId($test_id, $sample_id)
- {
- return $this->where([
- ['test_id', '=', $test_id],
- ['sample_id', '=', $sample_id]
- ])
- ->failException(false)
- ->find();
- }
- public function getItemBySampleId($sample_id)
- {
- return $this->where('sample_id', '=', $sample_id)->select();
- }
- public function saveItemByTestIdAndSampleId($test_id, $sample_id,$data)
- {
- return $this->where([
- ['test_id', '=', $test_id],
- ['sample_id', '=', $sample_id]
- ])
- ->save($data);
- }
- }
|