76 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			76 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 *  | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 *  | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 *  | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 *  | Author: CRMEB Team <admin@crmeb.com>
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * 公司历程
							 | 
						|||
| 
								 | 
							
								 * @author crud自动生成代码
							 | 
						|||
| 
								 | 
							
								 * @date 2025/02/21 10:00:25
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace app\dao\crud;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								use app\dao\BaseDao;
							 | 
						|||
| 
								 | 
							
								use app\model\crud\Process;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * Class ProcessDao
							 | 
						|||
| 
								 | 
							
								 * @date 2025/02/21
							 | 
						|||
| 
								 | 
							
								 * @package app\dao\crud
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								class ProcessDao extends BaseDao
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    /**
							 | 
						|||
| 
								 | 
							
								     * 设置模型
							 | 
						|||
| 
								 | 
							
								     * @return string
							 | 
						|||
| 
								 | 
							
								     * @date 2025/02/21
							 | 
						|||
| 
								 | 
							
								     */
							 | 
						|||
| 
								 | 
							
								    protected function setModel(): string
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        return Process::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);
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['title']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereLike('title', '%'.$where['title'].'%');
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['subtitle']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereLike('subtitle', '%'.$where['subtitle'].'%');
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['set_time']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereBetween('set_time', $where['set_time']);
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['content']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereLike('content', '%'.$where['content'].'%');
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['sort']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->where('sort', '=', $where['sort']);
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['status']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->where('status', '=', $where['status']);
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['add_time']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereBetween('add_time', $where['add_time']);
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['hide']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->where('hide', '=', $where['hide']);
							 | 
						|||
| 
								 | 
							
								        });
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								}
							 |