package com.ruoyi.zhushi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.zhushi.entity.NjBalanceManage;
import com.ruoyi.zhushi.entity.NjBalanceManageDTO;
import com.ruoyi.zhushi.mapper.NjBalanceManageMapper;
import com.ruoyi.zhushi.service.NjBalanceManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NjBalanceManageServiceImpl implements NjBalanceManageService {

    @Autowired
    private NjBalanceManageMapper njBalanceManageMapper;

    @Override
    public TableDataInfo<NjBalanceManageDTO> queryPageList(NjBalanceManageDTO njBalanceManageDTO) {
        LambdaQueryWrapper<NjBalanceManage> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(njBalanceManageDTO.getUserName()!= null, NjBalanceManage::getUserName, njBalanceManageDTO.getUserName());
        queryWrapper.eq(njBalanceManageDTO.getNickName()!= null, NjBalanceManage::getNickName, njBalanceManageDTO.getNickName());
        List<NjBalanceManageDTO> njBalanceManageDTOS = njBalanceManageMapper.selectVoList(queryWrapper, NjBalanceManageDTO.class);
        return TableDataInfo.build(njBalanceManageDTOS);
    }
}
