package com.bonus.sgzb.app.service.impl;

import com.bonus.sgzb.app.domain.LeaseUserBook;
import com.bonus.sgzb.app.mapper.LeaseUserBookMapper;
import com.bonus.sgzb.app.service.LeaseUserBookService;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class LeaseUserBookServiceImpl implements LeaseUserBookService {
    @Autowired
    private LeaseUserBookMapper mapper;

    @Override
    public List<LeaseUserBook> getLeaseUserBook(Long userId) {
        return mapper.getLeaseUserBook(userId);
    }

    @Override
    public int add(LeaseUserBook bean) {
        Long userId = SecurityUtils.getLoginUser().getUserid();
        bean.setUserId(userId);
        return mapper.add(bean);
    }

    @Override
    public int batchDel(ArrayList<Integer> ids) {
        return mapper.batchDel(ids);
    }

    @Override
    public int update(LeaseUserBook bean) {
        return mapper.update(bean);
    }
}
