package com.yd.csf.service.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yd.csf.service.model.Salary;
import com.yd.csf.service.dao.SalaryMapper;
import com.yd.csf.service.service.ISalaryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 薪资单表 服务实现类
 * </p>
 *
 * @author zxm
 * @since 2026-05-08
 */
@Service
public class SalaryServiceImpl extends ServiceImpl<SalaryMapper, Salary> implements ISalaryService {

    @Override
    public Salary queryOne(String brokerBizId, String month,
                           String salaryBizId,Boolean isExcludeMy) {
        return this.baseMapper.selectOne(new LambdaQueryWrapper<Salary>()
                .eq(Salary::getBrokerBizId,brokerBizId)
                .eq(Salary::getMonth,month)
                .ne(isExcludeMy,Salary::getSalaryBizId,salaryBizId)
                .last(" limit 1 ")
        );
    }

    @Override
    public Salary queryOne(String salaryBizId) {
        return this.baseMapper.selectOne(new LambdaQueryWrapper<Salary>()
                .eq(Salary::getSalaryBizId,salaryBizId)
                .last(" limit 1 ")
        );
    }
}
