AuthLevelDaoImpl.java 1.73 KB
package com.diligrp.website.dao.impl;

import com.diligrp.website.dao.AuthLevelDao;
import com.diligrp.website.domain.AuthLevel;
import com.diligrp.website.domain.PickUpPointDomain;
import com.diligrp.website.util.dao.BaseQuery;
import com.diligrp.website.util.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("authLevelDao")
public class AuthLevelDaoImpl extends BaseDaoImpl<AuthLevel>
        implements AuthLevelDao {

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

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

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

    @Override
    public boolean save(AuthLevel authLevel) {
        return super.save(authLevel);
    }

    @Override
    public boolean modify(AuthLevel authLevel) {
        return super.update(authLevel);
    }

    @Override
    public AuthLevel getAuthLevelById(Long id) {
        return super.getById(id);
    }

    @Override
    public List<AuthLevel> getAllAuthLevel() {
        return getSqlSessionTemplate().selectList(
                PREFIX + ".getAllAuthLevel");
    }

    @Override
    public AuthLevel checkName(Long id, String levelName) {
        BaseQuery bq = new BaseQuery();
        if (id != null) {
            bq.addParam("id", id + "");
        }
        bq.addParam("levelName", levelName);
        return getSqlSessionTemplate().selectOne(
                PREFIX + ".checkName", bq);
    }
}