@RequestMapping(params = "p=eyeView") public ModelAndView showEyeView(@ModelAttribute SYS_Role entity, HttpSession session) { SYS_User user = (SYS_User) session.getAttribute(Const.SESSION_USER); PageData pd = getPageData(); try { String sql = SQLUtil.getQuerySQL(SYS_Role.class).replace("\n", "") + " where RoleID='" + entity.getRoleID() + "'"; List<SYS_Role> entry = roleDao.query(SYS_Role.class, sql); List<SYS_Role> entrys = roleDao.findByCompanys(user.getOrgID()); for (SYS_Role sys_Role : entrys) { if (!(sys_Role.getCompanyID().equals(entry.get(0).getCompanyID()))) { entry.add(sys_Role); } } pd.put("role", entry); mv.addObject("model", pd); // mv.addObject("model", pd.put("entity", entry)); mv.setViewName("/system/role/system_role_eye"); } catch (Exception e) { return MessageUtil.exception(user, mv, e); } return MessageUtil.success(mv); }
@RequestMapping(params = "p=showAddView") public ModelAndView showAddView(@ModelAttribute SYS_User user, HttpSession session) { user = (SYS_User) session.getAttribute(Const.SESSION_USER); PageData pd = getPageData(); try { pd.put("role", roleDao.findByCompanys(user.getOrgID())); mv.addObject("model", pd); mv.setViewName("/system/role/system_role_add"); } catch (Exception e) { return MessageUtil.exception(user, mv, e); } return MessageUtil.success(mv); }
@RequestMapping(params = "p=showmoduleview") public ModelAndView showModuleView(@ModelAttribute SYS_Role entity, HttpSession session) { SYS_User user = (SYS_User) session.getAttribute(Const.SESSION_USER); PageData pd = getPageData(); try { pd.put("roleID", entity.getRoleID()); pd.put("roleName", unicode(entity.getRoleName())); // pd.put("store", storeDao.findStoreByRole(user.getRoleID())); // pd.put("company", // bossCompanyDao.findCompanyByRole(user.getRoleID())); mv.addObject("model", pd); mv.setViewName("/system/role/system_role_module"); } catch (Exception e) { return MessageUtil.exception(user, mv, e); } return MessageUtil.success(mv); }
@RequestMapping(params = "p=view") public ModelAndView showListView(HttpSession session, @RequestParam("moduleID") String moduleID) { SYS_User user = (SYS_User) session.getAttribute(Const.SESSION_USER); PageData pd = getPageData(); try { // 获取用户权限按钮 String sql = "select * " + " from SYS_RoleButton " + " where ModuleID= '" + moduleID + "' and roleID = '" + user.getRoleID() + "' ;"; pd.put("userbutton", roleDao.query(SYS_RoleButton.class, sql)); mv.addObject("model", pd); mv.setViewName("/system/role/system_role_view"); /* * String sql = * "select * from BOSS_Store where StoreID='37108300001'"; * * List<SYS_Role> rols = new ArrayList<SYS_Role>(); List<BOSS_Store> * list = roleDao.query(BOSS_Store.class, sql); for (BOSS_Store * store : list) { SYS_Role role = new SYS_Role(); * role.setRoleID(UUIDUtil.get32UUID()); * role.setRoleName(store.getStoreName()+"企业负责人"); * role.setCompanyID(store.getCompanyID()); * role.setCompanyName(store.getCompanyName()); * role.setInputDate(DateUtil.getDateString()); * role.setInputName("Jimmy Toy"); * * SYS_Role role1 = new SYS_Role(); * role1.setRoleID(UUIDUtil.get32UUID()); * role1.setRoleName(store.getStoreName()+"质量负责人"); * role1.setCompanyID(store.getCompanyID()); * role1.setCompanyName(store.getCompanyName()); * role1.setInputDate(DateUtil.getDateString()); * role1.setInputName("Jimmy Toy"); * * SYS_Role role2 = new SYS_Role(); * role2.setRoleID(UUIDUtil.get32UUID()); * role2.setRoleName(store.getStoreName()+"销售员"); * role2.setCompanyID(store.getCompanyID()); * role2.setCompanyName(store.getCompanyName()); * role2.setInputDate(DateUtil.getDateString()); * role2.setInputName("Jimmy Toy"); * * rols.add(role); rols.add(role1); rols.add(role2); } * roleDao.insert(rols); * * sql = * "select * from SYS_Role where CompanyID in ('1435295347218')"; * rols = roleDao.query(SYS_Role.class, sql); * * sql = * "select * from SYS_RoleModule where RoleID='b8c90c7227b74f8db72800f2300dcba3'" * ; List<SYS_RoleModule> rm1 = roleDao.query(SYS_RoleModule.class, * sql); * * sql = * "select * from SYS_RoleModule where RoleID='b8c90c7227b74f8db72800f2300dcba4'" * ; List<SYS_RoleModule> rm2 = roleDao.query(SYS_RoleModule.class, * sql); * * List<SYS_RoleAccess> access = new ArrayList<>(); for (int i=0; * i<rols.size(); i++) { SYS_Role role = rols.get(i); if * (role.getRoleName().indexOf("企业负责人") >= 0) { List<SYS_RoleModule> * temp = new ArrayList<SYS_RoleModule>(); for (SYS_RoleModule rm : * rm1) { rm.setRomoID(UUIDUtil.get32UUID()); * rm.setRoleID(role.getRoleID()); * rm.setRoleName(role.getRoleName()); * rm.setInputDate(DateUtil.getDateString()); * rm.setInputName("Jimmy Toy"); temp.add(rm); } * roleDao.insert(temp); } else if * (role.getRoleName().indexOf("质量负责人") >= 0) { List<SYS_RoleModule> * temp = new ArrayList<SYS_RoleModule>(); for (SYS_RoleModule rm : * rm2) { rm.setRomoID(UUIDUtil.get32UUID()); * rm.setRoleID(role.getRoleID()); * rm.setRoleName(role.getRoleName()); * rm.setInputDate(DateUtil.getDateString()); * rm.setInputName("Jimmy Toy"); temp.add(rm); } * roleDao.insert(temp); } * * SYS_RoleAccess ra= new SYS_RoleAccess(); * ra.setRoacID(UUIDUtil.get32UUID()); * ra.setRoleID(role.getRoleID()); * ra.setRoleName(role.getRoleName()); ra.setDataType("Store"); * ra.setDataValue(role.getCompanyID()); * ra.setInputDate(DateUtil.getDateString()); * ra.setInputName("Jimmy Toy"); * * access.add(ra); * * SYS_RoleAccess ra1= new SYS_RoleAccess(); * ra1.setRoacID(UUIDUtil.get32UUID()); * ra1.setRoleID(role.getRoleID()); * ra1.setRoleName(role.getRoleName()); ra1.setDataType("Supplier"); * ra1.setDataValue("1435295347214"); * ra1.setInputDate(DateUtil.getDateString()); * ra1.setInputName("Jimmy Toy"); * * access.add(ra1); * * SYS_RoleAccess ra2= new SYS_RoleAccess(); * ra2.setRoacID(UUIDUtil.get32UUID()); * ra2.setRoleID(role.getRoleID()); * ra2.setRoleName(role.getRoleName()); ra2.setDataType("Company"); * ra2.setDataValue(role.getCompanyID()); * ra2.setInputDate(DateUtil.getDateString()); * ra2.setInputName("Jimmy Toy"); * * access.add(ra2); roleDao.insert(access); } */ } catch (Exception e) { return MessageUtil.exception(user, mv, e); } return MessageUtil.success(mv); }