where($map)->field("qydm, fzr_name")->find(); } /** * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException */ public static function getEnterPrisesList($page, $xzqdm){ switch (strlen($xzqdm) ){ case 4: $map[]=["city","=",$xzqdm]; break; case 6: $map[] = ["country","=",$xzqdm]; break; case 9: $map[] = ["towns","=",$xzqdm]; break; default: $map[]=["city","<>",""]; } $res["row"] = (new Enterprises)->where($map)->page($page["page"],$page["size"])->select(); $res["count"] = (new Enterprises)->where($map)->count(); return $res; } public static function getEnterprisesInfoByQydm($qydm){ return Db::name("enterprises")->field("t_enterprises.*,x.xzqmc as cityname,e.xzqmc as countyname,f.xzqmc as townsname")->where("qydm",$qydm)->leftJoin("t_zd_xzq x","t_enterprises.city=x.xzqdm")->leftJoin("t_zd_xzq e","t_enterprises.county=e.xzqdm")->leftJoin("t_zd_xzq f","t_enterprises.towns=f.xzqdm")->find(); } /** * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException */ public static function getEnterprisesInfoById($id){ return (new Enterprises)->find($id); } public static function editEnterprisesInfo($info,$id): Enterprises { return Enterprises::update($info,["id"=>$id]); } public static function addEnterprises($info): bool { return (new Enterprises)->save($info); } public static function delEnterprises($id): bool { return Enterprises::destroy($id); } }