EventServiceImpl.java
1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package vion.service.impl.monitor;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.lang.Assert;
import org.springframework.stereotype.Service;
import vion.dto.monitor.EventDTO;
import vion.mapper.monitor.EventMapper;
import vion.model.monitor.Event;
import vion.model.monitor.RAgentEvent;
import vion.service.monitor.IEventService;
import vion.vo.monitor.EventVO;
/**
* @author vion
* @date 2024/10/31
*/
@Service
@RequiredArgsConstructor
public class EventServiceImpl extends MPJBaseServiceImpl<EventMapper, Event> implements IEventService {
private final Converter converter;
@Override
public Page<EventVO> list(EventDTO dto) {
Assert.notNull(dto.getAgentUid(), "agentUid 不能为空");
Assert.notNull(dto.getMallUid(), "mallUid 不能为空");
var wrapper = new MPJLambdaWrapper<>(converter.convert(dto, Event.class))
.selectAs(Event::getName, EventVO::getName)
.selectAs(Event::getUid, EventVO::getUid)
.selectAsClass(RAgentEvent.class, EventVO.class)
.leftJoin(RAgentEvent.class, RAgentEvent::getEventUid, Event::getUid)
.orderByDesc(RAgentEvent::getUpdateTime);
return this.selectJoinListPage(Page.of(dto.getPageNum(), dto.getPageSize()), EventVO.class, wrapper);
}
}