/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository.dict;

import com.yihu.wlyy.entity.dict.DmDrugsGroupItem;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface DmDrugsGroupItemDao extends PagingAndSortingRepository<DmDrugsGroupItem, Long>, JpaSpecificationExecutor<DmDrugsGroupItem> {
    @Query(value = "select b.* from wlyy_followup_class_drugs a,dm_drugs_group_item b left join dm_drugs_group c on c.group_code = b.group_code and c.status='1' where a.drugs_code=b.drugs_code and a.followup_class=?1 and b.status='1' order by c.order,b.order",nativeQuery = true)
    List<DmDrugsGroupItem> findByFollowupClass(String followupClass) throws Exception;
}
