TemplateModel.php 798 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\manage\model;
  3. use think\Model;
  4. use think\Db;
  5. class TemplateModel extends Model {
  6. protected $table = 'templates';
  7. public function queryAll( $wheres, $page, $pageSize){
  8. $query = Db::view('templates', 'id, title, is_public, create_user, exam_class_id, impression, description, createdAt, parent_id');
  9. if (!empty($wheres)){
  10. $query->where($wheres);
  11. }
  12. return $query->page($page,$pageSize)->select();
  13. }
  14. public function queryAllCount($wheres, $page, $pageSize){
  15. $query = Db::view('templates', 'id, title, is_public, create_user, exam_class_id, impression, description, createdAt, parent_id');
  16. if (!empty($wheres)){
  17. $query->where($wheres);
  18. }
  19. return $query->count();
  20. }
  21. }