From 9df1c87947f342c14df5b5585ac239ff60857f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A0=20Gia=20K=C3=ADnh?= Date: Fri, 11 Mar 2022 01:03:26 +0700 Subject: [PATCH] add search first name and last name user --- src/java/dal/auth/UserDBContext.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/java/dal/auth/UserDBContext.java b/src/java/dal/auth/UserDBContext.java index 7f0c864..8047b74 100644 --- a/src/java/dal/auth/UserDBContext.java +++ b/src/java/dal/auth/UserDBContext.java @@ -189,7 +189,7 @@ public ArrayList findUsers(String value, int pageIndex, int pageSize) { + "ON [user_per].[userId] = [user].[id]\n" + "INNER JOIN [permission]\n" + "ON [permission].[id] = [user_per].[permissionId]\n" - + " WHERE LOWER([user].[username]) LIKE LOWER(?) or LOWER([user].[email]) LIKE LOWER(?) or LOWER([user].[phone]) LIKE LOWER(?)) [user]\n" + + " WHERE LOWER([user].[username]) LIKE LOWER(?) or LOWER([user].[email]) LIKE LOWER(?) or LOWER([user].[phone]) LIKE LOWER(?) or LOWER([user].[first_name]) LIKE LOWER(?) or LOWER([user].[last_name]) LIKE LOWER(?)) [user]\n" + "WHERE row_index >= (? - 1) * ? + 1 AND row_index <= ? * ?"; PreparedStatement statement = null; try { @@ -197,11 +197,13 @@ public ArrayList findUsers(String value, int pageIndex, int pageSize) { statement.setString(1, "%" + value + "%"); statement.setString(2, "%" + value + "%"); statement.setString(3, "%" + value + "%"); + statement.setString(4, "%" + value + "%"); + statement.setString(5, "%" + value + "%"); - statement.setInt(4, pageIndex); - statement.setInt(5, pageSize); statement.setInt(6, pageIndex); statement.setInt(7, pageSize); + statement.setInt(8, pageIndex); + statement.setInt(9, pageSize); ResultSet result = statement.executeQuery(); while (result.next()) { User user = new User();