SysConfigDaoImpl.java 1.55 KB
package com.diligrp.website.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.diligrp.website.dao.SysConfigDao;
import com.diligrp.website.domain.SysConfig;
import com.diligrp.website.util.dao.BaseQuery;
import com.diligrp.website.util.dao.impl.BaseDaoImpl;

@Component("sysConfigDao")
public class SysConfigDaoImpl extends BaseDaoImpl<SysConfig> implements
        SysConfigDao {

    private static final String PREFIX = SysConfigDaoImpl.class
            .getCanonicalName();

    @Override
    public SysConfig getSysConfigByCode(String code) {
        return getSqlSessionTemplate().selectOne(
                PREFIX + ".getSysConfigByCode", code);
    }

    @Override
    public Integer getSysConfigListCount(BaseQuery query) {
        return getSqlSessionTemplate().selectOne(
                PREFIX + ".getSysConfigListCount", query);
    }

    @Override
    public List<SysConfig> getSysConfigList(BaseQuery query) {
        return getSqlSessionTemplate().selectList(PREFIX + ".getSysConfigList",
                query);
    }

    @Override
    public boolean saveSysConfig(SysConfig cfg) {
        return getSqlSessionTemplate().insert(PREFIX + ".saveSysConfig", cfg) > 0;
    }

    @Override
    public SysConfig getSysConfigById(Integer id) {
        return getSqlSessionTemplate().selectOne(PREFIX + ".getSysConfigById",
                id);
    }

    @Override
    public boolean editSysConfig(SysConfig newCfg) {
        return getSqlSessionTemplate()
                .update(PREFIX + ".editSysConfig", newCfg) > 0;
    }

}