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
|
@ShardingSphereTransactionType(TransactionType.BASE)
|
public void addNotificationBatch(List<XpOperationsUserNotification> notifications) {
|
saveBatch(notifications);
|
}
|
}
|