|
@@ -14,6 +14,10 @@ import common.utils.http.MyController;
|
|
|
import common.utils.http.MyRet;
|
|
import common.utils.http.MyRet;
|
|
|
import common.utils.http.VerifyCode;
|
|
import common.utils.http.VerifyCode;
|
|
|
|
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
public class UserController extends MyController {
|
|
public class UserController extends MyController {
|
|
|
// 验证码相关的常量
|
|
// 验证码相关的常量
|
|
|
private static final long SEND_VERIFY_CODE_DELAY = 60 * 1000; // 验证码发送间隔
|
|
private static final long SEND_VERIFY_CODE_DELAY = 60 * 1000; // 验证码发送间隔
|
|
@@ -290,7 +294,7 @@ public class UserController extends MyController {
|
|
|
@Before(LoginInterceptor.class)
|
|
@Before(LoginInterceptor.class)
|
|
|
@RequiredRoleInterface({UserController.ROLE_SUPER_ADMIN})
|
|
@RequiredRoleInterface({UserController.ROLE_SUPER_ADMIN})
|
|
|
public void count() {
|
|
public void count() {
|
|
|
- renderJson(MyRet.ok("查询成功").setData(service.count()));
|
|
|
|
|
|
|
+ renderJson(MyRet.ok("查询成功").setData(service.count(null)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Before(LoginInterceptor.class)
|
|
@Before(LoginInterceptor.class)
|
|
@@ -332,7 +336,19 @@ public class UserController extends MyController {
|
|
|
// 查询条件
|
|
// 查询条件
|
|
|
String keywords = requestBodyJson.getString("keywords");
|
|
String keywords = requestBodyJson.getString("keywords");
|
|
|
|
|
|
|
|
- renderJson(MyRet.ok("查询成功").setData(service.users(pageNumberInt, pageSizeInt, keywords)));
|
|
|
|
|
|
|
+ // 最终结果封装
|
|
|
|
|
+ List<User> users = service.users(pageNumberInt, pageSizeInt, keywords);
|
|
|
|
|
+ Integer totalUsers = service.count(keywords);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> response = new HashMap<>();
|
|
|
|
|
+ response.put("list", users);
|
|
|
|
|
+ response.put("total_row", users.toArray().length);
|
|
|
|
|
+ response.put("total_page", 1 + (users.toArray().length / pageSizeInt));
|
|
|
|
|
+ response.put("page_size", pageSizeInt);
|
|
|
|
|
+ response.put("page_number", pageNumberInt);
|
|
|
|
|
+ response.put("total_user_count", totalUsers);
|
|
|
|
|
+
|
|
|
|
|
+ renderJson(MyRet.ok("查询成功").setData(response));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
/*
|