mapper以及dao层 package org.jxnd.mapper;import java.util.List;import org.apache.ibatis.annotations.Param;import org.apache.ibatis.annotations.Select;import org.apache.ibatis.annotations.SelectProvider;import org.jxnd.bean.Systems;import
package org.jxnd.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.SelectProvider; import org.jxnd.bean.Systems; import org.jxnd.bean.UserInfo; public interface UserInfoMapper { //根据用户名和密码查询用户信息 @Select("select * from userinfo where name=#{name} and pwd=#{pwd}") UserInfo getUserByNameAndPwd(@Param("name")String name,@Param("pwd")String pwd); //查询角色所有权限 @Select("select * from systems where id in(select sid from rolesystem where rid=#{rid}) order by oid desc") ListgetSystemsByRolesId(int rid); } package org.jxnd.dao.impl; import java.util.List; import org.jxnd.bean.Systems; import org.jxnd.bean.UserInfo; import org.jxnd.dao.UserInfoDao; import org.jxnd.mapper.UserInfoMapper; import org.jxnd.tools.DBTools; public class UserInfoDaoImpl implements UserInfoDao{ UserInfoMapper mapper=DBTools.getSqlSession().getMapper(UserInfoMapper.class); @Override public UserInfo getUserByNameAndPwd(String name, String pwd) { return mapper.getUserByNameAndPwd(name, pwd); } @Override public List getSystemsByRolesId(int rid) { return mapper.getSystemsByRolesId(rid); } }