'正常', self::STATUS_DEL_YES => '删除' ]; const SALESMAN_STATUS_NO = '0'; const SALESMAN_STATUS_YES = '1'; const SALESMAN_STATUS = [ self::SALESMAN_STATUS_NO => '休班', self::SALESMAN_STATUS_YES => '在班' ]; /** * The table associated with the model. * * @var string */ protected $table = 'medical_care_salesman'; public $timestamps = false; /** * Notes:获取菜单列表 * @param string $keywords * @param int $page * @param int $limit * @return array * User: ZQ * Date: 2022/9/14 */ public static function getSalesmanList(int $page, int $limit, string $keywords) { $list = static::select(['medical_care_salesman.*','merchant_shop.shop_name'])->where(['salesman_del'=>static::STATUS_DEL_NO]) ->when($keywords != '', function ($query) use ($keywords){ $query->where('salesman_resale_name', 'like', '%' . $keywords . '%'); }) ->leftJoin('merchant_shop', 'shop_id', '=', 'medical_care_salesman.salesman_shop_id') ->forPage($page,$limit) ->orderBy('salesman_create_time','DESC') ->get(); $count = static::where(['salesman_del'=>static::STATUS_DEL_NO]) ->when($keywords != '', function ($query) use ($keywords){ $query->where('salesman_resale_name', 'like', '%' . $keywords . '%'); }) ->count(); return [$list,$count]; } /** * Notes:查询指定条件下的某个字段内容 * @param int $salesman_id * @param string $field * User: ZQ * Date: 2022/9/27 */ public static function getValue(int $salesman_id, string $field) { return static::where(['salesman_id' => $salesman_id])->value($field); } }