src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt

changeset 175
1e6f2aace666
parent 167
3f30adba1c63
child 176
4da5b783aa2d
     1.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Mon Jan 04 15:14:26 2021 +0100
     1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Mon Jan 04 15:25:59 2021 +0100
     1.3 @@ -338,6 +338,7 @@
     1.4                  yield(Project(rs.getInt("projectid")).apply {
     1.5                      name = rs.getString("name")
     1.6                      node = rs.getString("node")
     1.7 +                    ordinal = rs.getInt("ordinal")
     1.8                      description = rs.getString("description")
     1.9                      repoUrl = rs.getString("repourl")
    1.10                      owner = selectUserInfo(rs)
    1.11 @@ -350,17 +351,18 @@
    1.12          with(obj) {
    1.13              stmt.setStringSafe(1, name)
    1.14              stmt.setStringSafe(2, node)
    1.15 -            stmt.setStringOrNull(3, description)
    1.16 -            stmt.setStringOrNull(4, repoUrl)
    1.17 -            stmt.setIntOrNull(5, owner?.id)
    1.18 +            stmt.setInt(3, ordinal)
    1.19 +            stmt.setStringOrNull(4, description)
    1.20 +            stmt.setStringOrNull(5, repoUrl)
    1.21 +            stmt.setIntOrNull(6, owner?.id)
    1.22          }
    1.23 -        return 6
    1.24 +        return 7
    1.25      }
    1.26  
    1.27      //language=SQL
    1.28      private val projectQuery =
    1.29          """
    1.30 -        select projectid, name, node, description, repourl,
    1.31 +        select projectid, name, node, ordinal, description, repourl,
    1.32              userid, username, lastname, givenname, mail
    1.33          from lpit_project
    1.34          left join lpit_user owner on lpit_project.owner = owner.userid
    1.35 @@ -369,7 +371,7 @@
    1.36      private val stmtProjects by lazy {
    1.37          connection.prepareStatement(
    1.38              """${projectQuery}
    1.39 -            order by lower(name)
    1.40 +            order by ordinal, lower(name)
    1.41              """
    1.42          )
    1.43      }
    1.44 @@ -389,12 +391,12 @@
    1.45      }
    1.46      private val stmtInsertProject by lazy {
    1.47          connection.prepareStatement(
    1.48 -            "insert into lpit_project (name, node, description, repourl, owner) values (?, ?, ?, ?, ?)"
    1.49 +            "insert into lpit_project (name, node, ordinal, description, repourl, owner) values (?, ?, ?, ?, ?, ?)"
    1.50          )
    1.51      }
    1.52      private val stmtUpdateProject by lazy {
    1.53          connection.prepareStatement(
    1.54 -            "update lpit_project set name = ?, node = ?, description = ?, repourl = ?, owner = ? where projectid = ?"
    1.55 +            "update lpit_project set name = ?, node = ?, ordinal = ?, description = ?, repourl = ?, owner = ? where projectid = ?"
    1.56          )
    1.57      }
    1.58      private val stmtIssueSummary by lazy {

mercurial