package com.dayou.service.impl;

import com.dayou.entity.BrokeragePostRatio;
import com.dayou.exception.ErrorCode;
import com.dayou.mapper.BrokeragePostRatioMapper;
import com.dayou.service.IBrokeragePostRatioService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dayou.vo.PostRatioVO;
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.math.BigDecimal;
import java.util.List;
import java.util.ArrayList;
import java.util.regex.Pattern;

import org.springframework.transaction.annotation.Transactional;
import com.dayou.enums.BatchTaskTypeEnum;

import static com.dayou.common.Constants.MATH_REGULAR;

/**
 * <p>
 * 领导岗位抽成率 服务实现类
 * </p>
 *
 * @author wucl
 * @since 2023-03-10
 */
@Service
public class BrokeragePostRatioServiceImpl extends ServiceImpl<BrokeragePostRatioMapper, BrokeragePostRatio> implements IBrokeragePostRatioService {


    @Autowired
    private BrokeragePostRatioMapper postRatioMapper;

    @Override
    @SuppressWarnings("unchecked")
    public Page<PostRatioVO> selectPage(Page page, PostRatioVO postRatioVO){
        Page<PostRatioVO> xPage = postRatioMapper.page(page,postRatioVO);
        return xPage;
    }


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

    @Override
    public Boolean add(BrokeragePostRatio brokeragePostRatio){
        return  this.save(brokeragePostRatio);
    }

    @Override
    public Boolean update(BrokeragePostRatio brokeragePostRatio){
        return  this.saveOrUpdate(brokeragePostRatio);
    }

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