package com.crm.manager.dao.mapper;

import com.crm.rely.backend.core.entity.sales.SalesCommissionManualListEntity;
import com.crm.rely.backend.core.pojo.table.SalesCommissionManualTable;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface SalesCommissionManualMapper {

    @Select("select * from sales_commission_manual where id=#{id}")
    SalesCommissionManualTable findOne(@Param("id") Long id);

    @Delete("delete from sales_commission_manual where id=#{id}")
    void removeById(@Param("id") Long id);

    void save(SalesCommissionManualTable table);

    void updateById(SalesCommissionManualTable table);

    Integer countSearch(SalesCommissionManualListEntity entity);

    List<SalesCommissionManualTable> listSearch(SalesCommissionManualListEntity entity);

    @Select("select count(id) from sales_commission_manual where sales_id=#{salesId} and ym=#{ym}")
    Integer countBySalesIdAndYm(@Param("salesId") Long salesId, @Param("ym") String ym);

}
