package cn.iocoder.yudao.module.iot.dal.mysql.formula;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.iot.dal.dataobject.formula.FormulaDetailDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 计算公式明细 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface FormulaDetailMapper extends BaseMapperX<FormulaDetailDO> {

    default PageResult<FormulaDetailDO> selectPage(PageParam reqVO, Long formulaId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FormulaDetailDO>()
                .eq(FormulaDetailDO::getFormulaId, formulaId)
                .orderByDesc(FormulaDetailDO::getId));
    }

    default int deleteByFormulaId(Long formulaId) {
        return delete(FormulaDetailDO::getFormulaId, formulaId);
    }

}