package com.fs.company.mapper;

import java.util.List;
import com.fs.company.domain.CompanySmsOrder;
import com.fs.company.param.CompanySmsOrderListParam;
import com.fs.company.vo.CompanySmsOrderListVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 短信购买订单Mapper接口
 * 
 * @author fs
 * @date 2023-01-09
 */
public interface CompanySmsOrderMapper 
{
    /**
     * 查询短信购买订单
     * 
     * @param orderId 短信购买订单ID
     * @return 短信购买订单
     */
    public CompanySmsOrder selectCompanySmsOrderById(Long orderId);

    /**
     * 查询短信购买订单列表
     * 
     * @param companySmsOrder 短信购买订单
     * @return 短信购买订单集合
     */


    /**
     * 新增短信购买订单
     * 
     * @param companySmsOrder 短信购买订单
     * @return 结果
     */
    public int insertCompanySmsOrder(CompanySmsOrder companySmsOrder);

    /**
     * 修改短信购买订单
     * 
     * @param companySmsOrder 短信购买订单
     * @return 结果
     */
    public int updateCompanySmsOrder(CompanySmsOrder companySmsOrder);

    /**
     * 删除短信购买订单
     * 
     * @param orderId 短信购买订单ID
     * @return 结果
     */
    public int deleteCompanySmsOrderById(Long orderId);

    /**
     * 批量删除短信购买订单
     * 
     * @param orderIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteCompanySmsOrderByIds(Long[] orderIds);

    @Select({"<script> " +
            "select o.*,c.company_name from company_sms_order o left join company c on c.company_id=o.company_id " +
            "where 1=1 " +
            "<if test = 'maps.companyId != null  '> " +
            "and o.company_id = #{maps.companyId}" +
            "</if>" +
            "<if test = 'maps.orderCode != null and maps.orderCode!=\"\"  '> " +
            "and o.order_code = #{maps.orderCode}" +
            "</if>" +
            "<if test = 'maps.status != null  '> " +
            "and o.status = #{maps.status}" +
            "</if>" +
            "<if test = 'maps.payTime != null '> " +
            "and date_format(o.pay_time,'%y%m%d')  = date_format(#{maps.payTime},'%y%m%d') " +
            "</if>" +
            "order by o.order_id desc " +
            "</script>"})
    public List<CompanySmsOrderListVO> selectCompanySmsOrderList(@Param("maps")CompanySmsOrderListParam companySmsOrder);
}
