@Override public boolean findByCodeAndId(String code, String id) throws DatabaseException { DataField dataField = null; code = StringUtils.trimToEmpty(code); if (Strings.isNullOrEmpty(code)) { return false; } if (StringUtils.isNotBlank(id)) { dataField = dataFieldDao.findByCodeAndId(code, id); } else { dataField = dataFieldDao.findByCode(code); } if (dataField != null) { return false; } return true; }
@Override public List<DataField> findDataFieldByEnable(User user, String menuIds) throws DatabaseException { List<DataField> resultList = Lists.newArrayList(); List<DataField> dataFieldList = dataFieldDao.findDataFieldByEnable(); for (DataField dataField : dataFieldList) { String users = dataField.getUsers(); if (users.contains(user.getId())) { dataField.setIsChecked(1); } if (StringUtils.isNotBlank(menuIds) && dataField.getMenu() != null && StringUtils.isNotBlank(dataField.getMenu().getId())) { if (!menuIds.contains(dataField.getMenu().getId())) { // 过滤所有包含该菜单ID的按钮 resultList.add(dataField); } } } if (resultList != null && resultList.size() > 0) { dataFieldList.removeAll(resultList); } return dataFieldList; }
@Override @Transactional(readOnly = false) public Integer updateDataFieldIsEnable(String id) throws DatabaseException { return dataFieldDao.updateDataFieldIsEnable(id); }
@Override @Transactional(readOnly = false) public DataField update(DataField dataField) throws DatabaseException { return dataFieldDao.save(dataField); }
@Transactional(readOnly = false) public DataField save(DataField dataField) { return dataFieldDao.save(dataField); }
public DataField findByCode(String code) throws DatabaseException { return dataFieldDao.findByCode(code); }
public DataField findOne(String id) { return dataFieldDao.findOne(id); }
@Override public List<DataField> findAll() throws DatabaseException { return (List<DataField>) dataFieldDao.findAll(new Sort(Direction.ASC, "id")); }