package cn.iocoder.yudao.module.asset.dal.mysql.contract;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.asset.dal.dataobject.contract.ContractAttachmentDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 合同附件 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ContractAttachmentMapper extends BaseMapperX<ContractAttachmentDO> {

    default List<ContractAttachmentDO> selectListByContractId(Long contractId) {
        return selectList(new LambdaQueryWrapperX<ContractAttachmentDO>()
                .eq(ContractAttachmentDO::getContractId, contractId)
                .orderByAsc(ContractAttachmentDO::getId));
    }

    default int deleteByContractId(Long contractId) {
        return delete(new LambdaQueryWrapperX<ContractAttachmentDO>()
                .eq(ContractAttachmentDO::getContractId, contractId));
    }

}
