本文整理了Java中org.hswebframework.ezorm.core.dsl.Query.and
方法的一些代码示例,展示了Query.and
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.and
方法的具体详情如下:
包路径:org.hswebframework.ezorm.core.dsl.Query
类名称:Query
方法名:and
暂无
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Cacheable(key = "'user:'+#userId+'.'+#key+'.'+#settingId")
public UserSettingEntity selectByUser(String userId, String key, String settingId) {
Objects.requireNonNull(userId);
Objects.requireNonNull(key);
Objects.requireNonNull(settingId);
return createQuery().where("userId", userId).and("key", key).and("settingId", settingId).single();
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Cacheable(key = "'user:'+#userId+'.'+#key")
public List<UserSettingEntity> selectByUser(String userId, String key) {
Objects.requireNonNull(userId);
Objects.requireNonNull(key);
return createQuery().where("userId", userId).and("key", key).listNoPaging();
}
代码示例来源:origin: hs-web/hsweb-framework
private List<AuthorizationSettingEntity> getUserSetting(String userId) {
Map<String, List<SettingInfo>> settingInfo =
authorizationSettingTypeSuppliers.stream()
.map(supplier -> supplier.get(userId))
.flatMap(Set::stream)
.collect(Collectors.groupingBy(SettingInfo::getType));
Stream<Map.Entry<String, List<SettingInfo>>> settingInfoStream = settingInfo.entrySet().stream();
//大于1 使用并行处理
if (settingInfo.size() > 1) {
settingInfoStream = settingInfoStream.parallel();
}
return settingInfoStream
.map(entry ->
createQuery()
// where type = ? and setting_for in (?,?,?....)
.where(type, entry.getKey())
.and()
.in(settingFor, entry.getValue().stream().map(SettingInfo::getSettingFor).collect(Collectors.toList()))
.listNoPaging())
.flatMap(List::stream)
.collect(Collectors.toList());
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Cacheable(key = "'define-id:'+#processDefineId+'-'+#activityId")
public ActivityConfigEntity selectByProcessDefineIdAndActivityId(String processDefineId, String activityId) {
return createQuery()
.where("processDefineId", processDefineId)
.and("activityId", activityId)
.single();
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Cacheable(key = "'define-key:'+#processDefineKey+'-'+#activityId")
public ActivityConfigEntity selectByProcessDefineKeyAndActivityId(String processDefineKey, String activityId) {
return createQuery()
.where("processDefineKey", processDefineKey)
.and("activityId", activityId)
.single();
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Cacheable(key = "'define-key-latest:'+#processDefineKey")
public ProcessDefineConfigEntity selectByLatestProcessDefineKey(String processDefineKey) {
return createQuery()
.where("processDefineKey", Objects.requireNonNull(processDefineKey, "参数[processDefineKey]不能为空"))
.and("status", DataStatus.STATUS_ENABLED)
.orderByDesc("updateTime")
.single();
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Cacheable(cacheNames = "oauth2-access-token", key = "'cgo'+#token.clientId+#token.grantType+#token.ownerId")
public OAuth2AccessToken tryGetOldToken(OAuth2AccessToken token) {
OAuth2AccessToken old = DefaultDSLQueryService
.createQuery(oAuth2AccessDao)
.where("clientId", token.getClientId())
.and("grantType", token.getGrantType())
.and("ownerId", token.getOwnerId())
.single();
return old;
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
protected boolean dataExisted(UserSettingEntity entity) {
UserSettingEntity old = createQuery()
.where(entity::getUserId)
.and(entity::getKey)
.and(entity::getSettingId)
.single();
if (old != null) {
entity.setId(old.getId());
return true;
}
return false;
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Transactional(readOnly = true)
public List<E> selectParentNode(PK childId) {
assertNotNull(childId);
E old = selectByPk(childId);
if (null == old) {
return new ArrayList<>();
}
return createQuery()
.where()
// where ? like concat(path,'%')
.and("path$like$reverse$startWith", old.getPath())
.listNoPaging();
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public List<Permission> initPermission(String type, String settingFor) {
AuthorizationSettingEntity entity = select(type, settingFor);
if (entity == null) {
return new ArrayList<>();
}
List<AuthorizationSettingDetailEntity> detailList = DefaultDSLQueryService
.createQuery(authorizationSettingDetailDao)
.where(status, STATE_OK)
.and().is(settingId, entity.getId())
.listNoPaging();
if (CollectionUtils.isEmpty(detailList)) {
return new ArrayList<>();
}
return initPermission(detailList);
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public DynamicFormDeployLogEntity selectDeployed(String formId, long version) {
Objects.requireNonNull(formId);
DynamicFormDeployLogEntity deployed = createQuery()
.where(DynamicFormDeployLogEntity.formId, formId)
.and(DynamicFormDeployLogEntity.version, version)
.orderByDesc(DynamicFormDeployLogEntity.deployTime)
.single();
if (null != deployed && DataStatus.STATUS_ENABLED.equals(deployed.getStatus())) {
return deployed;
}
return null;
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Caching(evict = {
@CacheEvict(value = "dyn-form-deploy", allEntries = true),
@CacheEvict(value = "dyn-form", allEntries = true),
})
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void deployAllFromLog() {
List<String> tags = new ArrayList<>(Arrays.asList(this.tags));
if (loadOnlyTags != null) {
tags.addAll(Arrays.asList(loadOnlyTags));
}
List<DynamicFormEntity> entities = createQuery()
.select(DynamicFormEntity.id)
.where(DynamicFormEntity.deployed, true)
.and()
.in(DynamicFormEntity.tags, tags)
.listNoPaging();
if (logger.isDebugEnabled()) {
logger.debug("do deploy all form , size:{}", entities.size());
}
for (DynamicFormEntity form : entities) {
DynamicFormDeployLogEntity logEntity = dynamicFormDeployLogService.selectLastDeployed(form.getId());
if (null != logEntity) {
deployFromLog(logEntity);
}
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public AuthorizationSettingEntity select(String type, String settingFor) {
tryValidateProperty(type != null, AuthorizationSettingEntity.type, "{can not be null}");
tryValidateProperty(settingFor != null, AuthorizationSettingEntity.settingFor, "{can not be null}");
return createQuery().where(AuthorizationSettingEntity.type, type)
.and(AuthorizationSettingEntity.settingFor, settingFor)
.single();
}
代码示例来源:origin: hs-web/hsweb-framework
nest.and();
} else {
conditional.and();
代码示例来源:origin: hs-web/hsweb-framework
controllerCache.targetIdGetter = createGetter(OrgAttachEntity.class, OrgAttachEntity::getOrgId);
controllerCache.queryConsumer = (query, scopeInfo) -> {
query.and(property, children ? "org-child-in" : "in", scopeInfo.scope);
};
controllerCache.targetIdGetter = createGetter(DepartmentAttachEntity.class, DepartmentAttachEntity::getDepartmentId);
controllerCache.queryConsumer = (query, scopeInfo) -> {
query.and(property, children ? "org-child-in" : "in", scopeInfo.scope);
};
controllerCache.targetIdGetter = createGetter(PositionAttachEntity.class, PositionAttachEntity::getPositionId);
controllerCache.queryConsumer = (query, scopeInfo) -> {
query.and(property, children ? "pos-child-in" : "in", scopeInfo.scope);
};
controllerCache.targetIdGetter = createGetter(DistrictAttachEntity.class, DistrictAttachEntity::getDistrictId);
controllerCache.queryConsumer = (query, scopeInfo) -> {
query.and(property, children ? "dist-child-in" : "in", scopeInfo.scope);
};
controllerCache.targetIdGetter = createGetter(PersonAttachEntity.class, PersonAttachEntity::getPersonId);
controllerCache.queryConsumer = (query, scopeInfo) -> {
query.and(property, scopeInfo.termType, scopeInfo.scope);
};
controllerCache.targetIdGetter = createGetter(UserAttachEntity.class, UserAttachEntity::getUserId);
controllerCache.queryConsumer = (query, scopeInfo) -> {
query.and(property, scopeInfo.termType, scopeInfo.scope);
};
代码示例来源:origin: hs-web/hsweb-framework
query.and(info.getField(), termType, value);
代码示例来源:origin: hs-web/hsweb-framework
.createQuery(authorizationSettingDetailDao)
.where(status, STATE_OK)
.and().in(settingId, settingIdList)
.listNoPaging();
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Caching(put = {
@CachePut(cacheNames = "oauth2-access-token", key = "'refresh:'+#result.refreshToken"),
@CachePut(cacheNames = "oauth2-access-token", key = "'token:'+#result.accessToken"),
@CachePut(cacheNames = "oauth2-access-token", key = "'cgo'+#result.clientId+#result.grantType+#result.ownerId")
})
public OAuth2AccessToken saveOrUpdateToken(OAuth2AccessToken token) {
Assert.notNull(token, "token can not be null!");
int total = DefaultDSLQueryService
.createQuery(oAuth2AccessDao)
.where("clientId", token.getClientId())
.and("grantType", token.getGrantType())
.and("ownerId", token.getOwnerId()).total();
token.setUpdateTime(System.currentTimeMillis());
if (total > 0) {
DefaultDSLUpdateService
.createUpdate(oAuth2AccessDao, token)
.where("clientId", token.getClientId())
.and("grantType", token.getGrantType())
.and("ownerId", token.getOwnerId())
.exec();
} else {
token.setCreateTime(System.currentTimeMillis());
oAuth2AccessDao.insert(((OAuth2AccessEntity) token));
}
return token;
}
}
代码示例来源:origin: hs-web/hsweb-framework
public Stream<Relation> relationStream(Supplier<List<String>> supplier) {
List<String> personIdList = supplier.get();
QueryParamEntity queryParamEntity = query.end()
.and()
.nest()
.in("relationFrom", personIdList)
.or()
.in("relationTo", personIdList)
.end()
.getParam();
return serviceContext.getRelationInfoService().select(queryParamEntity).stream()
.map(info -> {
SimpleRelation relation = new SimpleRelation();
relation.setTarget(info.getRelationTo());
relation.setTargetObject(RelationTargetHolder.get(info.getRelationTypeTo(), info.getRelationTo()).orElse(null));
relation.setRelation(info.getRelationId());
if (personIdList.contains(info.getRelationFrom())) {
relation.setDimension(info.getRelationTypeFrom());
relation.setDirection(Relation.Direction.POSITIVE);
} else {
relation.setDimension(info.getRelationTypeTo());
relation.setDirection(Relation.Direction.REVERSE);
}
return relation;
});
}
代码示例来源:origin: org.hswebframework.web/hsweb-system-oauth2-server-local
@Override
@Cacheable(cacheNames = "oauth2-access-token", key = "'cgo'+#token.clientId+#token.grantType+#token.ownerId")
public OAuth2AccessToken tryGetOldToken(OAuth2AccessToken token) {
OAuth2AccessToken old = DefaultDSLQueryService
.createQuery(oAuth2AccessDao)
.where("clientId", token.getClientId())
.and("grantType", token.getGrantType())
.and("ownerId", token.getOwnerId())
.single();
return old;
}
内容来源于网络,如有侵权,请联系作者删除!