|
@@ -80,18 +80,11 @@ class Station extends CatchController
|
|
|
*/
|
|
|
public function getAllList(Request $request)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
$cond=[
|
|
|
'_string'=>'a.DEVICE_CODE = r.DEVICE_CODE',
|
|
|
];
|
|
|
-
|
|
|
-
|
|
|
$cond['page']=1;
|
|
|
$cond['limit']=3000;
|
|
|
-
|
|
|
-
|
|
|
$conn = null;
|
|
|
$tableName='(SELECT * FROM DSSC2.ADM_DEV ORDER BY ID DESC) a,DSSC2.ADM_DEV_RFID_CHN r';
|
|
|
$field='a.ID,a.IS_ONLINE,a.LOGIN_NAME,a.DEVICE_CODE,a.DEVICE_NAME,a.OWNER_CODE,to_char(a.UPDATE_DATE,\'yyyy-mm-dd hh24:mi:ss\') UPDATE_DATE,r.GPS_X,r.GPS_Y';
|
|
@@ -111,6 +104,7 @@ class Station extends CatchController
|
|
|
$end=$cond['page']*$cond['limit'];
|
|
|
$whereStr=buildQueryCond2($cond);
|
|
|
$sql='SELECT * FROM ( SELECT '.$field.',ROWNUM RN FROM '.$tableName.' WHERE ROWNUM <='.$end.' '.$whereStr.' ) WHERE RN >'. $start;
|
|
|
+ // $sql='SELECT '.$field.' FROM '.$tableName.' WHERE '.$whereStr;
|
|
|
// var_dump($sql);
|
|
|
// 查询并渲染
|
|
|
$stid = oci_parse($conn, $sql);
|
|
@@ -138,6 +132,70 @@ class Station extends CatchController
|
|
|
|
|
|
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 所有列表给智能交通使用
|
|
|
+ * @time 2022年01月20日 10:09
|
|
|
+ * @param Request $request
|
|
|
+ */
|
|
|
+ public function getAllListForTrans(Request $request)
|
|
|
+ {
|
|
|
+ // $param=$request->param();
|
|
|
+ // $cond['page']=isset($param['page'])?$param['page']:1;
|
|
|
+ // $cond['limit']=isset($param['limit'])?$param['limit']:100;
|
|
|
+ $cond['page']=1;
|
|
|
+ $cond['limit']=30000;
|
|
|
+ $conn = null;
|
|
|
+ $tableName='(SELECT * FROM DSSC2.ADM_DEV ORDER BY ID DESC) a';
|
|
|
+ $field='a.ID,a.LOGIN_NAME,a.DEVICE_CODE,a.DEVICE_NAME,a.OWNER_CODE';
|
|
|
+ $host= Env::get('oracle.hostname', '127.0.0.1');
|
|
|
+ $port= Env::get('oracle.hostport', '1521');
|
|
|
+ $instance_name= Env::get('oracle.instance', 'ORCL');
|
|
|
+ $username= Env::get('oracle.username', 'root');
|
|
|
+ $password= Env::get('oracle.password', 'root');
|
|
|
+
|
|
|
+ // $count=queryOracleCount('DSSC2.ADM_DEV',$cond);
|
|
|
+ // $conn = oci_connect('用户名', '密码', '远程数据库名(eg.//192.168.1.133/orcl)');
|
|
|
+ $conn = oci_connect($username, $password, $host.':'.$port.'/'. $instance_name,'AL32UTF8');
|
|
|
+
|
|
|
+ if (!$conn) {
|
|
|
+ $e = oci_error();
|
|
|
+ trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
|
|
|
+ }
|
|
|
+ $start=($cond['page']-1)*$cond['limit'];
|
|
|
+ $end=$cond['page']*$cond['limit'];
|
|
|
+ $whereStr=buildQueryCond2($cond);
|
|
|
+ $sql='SELECT * FROM ( SELECT '.$field.',ROWNUM RN FROM '.$tableName.' WHERE ROWNUM <='.$end.' '.$whereStr.' ) WHERE RN >'. $start;
|
|
|
+ // var_dump($sql);
|
|
|
+ // 查询并渲染
|
|
|
+ $stid = oci_parse($conn, $sql);
|
|
|
+ $r = oci_execute($stid);
|
|
|
+ $rows=[];
|
|
|
+ while($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
|
|
|
+ $item=['key'=>$row['LOGIN_NAME'],'label'=>$row['DEVICE_NAME']];
|
|
|
+ $rows[]=$item;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ oci_free_statement($stid);
|
|
|
+ // $response=[
|
|
|
+ // 'code'=>10000,
|
|
|
+ // 'message'=>'查询成功',
|
|
|
+ // 'count'=>$count,
|
|
|
+ // 'data'=>$rows,
|
|
|
+ // 'current'=>isset($param['page'])?(int)$param['page']:1,
|
|
|
+ // 'limit'=>isset($param['limit'])?(int)$param['limit']:100,
|
|
|
+ // ];
|
|
|
+ // return $response;
|
|
|
+ $response=[
|
|
|
+ 'code'=>10000,
|
|
|
+ 'message'=>'查询成功',
|
|
|
+ 'data'=>$rows,
|
|
|
+ ];
|
|
|
+ return $response;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
/**
|
|
|
* 保存信息
|
|
|
* @time 2022年01月20日 10:55
|