MAccountServiceImpl.java
1.84 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package vion.service.impl.monitor;
import com.github.yulichang.base.MPJBaseServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import vion.mapper.monitor.MAccountMapper;
import vion.model.monitor.MAccount;
import vion.model.monitor.RAccountEvent;
import vion.model.monitor.RUserAccount;
import vion.service.monitor.IMAccountService;
import vion.service.monitor.IRAccountEventService;
import vion.service.monitor.IRUserAccountService;
import java.util.List;
/**
* @author vion
* @date 2024/10/31
*/
@Service
@RequiredArgsConstructor
public class MAccountServiceImpl extends MPJBaseServiceImpl<MAccountMapper, MAccount> implements IMAccountService {
private final IRAccountEventService accountEventService;
private final IRUserAccountService userAccountService;
@Override
public List<RAccountEvent> getEventById(String uid) {
return accountEventService.lambdaQuery().eq(RAccountEvent::getAccountUid, uid).list();
}
@Override
public String saveEvent(String agentUid, String uid, RAccountEvent event) {
event.setAgentUid(agentUid);
event.setAccountUid(uid);
return accountEventService.save(event) ? "成功" : "失败";
}
@Override
public List<RUserAccount> subList(Long userId) {
return userAccountService.lambdaQuery().eq(RUserAccount::getUserId, userId).list();
}
@Override
public String sub(RUserAccount userAccount) {
return userAccountService.save(userAccount) ? "订阅成功" : "订阅失败";
}
@Override
public String unsub(RUserAccount userAccount) {
return userAccountService.lambdaUpdate()
.eq(RUserAccount::getAccountId, userAccount.getAccountId())
.eq(RUserAccount::getUserId, userAccount.getUserId()).remove() ? "取消订阅成功" : "取消订阅失败";
}
}