<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2020/1/13
 * Time: 15:37
 */
namespace app\index\model;
use think\Model;

class ginfomodel extends Model{
    protected $table='t_ginfo';

    public function getpidbygid($gid){
        $record=$this->where('id',$gid)->find();
        if (empty($record)){
            return 0;
        }else{
            return $record['pid'];
        }
    }

    public function addnewgroup($arr){
        $res=$this->save($arr);
        return $res;
    }

    public function getglistbypid($pid){

       $rlist=$this->where('pid',$pid)->select();


        return $rlist;

    }

    /*
     * 20200310
     * 获取班组名称
     */
    public function selginfobygid($gid){
        $rec=$this->where('id',$gid)->find();
        return $rec;
    }

    /*
     * 20200331
     * 更新班组名称
     */

    public function updatenamebyid($arr){
        $where_arr['id']=$arr['id'];
        $updatearr['gname']=$arr['gname'];
        $updatearr['gworkclass']=$arr['gworkclass'];
        $rid=$this->where($where_arr)->update($updatearr);
        return $rid;
    }


}