/******************************************************************************
|
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);
|
}
|
}
|