You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
shipin/app/dao/crud/SchoolClassIpcDao.php

82 lines
2.2 KiB

<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
/**
* 关联列表
* @author crud自动生成代码
* @date 2023/10/19 13:48:45
*/
namespace app\dao\crud;
use app\dao\BaseDao;
use app\model\crud\SchoolClassIpc;
/**
* Class SchoolClassIpcDao
* @date 2023/10/19
* @package app\dao\crud
*/
class SchoolClassIpcDao extends BaseDao
{
/**
* 设置模型
* @return string
* @date 2023/10/19
*/
protected function setModel(): string
{
return SchoolClassIpc::class;
}
/**
* 搜索
* @param array $where
* @return \crmeb\basic\BaseModel
* @throws \ReflectionException
* @date {%DATE%}
*/
public function searchCrudModel(array $where = [], $field = ['*'], string $order = '', array $with = [])
{
return $this->getModel()->field($field)->when($order !== '', function ($query) use ($order) {
$query->order($order);
})->when($with, function ($query) use ($with) {
$query->with($with);
});
}
/**
* 通过设备ID查询数据
*/
public function selectDataByIotId($iot_id)
{
$resData = $this->getModel()->field('id')->where('iot_id', $iot_id)->where('is_del', 0)->find();
return is_null($resData) ? [] : $resData->toArray();
}
/**
* 通过班级ID查询数据
*/
public function selectDataByClassId($class_id)
{
$resData = $this->getModel()->field('iot_id')->where('class_id', $class_id)->where('is_del', 0)->select();
return is_null($resData) ? [] : $resData->toArray();
}
public function getThisModel()
{
return $this->getModel();
}
}