package com.fs.crm.mapper;

import java.util.List;
import com.fs.crm.domain.CrmCustomerContacts;
import com.fs.crm.param.CrmCustomerContactsListQueryParam;
import com.fs.crm.vo.CrmCustomerContactsListQueryVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 客户联系人Mapper接口
 * 
 * @author fs
 * @date 2023-03-14
 */
public interface CrmCustomerContactsMapper 
{
    /**
     * 查询客户联系人
     * 
     * @param contactsId 客户联系人ID
     * @return 客户联系人
     */
    public CrmCustomerContacts selectCrmCustomerContactsById(Long contactsId);

    /**
     * 查询客户联系人列表
     * 
     * @param crmCustomerContacts 客户联系人
     * @return 客户联系人集合
     */
    public List<CrmCustomerContacts> selectCrmCustomerContactsList(CrmCustomerContacts crmCustomerContacts);

    /**
     * 新增客户联系人
     * 
     * @param crmCustomerContacts 客户联系人
     * @return 结果
     */
    public int insertCrmCustomerContacts(CrmCustomerContacts crmCustomerContacts);

    /**
     * 修改客户联系人
     * 
     * @param crmCustomerContacts 客户联系人
     * @return 结果
     */
    public int updateCrmCustomerContacts(CrmCustomerContacts crmCustomerContacts);

    /**
     * 删除客户联系人
     * 
     * @param contactsId 客户联系人ID
     * @return 结果
     */
    public int deleteCrmCustomerContactsById(Long contactsId);

    /**
     * 批量删除客户联系人
     * 
     * @param contactsIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteCrmCustomerContactsByIds(Long[] contactsIds);
    @Select({"<script> " +
            "select * from crm_customer_contacts   " +
            "where 1=1 " +
            "<if test = 'maps.customerId != null     '> " +
            "and customer_id =#{maps.customerId} " +
            "</if>" +
            "<if test = 'maps.companyId != null     '> " +
            "and company_id =#{maps.companyId} " +
            "</if>" +
            " order by contacts_id desc "+
            "</script>"})
    List<CrmCustomerContactsListQueryVO> selectCrmCustomerContactsListQuery(@Param("maps") CrmCustomerContactsListQueryParam param);
}
