package com.yuchen.saas.park.service.service.property.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yuchen.saas.park.api.entity.property.PropertyDirectReductionDetail;
import com.yuchen.saas.park.api.entity.property.PropertyPayReductionDetail;
import com.yuchen.saas.park.service.mapper.property.PropertyPayReductionDetailMapper;
import com.yuchen.saas.park.service.service.property.IPropertyPayReductionDetailService;
import org.nest.springwrap.core.mp.base.BaseServiceImpl;
import org.nest.springwrap.core.tool.utils.Func;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 减免活动-缴费减免-详情 服务实现类
 * </p>
 *
 * @author cxj
 * @since 2023-12-22
 */
@Service
public class PropertyPayReductionDetailServiceImpl extends BaseServiceImpl<PropertyPayReductionDetailMapper, PropertyPayReductionDetail> implements IPropertyPayReductionDetailService {

    @Override
    public List<PropertyPayReductionDetail> listByQuery(Long feeStandardId, Long feeItemId) {
        LambdaQueryWrapper<PropertyPayReductionDetail> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(Func.isNotEmpty(feeStandardId),PropertyPayReductionDetail::getPayFeeStandardId,feeStandardId)
                .eq(Func.isNotEmpty(feeItemId),PropertyPayReductionDetail::getPayFeeItemId,feeItemId);
        return list(queryWrapper);
    }

    @Override
    public List<PropertyPayReductionDetail> listByPayReductionId(Long payReductionId) {
        LambdaQueryWrapper<PropertyPayReductionDetail> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(PropertyPayReductionDetail::getPayReductionId,payReductionId);
        return list(queryWrapper);
    }

    @Override
    public Boolean removeByPayReductionId(Long payReductionId) {
        LambdaQueryWrapper<PropertyPayReductionDetail> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(PropertyPayReductionDetail::getPayReductionId,payReductionId);
        return remove(queryWrapper);
    }
}
