mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-23 04:22:43 +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 java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -65,6 +66,8 @@ public class AdminLogController {
|
||||
String module = MapUtils.getString(params, "module");
|
||||
String title = MapUtils.getString(params, "title");
|
||||
Integer opt = MapUtils.getInteger(params, "opt");
|
||||
String startTime = MapUtils.getString(params, "start_time");
|
||||
String endTime = MapUtils.getString(params, "end_time");
|
||||
|
||||
AdminLogPaginateFiler filter = new AdminLogPaginateFiler();
|
||||
if (backendBus.isSuperAdmin()) {
|
||||
@ -75,22 +78,23 @@ public class AdminLogController {
|
||||
filter.setModule(module);
|
||||
filter.setTitle(title);
|
||||
filter.setOpt(opt);
|
||||
filter.setStartTime(startTime);
|
||||
filter.setEndTime(endTime);
|
||||
filter.setSortField(sortField);
|
||||
filter.setSortAlgo(sortAlgo);
|
||||
|
||||
PaginationResult<AdminLog> result = adminLogService.paginate(page, size, filter);
|
||||
|
||||
Map<Integer, String> adminUserMap =
|
||||
adminUserService
|
||||
.chunks(result.getData().stream().map(AdminLog::getAdminId).toList())
|
||||
.stream()
|
||||
.collect(Collectors.toMap(AdminUser::getId, AdminUser::getName));
|
||||
|
||||
if(result.getTotal() > 0){
|
||||
List<AdminUser> adminUsers = adminUserService.chunks(result.getData().stream().map(AdminLog::getAdminId).toList());
|
||||
if(null != adminUsers && adminUsers.size() > 0){
|
||||
Map<Integer, String> adminUserMap = adminUsers.stream().collect(Collectors.toMap(AdminUser::getId, AdminUser::getName));
|
||||
result.getData()
|
||||
.forEach(
|
||||
adminLog -> {
|
||||
adminLog.setAdminName(adminUserMap.get(adminLog.getAdminId()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("data", result.getData());
|
||||
|
@ -28,6 +28,10 @@ public class AdminLogPaginateFiler {
|
||||
|
||||
private Integer opt;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private String sortField;
|
||||
|
||||
private String sortAlgo;
|
||||
|
@ -43,6 +43,12 @@
|
||||
<if test="opt != null">
|
||||
AND `admin_logs`.`opt` = #{opt}
|
||||
</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>
|
||||
|
||||
<if test="sortAlgo == 'asc'">
|
||||
@ -84,6 +90,12 @@
|
||||
<if test="opt != null">
|
||||
AND `admin_logs`.`opt` = #{opt}
|
||||
</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>
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
x
Reference in New Issue
Block a user