mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-22 20:02:42 +08:00
管理员日志条件查询
This commit is contained in:
parent
c6eef3477e
commit
935ee6a500
@ -38,6 +38,7 @@ import xyz.playedu.api.types.paginate.AdminLogPaginateFiler;
|
|||||||
import xyz.playedu.api.types.paginate.PaginationResult;
|
import xyz.playedu.api.types.paginate.PaginationResult;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -65,6 +66,8 @@ public class AdminLogController {
|
|||||||
String module = MapUtils.getString(params, "module");
|
String module = MapUtils.getString(params, "module");
|
||||||
String title = MapUtils.getString(params, "title");
|
String title = MapUtils.getString(params, "title");
|
||||||
Integer opt = MapUtils.getInteger(params, "opt");
|
Integer opt = MapUtils.getInteger(params, "opt");
|
||||||
|
String startTime = MapUtils.getString(params, "start_time");
|
||||||
|
String endTime = MapUtils.getString(params, "end_time");
|
||||||
|
|
||||||
AdminLogPaginateFiler filter = new AdminLogPaginateFiler();
|
AdminLogPaginateFiler filter = new AdminLogPaginateFiler();
|
||||||
if (backendBus.isSuperAdmin()) {
|
if (backendBus.isSuperAdmin()) {
|
||||||
@ -75,22 +78,23 @@ public class AdminLogController {
|
|||||||
filter.setModule(module);
|
filter.setModule(module);
|
||||||
filter.setTitle(title);
|
filter.setTitle(title);
|
||||||
filter.setOpt(opt);
|
filter.setOpt(opt);
|
||||||
|
filter.setStartTime(startTime);
|
||||||
|
filter.setEndTime(endTime);
|
||||||
filter.setSortField(sortField);
|
filter.setSortField(sortField);
|
||||||
filter.setSortAlgo(sortAlgo);
|
filter.setSortAlgo(sortAlgo);
|
||||||
|
|
||||||
PaginationResult<AdminLog> result = adminLogService.paginate(page, size, filter);
|
PaginationResult<AdminLog> result = adminLogService.paginate(page, size, filter);
|
||||||
|
if(result.getTotal() > 0){
|
||||||
Map<Integer, String> adminUserMap =
|
List<AdminUser> adminUsers = adminUserService.chunks(result.getData().stream().map(AdminLog::getAdminId).toList());
|
||||||
adminUserService
|
if(null != adminUsers && adminUsers.size() > 0){
|
||||||
.chunks(result.getData().stream().map(AdminLog::getAdminId).toList())
|
Map<Integer, String> adminUserMap = adminUsers.stream().collect(Collectors.toMap(AdminUser::getId, AdminUser::getName));
|
||||||
.stream()
|
result.getData()
|
||||||
.collect(Collectors.toMap(AdminUser::getId, AdminUser::getName));
|
.forEach(
|
||||||
|
adminLog -> {
|
||||||
result.getData()
|
adminLog.setAdminName(adminUserMap.get(adminLog.getAdminId()));
|
||||||
.forEach(
|
});
|
||||||
adminLog -> {
|
}
|
||||||
adminLog.setAdminName(adminUserMap.get(adminLog.getAdminId()));
|
}
|
||||||
});
|
|
||||||
|
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
data.put("data", result.getData());
|
data.put("data", result.getData());
|
||||||
|
@ -28,6 +28,10 @@ public class AdminLogPaginateFiler {
|
|||||||
|
|
||||||
private Integer opt;
|
private Integer opt;
|
||||||
|
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
private String sortField;
|
private String sortField;
|
||||||
|
|
||||||
private String sortAlgo;
|
private String sortAlgo;
|
||||||
|
@ -43,6 +43,12 @@
|
|||||||
<if test="opt != null">
|
<if test="opt != null">
|
||||||
AND `admin_logs`.`opt` = #{opt}
|
AND `admin_logs`.`opt` = #{opt}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
AND `admin_logs`.`created_at` >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
AND `admin_logs`.`created_at` <= #{endTime}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
<if test="sortAlgo == 'asc'">
|
<if test="sortAlgo == 'asc'">
|
||||||
@ -84,6 +90,12 @@
|
|||||||
<if test="opt != null">
|
<if test="opt != null">
|
||||||
AND `admin_logs`.`opt` = #{opt}
|
AND `admin_logs`.`opt` = #{opt}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
AND `admin_logs`.`created_at` >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
AND `admin_logs`.`created_at` <= #{endTime}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user