コード例 #1
0
ファイル: DVController.php プロジェクト: hunglmtb/eb
 public function loadFormSetting(Request $request)
 {
     $data = $request->all();
     $result = array();
     $value = $data['value'];
     $task_id = isset($data['task_id']) ? $data['task_id'] : 0;
     switch ($value) {
         case 'ALLOC_CHECK':
         case 'ALLOC_RUN':
             $network = Network::getTableName();
             $allocJob = AllocJob::getTableName();
             $tm = [];
             $tm = DB::table($network . ' AS a')->join($allocJob . ' AS b', 'a.ID', '=', 'b.NETWORK_ID')->distinct()->get(['a.ID', 'a.NAME']);
             $alloc_job = AllocJob::where(['NETWORK_ID' => $tm[0]->ID])->get(['ID', 'NAME']);
             $result['network'] = $tm;
             $result['allocJob'] = $alloc_job;
             break;
         case 'VIS_REPORT':
             $result = Facility::all(['ID', 'NAME']);
             break;
         case 'FDC_EU':
             $models = ['Facility', 'EnergyUnitGroup', 'CodeReadingFrequency', 'CodeFlowPhase', 'CodeEventType', 'CodeAllocType', 'CodePlanType', 'CodeForecastType'];
             foreach ($models as $m) {
                 $tm = [];
                 $model = 'App\\Models\\' . $m;
                 $tm = $model::all(['ID', 'NAME']);
                 $result[$m] = $tm;
             }
             break;
         case 'FDC_FLOW':
             $models = ['Facility', 'CodeReadingFrequency', 'CodeFlowPhase'];
             foreach ($models as $m) {
                 $tm = [];
                 $model = 'App\\Models\\' . $m;
                 $tm = $model::all(['ID', 'NAME']);
                 $result[$m] = $tm;
             }
             break;
         case 'INT_IMPORT_DATA':
             $tm = [];
             $tm = IntConnection::all(['ID', 'NAME']);
             $intTagSet = IntTagSet::where(['CONNECTION_ID' => $tm[0]->ID])->get(['ID', 'NAME']);
             $result['IntConnection'] = $tm;
             $result['IntTagSet'] = $intTagSet;
             break;
         default:
             $result = [];
     }
     $task = TmWorkflowTask::where(['ID' => $task_id])->get();
     $result['task'] = $task;
     $result['value'] = $value;
     return response()->json(array('result' => $result));
 }
コード例 #2
0
    public static function getLoadSql()
    {
        $tableName = Network::getTableName();
        return '
			SELECT
				`' . $tableName . '`.*
			FROM
				`' . Network::getDbName() . '`.`' . $tableName . '`
		';
    }