package com.fs.crm.mapper;

import com.fs.crm.domain.CrmCustomerLogs;
import com.fs.crm.param.CrmCustomerLogsListQueryParam;
import com.fs.crm.vo.CrmCustomerLogsListQueryVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 客户日志Mapper接口
 *
 * @author fs
 * @date 2022-12-21
 */
public interface CrmCustomerLogsMapper
{
    /**
     * 查询客户日志
     *
     * @param logsId 客户日志ID
     * @return 客户日志
     */
    public CrmCustomerLogs selectCrmCustomerLogsById(Long logsId);

    /**
     * 查询客户日志列表
     *
     * @param crmCustomerLogs 客户日志
     * @return 客户日志集合
     */
    public List<CrmCustomerLogs> selectCrmCustomerLogsList(CrmCustomerLogs crmCustomerLogs);

    /**
     * 新增客户日志
     *
     * @param crmCustomerLogs 客户日志
     * @return 结果
     */
    public int insertCrmCustomerLogs(CrmCustomerLogs crmCustomerLogs);

    /**
     * 修改客户日志
     *
     * @param crmCustomerLogs 客户日志
     * @return 结果
     */
    public int updateCrmCustomerLogs(CrmCustomerLogs crmCustomerLogs);

    /**
     * 删除客户日志
     *
     * @param logsId 客户日志ID
     * @return 结果
     */
    public int deleteCrmCustomerLogsById(Long logsId);

    /**
     * 批量删除客户日志
     *
     * @param logsIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteCrmCustomerLogsByIds(Long[] logsIds);
    @Select({"<script> " +
            "select l.* from crm_customer_logs l " +
            "where 1=1 " +
            "<if test = 'maps.customerId != null     '> " +
            "and l.customer_id =#{maps.customerId} " +
            "</if>" +
            " order by l.logs_id desc "+
            "</script>"})
    List<CrmCustomerLogsListQueryVO> selectCrmCustomerLogsListQuery(@Param("maps") CrmCustomerLogsListQueryParam param);
}
