package com.dayou.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.dayou.common.PullDownModel;
import com.dayou.entity.BusinessCommissionRate;
import com.dayou.mapper.BusinessCommissionRateMapper;
import com.dayou.service.IBusinessCommissionRateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.dayou.utils.ExcelUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.ArrayList;
import org.springframework.transaction.annotation.Transactional;
import com.dayou.enums.BatchTaskTypeEnum;

/**
 * <p>
 * 非土规业务提成比例 服务实现类
 * </p>
 *
 * @author wucl
 * @since 2024-05-11
 */
@DS("mbs")
@Service
public class BusinessCommissionRateServiceImpl extends ServiceImpl<BusinessCommissionRateMapper, BusinessCommissionRate> implements IBusinessCommissionRateService {

    @Autowired
    private BusinessCommissionRateMapper businessCommissionRateMapper;

    @Override
    @SuppressWarnings("unchecked")
    public Page<BusinessCommissionRate> selectPage(Page page,BusinessCommissionRate businessCommissionRate){
        return businessCommissionRateMapper.page(page,businessCommissionRate);
    }


    @Override
    public BusinessCommissionRate detail(Long id){
        return this.getById(id);
    }

    @Override
    public Boolean add(BusinessCommissionRate businessCommissionRate){
        return  this.save(businessCommissionRate);
    }

    @Override
    public Boolean update(BusinessCommissionRate businessCommissionRate){
        return  this.updateById(businessCommissionRate);
    }

    @Override
    public Boolean delete(Long id){
        //逻辑删除
        return this.removeById(id);
    }

    @Override
    public List<PullDownModel> getBusinessCate(String businessType, String userType) {
        List<PullDownModel> cate = businessCommissionRateMapper.getBusinessCate(businessType,userType);
        return cate;
    }
}
