package com.tofly.feesapi.mxcx.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tofly.feesapi.common.core.dto.PageDto;
import com.tofly.feesapi.common.core.vo.PageResult;
import com.tofly.feesapi.mxcx.entity.YyBgLog;
import com.tofly.feesapi.mxcx.entity.dto.YyBgLogFilter;
import com.tofly.feesapi.mxcx.entity.vo.YyBgLogSelect;
import com.tofly.feesapi.mxcx.service.YyBgLogService;

import com.tofly.feesapi.security.util.SecurityUtils;
import org.springframework.stereotype.Service;
import com.tofly.feesapi.mxcx.mapper.YyBgLogMapper;

import java.util.Date;

@Service
public class YyBgLogServiceImpl extends ServiceImpl<YyBgLogMapper, YyBgLog> implements YyBgLogService {

    @Override
    public void bglogsave(YyBgLog yyBgLog) {
        yyBgLog.setBgdate(new Date());
        yyBgLog.setBgryid(SecurityUtils.getUserId());
        yyBgLog.setBgryxm(SecurityUtils.getUser().getRealName());
        this.save(yyBgLog);
    }

    @Override
    public PageResult<YyBgLogSelect> getPage(PageDto pageDto, YyBgLogFilter filter) {
        PageDto<YyBgLogSelect> page = this.baseMapper.getPage(pageDto, filter);
        return page.toVo();
    }
}
