src/Biz/Testpaper/Dao/Impl/TestpaperItemDaoImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Testpaper\Dao\Impl;
use Biz\Testpaper\Dao\TestpaperItemDao;
use Codeages\Biz\Framework\Dao\AdvancedDaoImpl;
class TestpaperItemDaoImpl extends AdvancedDaoImpl implements TestpaperItemDao
{
protected $table = 'testpaper_item_v8';
public function getItemsCountByTestId($testId)
{
$sql = "SELECT COUNT(*) FROM {$this->table} WHERE testId = ? ";
return $this->db()->fetchColumn($sql, array($testId));
}
public function getItemsCountByParams(array $conditions, $groupBy = '')
{
$sql = 'count(id) as num, sum(score) as score';
if (!empty($groupBy)) {
$sql .= ",{$groupBy}";
}
$builder = $this->createQueryBuilder($conditions)
->select($sql);
if (!empty($groupBy)) {
$builder->addGroupBy($groupBy);
}
return $builder->execute()->fetchAll() ?: array();
}
public function getItemsCountByTestIdAndParentId($testId, $parentId)
{
$sql = "SELECT COUNT(*) FROM {$this->table} WHERE `testId` = ? AND `parentId` = ?";
return $this->db()->fetchColumn($sql, array($testId, $parentId));
}
public function getItemsCountByTestIdAndQuestionType($testId, $questionType)
{
$sql = "SELECT COUNT(*) FROM {$this->table} WHERE `testId` = ? AND `questionType` = ? ";
return $this->db()->fetchColumn($sql, array($testId, $questionType));
}
public function findItemsByIds(array $ids)
{
return $this->findInField('id', array($ids));
}
public function findItemsByTestId($testpaperId, $type)
{
$sql = "SELECT * FROM {$this->table} WHERE testId = ? AND type = ? ORDER BY seq ASC,id ASC";
return $this->db()->fetchAll($sql, array($testpaperId, $type));
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。