AuthLevelManagerImpl.java 1.73 KB
package com.diligrp.website.manager.impl;

import com.diligrp.website.dao.AuthLevelDao;
import com.diligrp.website.domain.AuthLevel;
import com.diligrp.website.domain.PickUpPointDomain;
import com.diligrp.website.manager.AuthLevelManager;
import com.diligrp.website.util.dao.BaseQuery;
import com.diligrp.website.util.web.PageTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.List;

@Component("authLevelManager")
public class AuthLevelManagerImpl implements AuthLevelManager {

    @Resource
    private AuthLevelDao authLevelDao;

    @Override
    public PageTemplate getAuthLevelList(BaseQuery query) {
        Integer totalSize = authLevelDao.getAuthLevelCount(query);
        List<AuthLevel> list = authLevelDao.getAuthLevelList(query);
        return PageTemplate.create(query, totalSize, list);
    }

    @Override
    public boolean addAuthLevel(AuthLevel authLevel) {
        authLevel.setCreated(new Timestamp(System.currentTimeMillis()));
        authLevel.setModified(authLevel.getCreated());
        authLevel.setYn(1);
        authLevel.setState(1);
        return authLevelDao.save(authLevel);
    }

    @Override
    public boolean modifyAuthLevel(AuthLevel authLevel) {
        authLevel.setModified(new Timestamp(System.currentTimeMillis()));
        return authLevelDao.modify(authLevel);
    }

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

    @Override
    public List<AuthLevel> getAllAuthLevel(){
        return authLevelDao.getAllAuthLevel();
    }

    @Override
    public AuthLevel checkName(Long id, String levelName) {
        return authLevelDao.checkName(id,levelName);
    }
}