派生自 projectDept/qhighschool

yn147
2023-05-10 96286178ee1c257c130cb2ad964a781f36c4eee5
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/******************************************************************************
O * Copyright (C) 2014 Shenzhen Penguin Network Technology Co., Ltd
 * All Rights Reserved.
 * 本软件为深圳企鹅网络科技有限公司开发研制。未经本公司正式书面同意,其他任何个人、团体
 * 不得使用、复制、修改或发布本软件.
 *****************************************************************************/
 
package com.qxueyou.scc.base.dao;
 
import java.util.List;
 
import org.springframework.stereotype.Repository;
 
import com.qxueyou.scc.base.util.CollectionUtils;
import com.qxueyou.scc.sys.model.SysConfig;
import com.qxueyou.scc.sys.model.SysDictionary;
 
@Repository(value="commonDao")
/**
 * 通用DAO类
 *
 * @author  夏德虎
 * @since   JDK1.7
 * @history 2014-11-18 夏德虎 新建
 */
public class CommonDAO extends BaseDAO{
    
    /**
     * 根据配置key查询value值 
     * @param key
     * @return
     */
    public String queryConfigValue(String key){
        String hql = "from SysConfig where configKey=?";
        
        List<SysConfig> lstConfig =  this.find(hql, 
                CollectionUtils.newList(key), SysConfig.class);
        
        if(lstConfig.isEmpty()){
            return null;
        }
        
        return lstConfig.get(0).getValue();
    }
    
    /**
     * 根据字典类型查询字典内容的list
     * @param dicType
     * @return
     */
    public List<SysDictionary> queryDictConfigMap(String dicType){
        String hql = "from SysDictionary where typeId = (select dictionaryTypeId from SysDictionaryType where type = ? ) and status=1";
        
        return this.find(hql, CollectionUtils.newList(dicType), SysDictionary.class);
    }
}