package com.fs.doc.mapper;

import java.util.List;
import com.fs.doc.domain.DocOrder;
import com.fs.doc.param.DocOrderQueryParam;
import com.fs.doc.vo.DocOrderListQueryVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 问医生Mapper接口
 * 
 * @author fs
 * @date 2023-01-09
 */
public interface DocOrderMapper 
{
    /**
     * 查询问医生
     * 
     * @param orderId 问医生ID
     * @return 问医生
     */
    public DocOrder selectDocOrderById(Long orderId);

    /**
     * 查询问医生列表
     * 
     * @param docOrder 问医生
     * @return 问医生集合
     */
    public List<DocOrder> selectDocOrderList(DocOrder docOrder);

    /**
     * 新增问医生
     * 
     * @param docOrder 问医生
     * @return 结果
     */
    public int insertDocOrder(DocOrder docOrder);

    /**
     * 修改问医生
     * 
     * @param docOrder 问医生
     * @return 结果
     */
    public int updateDocOrder(DocOrder docOrder);

    /**
     * 删除问医生
     * 
     * @param orderId 问医生ID
     * @return 结果
     */
    public int deleteDocOrderById(Long orderId);

    /**
     * 批量删除问医生
     * 
     * @param orderIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteDocOrderByIds(Long[] orderIds);
    @Select({"<script> " +
            "select o.*,d.user_name from doc_order o left join doc d on d.doc_id=o.doc_id  " +
            "where 1=1 " +
            "<if test = 'maps.userId != null '> " +
            "and o.user_id =#{maps.userId} " +
            "</if>" +
            "<if test = 'maps.docId != null     '> " +
            "and o.doc_id =#{maps.docId} " +
            "</if>" +
            " order by o.order_id desc "+
            "</script>"})
    List<DocOrderListQueryVO> selectDocOrderListVOQuery(@Param("maps")DocOrderQueryParam param);
}
