Showing
4 changed files
with
109 additions
and
0 deletions
| 1 | +package com.wondertek.controller; | ||
| 2 | + | ||
| 3 | +import com.wondertek.dto.OperationLogDto; | ||
| 4 | +import com.wondertek.service.OperationLogService; | ||
| 5 | +import com.wondertek.util.PageBean; | ||
| 6 | +import jakarta.annotation.Resource; | ||
| 7 | +import lombok.extern.slf4j.Slf4j; | ||
| 8 | +import org.apache.ibatis.annotations.Param; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @Description: 日志管理 | ||
| 15 | + * @Author W5669 | ||
| 16 | + * @Create 2025/8/14 | ||
| 17 | + * @Version 1.0 | ||
| 18 | + */ | ||
| 19 | +@Slf4j | ||
| 20 | +@RestController | ||
| 21 | +@RequestMapping("/operation/log") | ||
| 22 | +public class OperationLogController { | ||
| 23 | + | ||
| 24 | + @Resource | ||
| 25 | + private OperationLogService operationLogService; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * @Description: 分页查询 | ||
| 29 | + * @Author W5669 | ||
| 30 | + * @Create 2025/8/14 | ||
| 31 | + * @Version 1.0 | ||
| 32 | + */ | ||
| 33 | + @RequestMapping("/pageList") | ||
| 34 | + public PageBean pageList(OperationLogDto dto) { | ||
| 35 | + | ||
| 36 | + return operationLogService.pageList(dto); | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | +} |
| 1 | +package com.wondertek.dto; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @Description: 日志查询参数 | ||
| 8 | + * @Author W5669 | ||
| 9 | + * @Create 2025/8/14 | ||
| 10 | + * @Version 1.0 | ||
| 11 | + */ | ||
| 12 | +@Data | ||
| 13 | +public class OperationLogDto { | ||
| 14 | + private String roomId; | ||
| 15 | + private Integer page=1; | ||
| 16 | + private Integer size=10; | ||
| 17 | +} |
| 1 | +package com.wondertek.service; | ||
| 2 | + | ||
| 3 | +import com.wondertek.dto.OperationLogDto; | ||
| 4 | +import com.wondertek.entity.OperationLog; | ||
| 5 | +import com.wondertek.util.PageBean; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Description: | ||
| 9 | + * @Author W5669 | ||
| 10 | + * @Create 2025/8/14 | ||
| 11 | + * @Version 1.0 | ||
| 12 | + */ | ||
| 13 | +public interface OperationLogService { | ||
| 14 | + PageBean pageList(OperationLogDto operationLogDto); | ||
| 15 | +} |
| 1 | +package com.wondertek.service.impl; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 5 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
| 6 | +import com.wondertek.dto.OperationLogDto; | ||
| 7 | +import com.wondertek.entity.OperationLog; | ||
| 8 | +import com.wondertek.mapper.OperationLogMapper; | ||
| 9 | +import com.wondertek.service.OperationLogService; | ||
| 10 | +import com.wondertek.util.PageBean; | ||
| 11 | +import jakarta.annotation.Resource; | ||
| 12 | +import org.springframework.stereotype.Service; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @Description: TODO | ||
| 16 | + * @Author W5669 | ||
| 17 | + * @Create 2025/8/14 | ||
| 18 | + * @Version 1.0 | ||
| 19 | + */ | ||
| 20 | +@Service | ||
| 21 | +public class OperationLogServiceImpl implements OperationLogService { | ||
| 22 | + @Resource | ||
| 23 | + private OperationLogMapper operationLogMapper; | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public PageBean pageList(OperationLogDto operationLogDto) { | ||
| 27 | + Integer page = operationLogDto.getPage(); | ||
| 28 | + Integer size = operationLogDto.getSize(); | ||
| 29 | + LambdaQueryWrapper<OperationLog> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 30 | + queryWrapper.eq(OperationLog::getBusinessType,"cloudMonitor") | ||
| 31 | + .eq(OperationLog::getBusinesId,operationLogDto.getRoomId()) | ||
| 32 | + .orderByDesc(OperationLog::getCreatedTime); | ||
| 33 | + Page<OperationLog> pageInfo = new Page<>(page, size); | ||
| 34 | + IPage<OperationLog> resultPage = operationLogMapper.selectPage(pageInfo, queryWrapper); | ||
| 35 | + return new PageBean(Integer.parseInt(String.valueOf(resultPage.getPages())),resultPage.getTotal(),resultPage.getRecords()); | ||
| 36 | + | ||
| 37 | + } | ||
| 38 | +} |
-
Please register or login to post a comment