/** * 增加角色 * * @return */ @Action( value = "addRoleM", results = {@Result(name = "json", type = "json")}) public String addRoleM() { RoleM rm = new RoleM(); rm.setId(this.getSerial().Serialid(Serial.ROLE)); rm.setRolename(this.getRolename()); rm.setNote(this.getNote()); rm.setCreatetime(BaseTools.systemtime()); this.getRoleMService().save(rm); this.getRoleFunctionMService().addRoleFunctionM(rm, this.getFunctionid().trim()); this.setSucflag(true); return "json"; }
/** * 获取所有角色用于前台select控件显示 * * @return */ @Action( value = "findAllRoleForSelect", results = {@Result(name = "json", type = "json")}) public String findAllRoleForSelect() { this.setRolestr(""); List<RoleM> list = this.getRoleMService().findAllRoleM(); if (!list.isEmpty()) { this.setRolestr("<option value='0'>---请选择---</option>"); for (Iterator<RoleM> it = list.iterator(); it.hasNext(); ) { RoleM rm = (RoleM) it.next(); this.rolestr += "<option value='" + rm.getId() + "'>" + rm.getRolename() + "</option>"; } this.setSucflag(true); return "json"; } this.setSucflag(true); return "json"; }
public void ProcessRoleMList(List<RoleM> list) { for (Iterator<RoleM> it = list.iterator(); it.hasNext(); ) { RoleM rm = (RoleM) it.next(); Map<String, Object> cellMap = new HashMap<String, Object>(); cellMap.put("id", rm.getId()); cellMap.put( "cell", new Object[] { rm.getRolename(), rm.getNote(), BaseTools.formateDbDate(rm.getCreatetime()), "<a id='editrole' name='editrole' href='role.jsp?operate=edit&folder=setting&id=" + rm.getId() + "'>[编辑]</a>" }); rows.add(cellMap); } }