1. 程式人生 > >用戶權限控制

用戶權限控制

tex 聲明 用戶權限 查詢 當前 earch buffer sea pac

當前用戶只查看當前用戶的創業導師: 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);

用戶權限控制