“mitao”
2026-02-27 3dabf06adcd45efa168b2c00c122b98e589550a4
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
56
57
package com.xiaopeng.account.service.impl;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaopeng.account.mapper.XpOperationsUserNotificationMapper;
import com.xiaopeng.account.model.query.XpOperationsUserNotificationPageQuery;
import com.xiaopeng.account.service.IXpOperationsUserNotificationService;
import com.xiaopeng.api.model.account.XpOperationsUserNotification;
import com.xiaopeng.common.core.web.page.PageInfo;
import org.apache.shardingsphere.transaction.annotation.ShardingSphereTransactionType;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
/**
 * <p>
 * 运维人员消息通知表 服务实现类
 * </p>
 *
 * @author mitao
 * @since 2026-02-03
 */
@Service
public class XpOperationsUserNotificationServiceImpl extends ServiceImpl<XpOperationsUserNotificationMapper, XpOperationsUserNotification> implements IXpOperationsUserNotificationService {
 
    @Override
    public PageInfo<XpOperationsUserNotification> selectNotificationPageByUserId(
            XpOperationsUserNotificationPageQuery query) {
 
        // 创建分页对象
        Page<XpOperationsUserNotification> page = new Page<>(
            query.getPageNum(),
            query.getPageSize()
        );
 
        // 执行分页查询
        Page<XpOperationsUserNotification> resultPage = baseMapper.selectNotificationPageByUserId(
            page,
            query
        );
 
        // 封装分页结果
        PageInfo<XpOperationsUserNotification> pageInfo = new PageInfo<>();
        pageInfo.setRecords(resultPage.getRecords());
        pageInfo.setTotal(resultPage.getTotal());
 
        return pageInfo;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    @ShardingSphereTransactionType(TransactionType.BASE)
    public void addNotificationBatch(List<XpOperationsUserNotification> notifications) {
        saveBatch(notifications);
    }
}