Skip to content

Commit

Permalink
sort for all other find functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thanhleviet committed Dec 13, 2024
1 parent 3033299 commit a03a1e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/cloudgene/mapred/database/JobDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public List<AbstractJob> findAllByUser(User user) {
sql.append("select * ");
sql.append("from job ");
sql.append("where user_id = ? and state != ? ");
sql.append("order by id desc ");
sql.append("order by submitted_on desc ");

Object[] params = new Object[2];
params[0] = user.getId();
Expand Down Expand Up @@ -260,7 +260,7 @@ public List<AbstractJob> findAllNotRetiredJobs() {
sql.append("from job ");
sql.append("join `user` on job.user_id = `user`.id ");
sql.append("where state not in (?,?,?,?,?,?,?) ");
sql.append("order by job.id desc ");
sql.append("order by job.submitted_on desc ");

List<AbstractJob> result = new Vector<AbstractJob>();

Expand Down Expand Up @@ -294,7 +294,7 @@ public List<AbstractJob> findAllNotNotifiedJobs() {
sql.append("from job ");
sql.append("join `user` on job.user_id = `user`.id ");
sql.append("where state != ? AND state != ? AND state != ? AND state != ? ");
sql.append("order by job.id desc ");
sql.append("order by job.submitted_on desc ");

List<AbstractJob> result = new Vector<AbstractJob>();

Expand Down Expand Up @@ -325,7 +325,7 @@ public List<AbstractJob> findAllNotifiedJobs() {
sql.append("from job ");
sql.append("join `user` on job.user_id = `user`.id ");
sql.append("where state = ? or state = ? ");
sql.append("order by job.id desc ");
sql.append("order by job.submitted_on desc ");

Object[] params = new Object[2];
params[0] = AbstractJob.STATE_SUCESS_AND_NOTIFICATION_SEND;
Expand Down Expand Up @@ -354,7 +354,7 @@ public List<AbstractJob> findAllOlderThan(long time, int state) {
sql.append("from job ");
sql.append("join `user` on job.user_id = `user`.id ");
sql.append("where state = ? AND finished_on != 0 AND finished_on < ? ");
sql.append("order by job.id desc ");
sql.append("order by job.submitted_on desc ");

Object[] params = new Object[2];
params[0] = state;
Expand Down Expand Up @@ -383,7 +383,7 @@ public List<AbstractJob> findAllByState(int state) {
sql.append("from job ");
sql.append("join `user` on job.user_id = `user`.id ");
sql.append("where state = ? ");
sql.append("order by job.id desc ");
sql.append("order by job.submitted_on desc ");

Object[] params = new Object[1];
params[0] = state;
Expand Down

0 comments on commit a03a1e6

Please sign in to comment.