/** * 根据name得到Resource. * * @param name 资源名称 * @return * @throws DaoException * @throws SystemException * @throws ServiceException */ public Resource getByName(String name) throws DaoException, SystemException, ServiceException { if (StringUtils.isBlank(name)) { return null; } name = StringUtils.strip(name); // 去除两边空格 return resourceDao.findUniqueBy("name", name); }
/** * 性别下拉框 * * @throws Exception */ @RequestMapping(value = {"sexTypeCombobox"}) @ResponseBody public List<Combobox> sexTypeCombobox(String selectType) throws Exception { List<Combobox> cList = Lists.newArrayList(); // 为combobox添加 "---全部---"、"---请选择---" if (!StringUtils.isBlank(selectType)) { SelectType s = SelectType.getSelectTypeValue(selectType); if (s != null) { Combobox selectCombobox = new Combobox("", s.getDescription()); cList.add(selectCombobox); } } SexType[] _enums = SexType.values(); for (int i = 0; i < _enums.length; i++) { Combobox combobox = new Combobox(_enums[i].getValue().toString(), _enums[i].getDescription()); cList.add(combobox); } return cList; }
/** * 根据编码得到Resource. * * @param code 资源编码 * @return * @throws DaoException * @throws SystemException * @throws ServiceException */ public Resource getByCode(String code) throws DaoException, SystemException, ServiceException { if (StringUtils.isBlank(code)) { return null; } return resourceDao.findUniqueBy("code", code); }