本文整理了Java中org.hswebframework.ezorm.core.dsl.Update
类的一些代码示例,展示了Update
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Update
类的具体详情如下:
包路径:org.hswebframework.ezorm.core.dsl.Update
类名称:Update
暂无
代码示例来源:origin: hs-web/hsweb-framework
@Override
public boolean disable(String userId) {
if (!StringUtils.hasLength(userId)) {
return false;
}
return createUpdate(getDao())
.set(UserEntity.status, DataStatus.STATUS_DISABLED)
.where(GenericEntity.id, userId)
.exec() > 0;
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public void cancelDeployed(String formId, long version) {
Objects.requireNonNull(formId);
createUpdate()
.set(DynamicFormDeployLogEntity.status, DataStatus.STATUS_DISABLED)
.where(DynamicFormDeployLogEntity.formId, formId)
.and(DynamicFormDeployLogEntity.version, version)
.exec();
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public int updateByPk(PK pk, E entity) {
Assert.notNull(pk, "primary key can not be null");
Assert.hasText(String.valueOf(pk), "primary key can not be null");
Assert.notNull(entity, "entity can not be null");
entity.setId(pk);
tryValidate(entity, UpdateGroup.class);
return createUpdate(entity)
//如果是RecordCreationEntity则不修改creator_id和creator_time
.when(entity instanceof RecordCreationEntity,
update -> update.and().excludes(((RecordCreationEntity) entity).getCreatorIdProperty(), RecordCreationEntity.createTime))
.where(GenericEntity.id, pk)
.exec();
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Caching(put = {
@CachePut(key = "'ownerId:'+#result.ownerId"),
@CachePut(key = "'id:'+#result.id")
})
public OAuth2Client save(OAuth2Client oAuth2Client) {
OAuth2Client old = getClientById(oAuth2Client.getId());
if (old != null) {
DefaultDSLUpdateService
.createUpdate(oAuth2ClientDao, oAuth2Client)
.excludes("id", "createTime")
.where("id", oAuth2Client.getId()).exec();
} else {
oAuth2ClientDao.insert(((SimpleOAuth2ClientEntity) oAuth2Client));
}
return oAuth2Client;
}
代码示例来源: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
private String saveOrUpdate0(DynamicFormColumnEntity columnEntity) {
if (StringUtils.isEmpty(columnEntity.getId())
|| DefaultDSLQueryService.createQuery(formColumnDao)
.where(DynamicFormColumnEntity.id, columnEntity.getId())
.total() == 0) {
if (StringUtils.isEmpty(columnEntity.getId())) {
columnEntity.setId(getIDGenerator().generate());
}
tryValidate(columnEntity, CreateGroup.class);
formColumnDao.insert(columnEntity);
} else {
tryValidate(columnEntity, UpdateGroup.class);
DefaultDSLUpdateService
.createUpdate(formColumnDao, columnEntity)
.where(DynamicFormColumnEntity.id, columnEntity.getId())
.exec();
}
return columnEntity.getId();
}
代码示例来源:origin: hs-web/hsweb-easy-orm
public <V> Update<T, Q> set(StaticMethodReferenceColumn<V> column, Object value) {
return set(column.getColumn(), value);
}
代码示例来源:origin: hs-web/hsweb-easy-orm
public int exec() {
return proxy.exec();
}
代码示例来源:origin: hs-web/hsweb-easy-orm
@Override
public UpdateFromBean<T, Q, B> and() {
proxy.and();
return this;
}
代码示例来源:origin: hs-web/hsweb-easy-orm
public UpdateFromBean<T, Q, B> excludes(String... columns) {
proxy.excludes(columns);
return this;
}
代码示例来源:origin: hs-web/hsweb-framework
static <E> Update<E, UpdateParamEntity<E>> createUpdate(UpdateByEntityDao dao, E data) {
return Update.build(dao::update, new UpdateParamEntity<>(data));
}
}
代码示例来源:origin: hs-web/hsweb-easy-orm
public static <T, P extends UpdateParam<T>> Update<T, P> build(Executor<P> executor, P param) {
return new Update<>(param).setExecutor(executor);
}
代码示例来源:origin: hs-web/hsweb-framework
/**
* @since 3.0.4
*/
public static <T> Update<T, UpdateParamEntity<T>> newUpdate() {
return new Update<>(new UpdateParamEntity<>());
}
代码示例来源:origin: hs-web/hsweb-framework
.excludes(excludeProperties.toArray(new String[excludeProperties.size()]))
.where(GenericEntity.id, userEntity.getId())
.exec();
if (userEntity instanceof BindRoleUserEntity) {
BindRoleUserEntity bindRoleUserEntity = ((BindRoleUserEntity) userEntity);
代码示例来源:origin: org.hswebframework.web/hsweb-system-oauth2-server-local
@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: org.hswebframework.web/hsweb-system-dynamic-form-local
private String saveOrUpdate0(DynamicFormColumnEntity columnEntity) {
if (StringUtils.isEmpty(columnEntity.getId())
|| DefaultDSLQueryService.createQuery(formColumnDao)
.where(DynamicFormColumnEntity.id, columnEntity.getId())
.total() == 0) {
if (StringUtils.isEmpty(columnEntity.getId())) {
columnEntity.setId(getIDGenerator().generate());
}
tryValidate(columnEntity, CreateGroup.class);
formColumnDao.insert(columnEntity);
} else {
tryValidate(columnEntity, UpdateGroup.class);
DefaultDSLUpdateService
.createUpdate(formColumnDao, columnEntity)
.where(DynamicFormColumnEntity.id, columnEntity.getId())
.exec();
}
return columnEntity.getId();
}
代码示例来源:origin: hs-web/hsweb-easy-orm
public <V> Update<T, Q> set(MethodReferenceColumn<V> column) {
return set(column.getColumn(), column.get());
}
代码示例来源:origin: hs-web/hsweb-easy-orm
public UpdateFromBean<T, Q, B> and(String column, String termType, Object value) {
proxy.and(column, termType, value);
return this;
}
代码示例来源:origin: hs-web/hsweb-easy-orm
@SafeVarargs
public final <B> Update<T, Q> excludes(MethodReferenceColumn<B>... columns) {
return excludes(Arrays.stream(columns).map(MethodReferenceColumn::getColumn).toArray(String[]::new));
}
代码示例来源:origin: hs-web/hsweb-framework
static <E> Update<E, UpdateParamEntity<E>> createUpdate(UpdateByEntityDao dao) {
return Update.build(dao::update, new UpdateParamEntity<>());
}
内容来源于网络,如有侵权,请联系作者删除!