package com.mcwl.communityCenter.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.constant.AdviceConstant;
import com.mcwl.communityCenter.domain.*;
import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.domain.vo.CommentVo;
import com.mcwl.communityCenter.domain.vo.PersonHomeVo;
import com.mcwl.communityCenter.domain.vo.PublishVo;
import com.mcwl.communityCenter.mapper.*;
import com.mcwl.communityCenter.service.*;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Service
@RequiredArgsConstructor
public class PublishReportServiceImpl extends ServiceImpl<PublishReportMapper, PublishReport> implements PublishReportService {


    @Override
    public void saveReport(PublishReport publishReport) {

        baseMapper.insertReport(publishReport);

    }

    @Override
    public TableDataInfo getReportList(PageDomain pageDomain) {
        Page<PublishReport> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
        baseMapper.selectPage(page, new LambdaQueryWrapper<PublishReport>());
        List<PublishReport> records = page.getRecords();
        TableDataInfo tableDataInfo = new TableDataInfo();
        tableDataInfo.setRows(records);
        tableDataInfo.setTotal(page.getTotal());
        tableDataInfo.setCode(HttpStatus.SUCCESS);
        tableDataInfo.setMsg("查询成功");
        return tableDataInfo;
    }
}
