Department.php 1.6 KB
<?php
namespace app\common\model\serviceapi;
use app\common\model\ServiceApi;

/**
 * 功能描述 用户管理
 * Class Product
 * @package app\common\model\commapi
 * Date: 2020/11/2
 * Time: 16:33
 * @author nyq
 */
class Department extends ServiceApi
{
    protected $table = "sos_user_department";
    protected $pk = "id";


    /**
     * 函数功能描述  添加用户
     * Date: 2020/11/2
     * Time: 15:00
     * @author nyq
     */
    public function add($data)
    {
        $res = static::insertGetId($data);
        return $res;
    }

    /**
     * Notes:函数功能描述 获取机构列表
     * User: 张佳
     * DateTime: 2021/6/9 18:19
     */
    public function getDepartmentList($where)
    {
        $list = static::where($where)->select();
        return $list;
    }
    /**
     * 函数功能描述 获取商品列表
     * Date: 2020/11/2
     * Time: 16:40
     * @author nyq
     */

    public function getUserlist($code,$offset,$rows){
        $user = static::alias("user")->where($code)->limit($offset,$rows);
        $res= $user->join("sos_product_order or", "or.user_id=user.id")->join("sos_product_goods go", "or.goods_id=go.id","LEFT")
            ->field("user.*,or.order_code,or.num,or.price,go.name as goods_name")
            ->select();
        return $res;
    }

    public function getUserlistToEx(){
        $user = static::alias("user");
        $res= $user->join("sos_product_order or", "or.user_id=user.id")->join("sos_product_goods go", "or.goods_id=go.id","LEFT")
            ->field("user.*,or.order_code,or.num,or.price,go.name as goods_name")
            ->select();
        return $res;
    }
















}