/** * メソッド概要 ・データベース操作に使用するSQLを生成する * * @param ・intParamMode データベースを操作する種別 * @param ・objParam 上位からの任意パラメータ * @return ・成功:「""」以外 失敗:「""」 */ public String fEtexExecuteRecognitionPublishSql(int intParamMode, Object objParam) { /* SQLデータ */ String stgResultSql = null; /* SQLバッファ */ StringBuffer stgBufSql = null; /* 更新者 */ String upd_id = null; /* 社員コード */ String MD010010V = null; /* 年月日 */ String TD100020V = null; /* index */ int TD100030I = 0; /* 精算区分 */ String TD100170C = null; /* データベース操作種別による、swithc分岐 */ switch (intParamMode) { case ETEX_RECOGNITION_DB_SELECT_EITD100: /* 交通費精算トランザクション検索 */ /* 対象社員コード*/ MD010010V = clsRecognitionCtlBean.getRecognitionSerchStaffCode(); /* 対象年月 */ TD100020V = clsRecognitionCtlBean.getRecognitionSerchDate(); /* 対象年月チェック */ if (fEtexGeneralDateUtilFormatChk(ETEX_GENERAL_DATE_MODE_YM, TD100020V) != true) { TD100020V = "0000/00"; } /* SQL生成 */ stgBufSql = new StringBuffer(ETEX_GENERAL_DB_SQL_BUF_150); if (MD010010V.equals("000-0000") == true) { /* 全社員検索 */ stgBufSql.append("SELECT EITD100.*, EIMD010.MD010110V, EIMD010.MD010120V FROM "); stgBufSql.append("EITD100, EIMD010 "); stgBufSql.append("WHERE "); stgBufSql.append("EITD100.MD010010V = EIMD010.MD010010V "); stgBufSql.append("AND "); stgBufSql.append("EITD100.TD100020V "); stgBufSql.append("LIKE '"); stgBufSql.append(TD100020V); stgBufSql.append("%' "); stgBufSql.append("ORDER BY "); stgBufSql.append("EIMD010.MD010120V "); stgBufSql.append(","); stgBufSql.append("EITD100.TD100020V "); stgBufSql.append(","); stgBufSql.append("EITD100.TD100030I "); stgBufSql.append("ASC"); } else { /* 指定社員検索 */ stgBufSql.append("SELECT EITD100.*, EIMD010.MD010110V FROM "); stgBufSql.append("EITD100, EIMD010 "); stgBufSql.append("WHERE "); stgBufSql.append("EITD100.MD010010V = EIMD010.MD010010V "); stgBufSql.append("AND "); stgBufSql.append("EITD100.MD010010V "); stgBufSql.append("= '"); stgBufSql.append(MD010010V); stgBufSql.append("' "); stgBufSql.append("AND "); stgBufSql.append("EITD100.TD100020V "); stgBufSql.append("LIKE '"); stgBufSql.append(TD100020V); stgBufSql.append("%' "); stgBufSql.append("ORDER BY "); stgBufSql.append("EITD100.TD100020V "); stgBufSql.append(","); stgBufSql.append("EITD100.TD100030I "); stgBufSql.append("ASC"); } stgResultSql = stgBufSql.toString(); break; case ETEX_RECOGNITION_DB_SELECT_EITD100_EX: /* 交通費精算トランザクション検索(承認チェック) */ /* 対象社員コード*/ MD010010V = fEtexExecuteRecognitionGetChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_CODE); /* 対象年月 */ TD100020V = fEtexExecuteRecognitionGetChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_DATE); /* index */ TD100030I = Integer.parseInt( fEtexExecuteRecognitionGetChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_INDEX)); /* SQL生成 */ stgBufSql = new StringBuffer(ETEX_GENERAL_DB_SQL_BUF_100); stgBufSql.append("SELECT * FROM "); stgBufSql.append("EITD100 "); stgBufSql.append("WHERE "); stgBufSql.append("MD010010V "); stgBufSql.append("= '"); stgBufSql.append(MD010010V); stgBufSql.append("' "); stgBufSql.append("AND "); stgBufSql.append("TD100020V "); stgBufSql.append("= '"); stgBufSql.append(TD100020V); stgBufSql.append("' and "); stgBufSql.append("TD100030I "); stgBufSql.append("= "); stgBufSql.append(TD100030I); stgBufSql.append(" AND "); stgBufSql.append("TD100170C "); stgBufSql.append("= '"); stgBufSql.append("0"); stgBufSql.append("'"); stgResultSql = stgBufSql.toString(); break; case ETEX_RECOGNITION_DB_SELECT_EITD100_EX2: /* 交通費精算トランザクション検索(解除チェック) */ /* 対象社員コード*/ MD010010V = fEtexExecuteRecognitionGetcancellationChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_CODE); /* 対象年月 */ TD100020V = fEtexExecuteRecognitionGetcancellationChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_DATE); /* index */ TD100030I = Integer.parseInt( fEtexExecuteRecognitionGetcancellationChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_INDEX)); /* SQL生成 */ stgBufSql = new StringBuffer(ETEX_GENERAL_DB_SQL_BUF_100); stgBufSql.append("SELECT * FROM "); stgBufSql.append("EITD100 "); stgBufSql.append("WHERE "); stgBufSql.append("MD010010V "); stgBufSql.append("= '"); stgBufSql.append(MD010010V); stgBufSql.append("' "); stgBufSql.append("AND "); stgBufSql.append("TD100020V "); stgBufSql.append("= '"); stgBufSql.append(TD100020V); stgBufSql.append("' AND "); stgBufSql.append("TD100030I "); stgBufSql.append("= "); stgBufSql.append(TD100030I); stgBufSql.append(" AND "); stgBufSql.append("TD100170C "); stgBufSql.append("= '"); stgBufSql.append("1"); stgBufSql.append("'"); stgResultSql = stgBufSql.toString(); break; case ETEX_RECOGNITION_DB_SELECT_EIMD010_EX: /* 社員マスタ検索(社員名:退職者除く) */ /* SQL生成 */ stgBufSql = new StringBuffer(ETEX_GENERAL_DB_SQL_BUF_100); if (clsRecognitionCtlBean.getRecognitionChkRetirement()) { /* 退職者含む */ stgBufSql.append("SELECT * FROM "); stgBufSql.append("EIMD010 "); stgBufSql.append("ORDER BY "); stgBufSql.append("MD010120V "); stgBufSql.append("ASC"); } else { /* 退職者含まない */ stgBufSql.append("SELECT * FROM "); stgBufSql.append("EIMD010 "); stgBufSql.append("WHERE "); stgBufSql.append("MD010220C "); stgBufSql.append("= '0' "); stgBufSql.append("ORDER BY "); stgBufSql.append("MD010120V "); stgBufSql.append("ASC"); } stgResultSql = stgBufSql.toString(); break; case ETEX_RECOGNITION_DB_UPDATE_EITD100: /* 交通費精算トランザクション更新(承認チェック)*/ /* 更新者 */ upd_id = fEtexGeneralSessionUtilSessionGetSessionBean( clsRecognitionCtlBean.getRecognitionRequest()) .getStaffCode(); /* 精算区分 */ TD100170C = fEtexExecuteRecognitionGetChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_KUBUN); /* 対象社員コード*/ MD010010V = fEtexExecuteRecognitionGetChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_CODE); /* 年月日 */ TD100020V = fEtexExecuteRecognitionGetChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_DATE); /* index */ TD100030I = Integer.parseInt( fEtexExecuteRecognitionGetChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_INDEX)); /* SQL生成 */ stgBufSql = new StringBuffer(ETEX_GENERAL_DB_SQL_BUF_150); stgBufSql.append("UPDATE "); stgBufSql.append("EITD100 "); stgBufSql.append("SET "); stgBufSql.append("TD100170C "); stgBufSql.append("= '"); stgBufSql.append(TD100170C); stgBufSql.append("', "); stgBufSql.append("upd_id = '"); stgBufSql.append(upd_id); stgBufSql.append("', "); stgBufSql.append("upd_date = now() "); stgBufSql.append(", "); stgBufSql.append("TD100200V "); stgBufSql.append("= '"); stgBufSql.append(upd_id); stgBufSql.append("', "); stgBufSql.append("TD100210D "); stgBufSql.append("= "); stgBufSql.append("now() "); stgBufSql.append("WHERE "); stgBufSql.append("MD010010V "); stgBufSql.append("= '"); stgBufSql.append(MD010010V); stgBufSql.append("' AND "); stgBufSql.append("TD100020V "); stgBufSql.append("= '"); stgBufSql.append(TD100020V); stgBufSql.append("' AND "); stgBufSql.append("TD100030I "); stgBufSql.append("= "); stgBufSql.append(TD100030I); stgResultSql = stgBufSql.toString(); break; case ETEX_RECOGNITION_DB_UPDATE_EITD100_EX: /* 交通費精算トランザクション更新(解除チェック)*/ /* 更新者 */ upd_id = fEtexGeneralSessionUtilSessionGetSessionBean( clsRecognitionCtlBean.getRecognitionRequest()) .getStaffCode(); /* 精算区分 */ TD100170C = fEtexExecuteRecognitionGetcancellationChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_KUBUN); /* 対象社員コード*/ MD010010V = fEtexExecuteRecognitionGetcancellationChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_CODE); /* 年月日 */ TD100020V = fEtexExecuteRecognitionGetcancellationChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_DATE); /* index */ TD100030I = Integer.parseInt( fEtexExecuteRecognitionGetcancellationChkBox( Integer.parseInt(((String) objParam)), ETEX_RECOGNITION_CHKBOX_GET_INDEX)); /* SQL生成 */ stgBufSql = new StringBuffer(ETEX_GENERAL_DB_SQL_BUF_150); stgBufSql.append("UPDATE "); stgBufSql.append("EITD100 "); stgBufSql.append("SET "); stgBufSql.append("TD100170C "); stgBufSql.append("= '"); stgBufSql.append(TD100170C); stgBufSql.append("', "); stgBufSql.append("upd_id = '"); stgBufSql.append(upd_id); stgBufSql.append("', "); stgBufSql.append("upd_date = now() "); stgBufSql.append(", "); stgBufSql.append("TD100200V "); stgBufSql.append("= '"); stgBufSql.append(""); stgBufSql.append("', "); stgBufSql.append("TD100210D "); stgBufSql.append("= "); stgBufSql.append("NULL "); stgBufSql.append("WHERE "); stgBufSql.append("MD010010V "); stgBufSql.append("= '"); stgBufSql.append(MD010010V); stgBufSql.append("' AND "); stgBufSql.append("TD100020V "); stgBufSql.append("= '"); stgBufSql.append(TD100020V); stgBufSql.append("' AND "); stgBufSql.append("TD100030I "); stgBufSql.append("= "); stgBufSql.append(TD100030I); stgResultSql = stgBufSql.toString(); break; default: stgResultSql = ETEX_GENERAL_STRING_EMPTY; break; } return stgResultSql; }