深圳全飞鸿

标题: jblabel中的DB用法 [打印本页]

作者: syant    时间: 2024-11-9 19:57
标题: jblabel中的DB用法
$groups= Db('auth_group_access')->where(" uid='".$admin->id."' ")->select();
        $group_id="";
        if(count($groups)>0){
            $group_id=$groups[0]["group_id"];
        }


作者: syant    时间: 2024-11-10 10:47
$list = $this->model
            ->join('fa_dept a','a.id = fa_barcodetemplate.dept_id ','LEFT')
            ->join('fa_dept b','a.parent_id = b.id ','LEFT')
            ->field("   
                fa_barcodetemplate.*,
                a.dept_name as 'a.dept_name',
                b.dept_name as 'b.dept_name'
                ")
            ->where($where)
            ->where($wherestr)         
            ->order($sort, $order)
            ->paginate($limit);

得到:
( SELECT   
                fa_barcodetemplate.*,
                a.dept_name as 'a.dept_name',
                b.dept_name as 'b.dept_name'
                 FROM `fa_barcodetemplate` LEFT JOIN `fa_dept` `a` ON `a`.`id`=`fa_barcodetemplate`.`dept_id` LEFT JOIN `fa_dept` `b` ON `a`.`parent_id`=`b`.`id` WHERE  (   a.nod='000002'  ) ORDER BY `id` DESC )






欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2