派生自 projectDept/qhighschool

胡仁荣
2022-10-31 fe7381d6e8ec1f427408de0297ac7f41533202f6
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);
    }
}