当前用户只查看当前用户的创业导师: Action 获取当前用户的id: // liwentao 2017-5-18 获取用户ID方法
LoginContext loginContext=getLoginContext(); //声明用户id得到获取的ID String addusercode=loginContext.getUserCode();
//把声明的id加入到查询方法里面。 List<SpaceInstructorInfoEntity> list = spaceInstructorInfoManager.getInstructorListByParam(queryWay, search, instructorname, currentstate, pagination, addusercode);
Dao层 添加了字段String addusercode :不能固定死权限所以必须从用户选取 public List<SpaceInstructorInfoEntity> getInstructorListByParam(String queryWay,String search, String instruName, String currState, Pagination pagination, String addusercode) { Session session = this.getSession(); StringBuffer buffer = new StringBuffer(); buffer.append(" from SpaceInstructorInfoEntity s where valid = ‘Y‘ and addusercode=‘"+addusercode+"‘ ");//2017-05-18 李文涛-DEV00208812《and addusercode=‘"+addusercode+"‘ 》 }
Service层: /** * 创业导师维护主控查询 * * @param instruName * @param currState * @param pagination * @return List<SpaceInstructorInfoEntity> */ public List<SpaceInstructorInfoEntity> getInstructorListByParam(String queryWay, String search, String instruName, String currState, Pagination pagination,String addusercode) { return spaceInstructorInfoDao.getInstructorListByParam(queryWay, search, instruName, currState, pagination,addusercode);