SSH框架之Sevice

勿在浮沙築高臺LS發表於2016-12-10
package cn.itcast.oa.service;

import java.util.List;

import cn.itcast.oa.domain.Role;

public interface RoleService {

    // 查詢所有
    List<Role> findAll();

    void delete(Long id);

    void save(Role role);

    Role getById(Long id);

    void update(Role role);

}
package cn.itcast.oa.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.oa.dao.RoleDao;
import cn.itcast.oa.domain.Role;
import cn.itcast.oa.service.RoleService;

@Service
@Transactional
public class RoleServiceImpl implements RoleService {

    @Resource
    private RoleDao roleDao;

    public Role getById(Long id) {
        return roleDao.getById(id);
    }

    public void delete(Long id) {
        roleDao.delete(id);
    }

    public void save(Role role) {
        roleDao.save(role);
    }

    public void update(Role role) {
        roleDao.update(role);
    }

    public List<Role> findAll() {
        return roleDao.findAll();
    }

}

相關文章