xx
wang-hao-jie
2021-11-03 633be87bcdaab325daa6d4f74f5294e14660cfd7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package cn.exrick.xboot.base.dao;
 
import cn.exrick.xboot.base.entity.Dict;
import cn.exrick.xboot.core.base.XbootBaseDao;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
 
import java.util.List;
 
/**
 * 字典数据处理层
 * @author Exrick
 */
public interface DictDao extends XbootBaseDao<Dict, String> {
 
    /**
     * 排序获取全部
     * @return
     */
    @Query(value = "select d from Dict d order by d.sortOrder")
    List<Dict> findAllOrderBySortOrder();
 
    /**
     * 通过type获取
     * @param type
     * @return
     */
    Dict findByType(String type);
 
    /**
     * 模糊搜索
     * @param key
     * @return
     */
    @Query(value = "select d from Dict d where d.title like %:key% or d.type like %:key% order by d.sortOrder")
    List<Dict> findByTitleOrTypeLike(@Param("key") String key);
}