Skip to content

Commit

Permalink
fix logical delete method
Browse files Browse the repository at this point in the history
  • Loading branch information
koda-masaru committed May 17, 2016
1 parent 1d4ccd9 commit faf0571
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ private void writeDeleteOnUser(PrintWriter pw) {
pw.print(helper.feildNameToSetter(feildName));
pw.print("(");
if (StringUtils.isNotEmpty(config.getDeleteFlagColumnType()) && "boolean".equals(config.getDeleteFlagColumnType().toLowerCase())) {
pw.print("Boolean.FALSE");
pw.print("Boolean.TRUE");
} else {
pw.print(INT_FLAG.OFF.getValue());
pw.print(INT_FLAG.ON.getValue());
}
pw.println(");");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,15 +472,17 @@ private void createSelectAllSqlFile() {
PrintWriter pw = null;
try {
pw = helper.getPrintWriter(sqlFile);
pw.println("SELECT * FROM " + config.getTableDefinition().getTable_name().toUpperCase() + "");
pw.print("SELECT * FROM " + config.getTableDefinition().getTable_name().toUpperCase() + "");
if (StringUtils.isNotEmpty(config.getCommonDeleteFlag())) {
pw.print("\n");
pw.print("WHERE ");
pw.print(config.getCommonDeleteFlag());
pw.print(" = ");
pw.print(INT_FLAG.OFF.getValue());
}
if (datetimeColumn != null) {
pw.println("ORDER BY " + datetimeColumn.getColumn_name() + " DESC");
pw.print("\n");
pw.print("ORDER BY " + datetimeColumn.getColumn_name() + " DESC");
}
pw.println(";");
pw.flush();
Expand All @@ -495,17 +497,19 @@ private void createSelectAllSqlFile() {
log.info(sqlFile.getAbsolutePath() + "を作成します");
try {
pw = helper.getPrintWriter(sqlFile);
pw.println("SELECT * FROM " + config.getTableDefinition().getTable_name().toUpperCase() + "");
pw.print("SELECT * FROM " + config.getTableDefinition().getTable_name().toUpperCase() + "");
if (StringUtils.isNotEmpty(config.getCommonDeleteFlag())) {
pw.print("\n");
pw.print("WHERE ");
pw.print(config.getCommonDeleteFlag());
pw.print(" = ");
pw.print(INT_FLAG.OFF.getValue());
pw.print("\n");
}
if (datetimeColumn != null) {
pw.println("ORDER BY " + datetimeColumn.getColumn_name() + " DESC");
pw.print("\n");
pw.print("ORDER BY " + datetimeColumn.getColumn_name() + " DESC");
}
pw.print("\n");
pw.println("LIMIT ? OFFSET ?;");
pw.flush();
} finally {
Expand Down Expand Up @@ -558,8 +562,9 @@ private void createPhysicalSelectAllSqlFile() {
PrintWriter pw = null;
try {
pw = helper.getPrintWriter(sqlFile);
pw.println("SELECT * FROM " + config.getTableDefinition().getTable_name().toUpperCase() + "");
pw.print("SELECT * FROM " + config.getTableDefinition().getTable_name().toUpperCase() + "");
if (datetimeColumn != null) {
pw.print("\n");
pw.print("ORDER BY " + datetimeColumn.getColumn_name() + " DESC");
}
pw.println(";");
Expand All @@ -575,10 +580,12 @@ private void createPhysicalSelectAllSqlFile() {
log.info(sqlFile.getAbsolutePath() + "を作成します");
try {
pw = helper.getPrintWriter(sqlFile);
pw.println("SELECT * FROM " + config.getTableDefinition().getTable_name().toUpperCase());
pw.print("SELECT * FROM " + config.getTableDefinition().getTable_name().toUpperCase());
if (datetimeColumn != null) {
pw.println("ORDER BY " + datetimeColumn.getColumn_name() + " DESC");
pw.print("\n");
pw.print("ORDER BY " + datetimeColumn.getColumn_name() + " DESC");
}
pw.print("\n");
pw.println("LIMIT ? OFFSET ?;");
pw.flush();
} finally {
Expand Down

0 comments on commit faf0571

Please sign in to comment.