package com.service.impl; import com.dao.RoleDao; import com.domain.Role; import com.mapper.RoleMapper; import com.service.RoleService; import com.utils.SqlSessionFactoryUtils; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.List; //@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.MANDATORY) @Service public class RoleServiceImpl implements RoleService { @Autowired private RoleMapper mapper; public void setRoleMapper(RoleMapper roleMapper) { this.mapper = roleMapper; } public List list() { List roleList=mapper.findAll(); return roleList; } public void save(Role role) { mapper.save(role); } public void del(Long roleId) { mapper.delUserRoleRel(roleId); mapper.del(roleId); } /*private RoleDao roleDao; public void setRoleDao(RoleDao roleDao) { this.roleDao = roleDao; } public List list() { List roleList = roleDao.findAll(); return roleList; } public void save(Role role) { roleDao.save(role); } // @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.MANDATORY) public void del(Long roleId) { //1、删除sys_user_role关系表 roleDao.delUserRoleRel(roleId); //2、删除sys_user表 roleDao.del(roleId); }*/ }