package com.fs.company.mapper;

import java.util.List;
import com.fs.company.domain.CompanyVoicePackageOrder;
import com.fs.company.param.CompanyVoicePackageOrderListParam;
import com.fs.company.vo.CompanyVoicePackageOrderListVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 套餐订单Mapper接口
 * 
 * @author fs
 * @date 2023-02-23
 */
public interface CompanyVoicePackageOrderMapper 
{
    /**
     * 查询套餐订单
     * 
     * @param orderId 套餐订单ID
     * @return 套餐订单
     */
    public CompanyVoicePackageOrder selectCompanyVoicePackageOrderById(Long orderId);

    /**
     * 查询套餐订单列表
     * 
     * @param companyVoicePackageOrder 套餐订单
     * @return 套餐订单集合
     */
    public List<CompanyVoicePackageOrder> selectCompanyVoicePackageOrderList(CompanyVoicePackageOrder companyVoicePackageOrder);

    /**
     * 新增套餐订单
     * 
     * @param companyVoicePackageOrder 套餐订单
     * @return 结果
     */
    public int insertCompanyVoicePackageOrder(CompanyVoicePackageOrder companyVoicePackageOrder);

    /**
     * 修改套餐订单
     * 
     * @param companyVoicePackageOrder 套餐订单
     * @return 结果
     */
    public int updateCompanyVoicePackageOrder(CompanyVoicePackageOrder companyVoicePackageOrder);

    /**
     * 删除套餐订单
     * 
     * @param orderId 套餐订单ID
     * @return 结果
     */
    public int deleteCompanyVoicePackageOrderById(Long orderId);

    /**
     * 批量删除套餐订单
     * 
     * @param orderIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteCompanyVoicePackageOrderByIds(Long[] orderIds);
    @Select({"<script> " +
            "select o.*,c.company_name,p.package_name " +
            "from company_voice_package_order o left join company c on c.company_id=o.company_id left join  company_voice_package p  on p.package_id=o.package_id  " +
            "where 1=1 " +
            "<if test = 'maps.companyId != null  '> " +
            "and o.company_id = #{maps.companyId}" +
            "</if>" +
            "<if test = 'maps.orderSn != null and maps.orderSn != \"\"  '> " +
            "and o.order_sn = #{maps.orderSn}" +
            "</if>" +
            "<if test = 'maps.status != null '> " +
            "and o.status = #{maps.status}" +
            "</if>" +
            "<if test = 'maps.beginTime != null and maps.beginTime != \"\" '> " +
            "and date_format(o.create_time,'%y%m%d') &gt;= date_format(#{maps.beginTime},'%y%m%d') " +
            "</if>" +
            "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
            "and date_format(o.create_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
            "</if>" +
            "order by o.order_id desc " +
            "</script>"})
    List<CompanyVoicePackageOrderListVO> selectCompanyVoicePackageOrderListVO(@Param("maps")CompanyVoicePackageOrderListParam param);
}
