package io.renren.modules.admin.service.impl;

import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.admin.dao.MoneyAccountDao;
import io.renren.modules.admin.entity.MoneyAccountEntity;
import io.renren.modules.admin.service.MoneyAccountService;


@Service("moneyAccountService")
public class MoneyAccountServiceImpl extends ServiceImpl<MoneyAccountDao, MoneyAccountEntity> implements MoneyAccountService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MoneyAccountEntity> page = this.page(
                new Query<MoneyAccountEntity>().getPage(params),
                new QueryWrapper<MoneyAccountEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public MoneyAccountEntity getOneByMeetingId(Long meetingId) {
        MoneyAccountEntity moneyAccount = this.getOne(new QueryWrapper<MoneyAccountEntity>().eq("meeting_id", meetingId));
        return moneyAccount;
    }

    @Override
    public Integer addOrUpdate(Long meeting_id, String name, String bank, String account, Date create_time){
        return baseMapper.addOrUpdate(meeting_id, name, bank, account, create_time);
    }
}
