package thyyxxk.webserver.dao.his.utilities.workorder;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.utilities.workorder.OrderInquiry;
import thyyxxk.webserver.entity.utilities.workorder.WorkOrder;

import java.util.List;

@Mapper
public interface WorkOrderDao extends BaseMapper<WorkOrder> {

    @Select("select *," +
            "meTaken=(select count(1) from t_work_order_detail d " +
            "where d.parent_id=a.id and d.participant=#{user}) " +
            "from t_work_order a where createtime>=#{begintime} " +
            "and createtime<=#{endtime} ${stmt} order by createtime desc")
    List<WorkOrder> getPlatOrders(OrderInquiry inquiry);
}
