diff -r a7e543ab0c5f -r e2aa673dd473 src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java --- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java Thu Oct 22 12:00:34 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java Thu Oct 22 13:03:26 2020 +0200 @@ -48,43 +48,29 @@ private final PreparedStatement insertComment, updateComment, listComments; public PGIssueDao(Connection connection) throws SQLException { - list = connection.prepareStatement( - "select issueid, i.project, p.name as projectname, component, c.name as componentname, " + + final var query = "select issueid, i.project, p.name as projectname, p.node as projectnode, "+ + "component, c.name as componentname, c.node as componentnode, " + "status, category, subject, i.description, " + "userid, username, givenname, lastname, mail, " + "created, updated, eta " + "from lpit_issue i " + "join lpit_project p on i.project = projectid " + "left join lpit_component c on component = c.id " + - "left join lpit_user on userid = assignee " + + "left join lpit_user on userid = assignee "; + + list = connection.prepareStatement(query + "where i.project = ? and coalesce(component, -1) = coalesce(?, component, -1)"); listForVersion = connection.prepareStatement( "with issue_version as ( "+ "select issueid, versionid from lpit_issue_affected_version union "+ "select issueid, versionid from lpit_issue_resolved_version) "+ - "select issueid, i.project, p.name as projectname, component, c.name as componentname, " + - "status, category, subject, i.description, " + - "userid, username, givenname, lastname, mail, " + - "created, updated, eta " + - "from lpit_issue i " + - "join lpit_project p on i.project = projectid " + - "left join lpit_component c on component = c.id " + + query + "left join issue_version using (issueid) "+ - "left join lpit_user on userid = assignee " + "where coalesce(versionid,-1) = ? and coalesce(component, -1) = coalesce(?, component, -1)" ); - find = connection.prepareStatement( - "select issueid, i.project, p.name as projectname, component, c.name as componentname, " + - "status, category, subject, i.description, " + - "userid, username, givenname, lastname, mail, " + - "created, updated, eta " + - "from lpit_issue i " + - "join lpit_project p on i.project = projectid " + - "left join lpit_component c on component = c.id " + - "left join lpit_user on userid = assignee " + - "where issueid = ? "); + find = connection.prepareStatement(query + "where issueid = ? "); insert = connection.prepareStatement( "insert into lpit_issue (project, component, status, category, subject, description, assignee, eta) " + @@ -128,11 +114,13 @@ private Issue mapColumns(ResultSet result) throws SQLException { final var project = new Project(result.getInt("project")); project.setName(result.getString("projectname")); + project.setNode(result.getString("projectnode")); var component = new Component(result.getInt("component")); if (result.wasNull()) { component = null; } else { component.setName(result.getString("componentname")); + component.setNode(result.getString("componentnode")); } final var issue = new Issue(result.getInt("issueid")); issue.setProject(project);