本文整理汇总了Java中com.mysema.query.sql.SQLQuery.where方法的典型用法代码示例。如果您正苦于以下问题:Java SQLQuery.where方法的具体用法?Java SQLQuery.where怎么用?Java SQLQuery.where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysema.query.sql.SQLQuery
的用法示例。
在下文中一共展示了SQLQuery.where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllFast
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
/**
* Uses the full bean, but optimized SQL
*
* @param offset
* @param limit
* @return
* @throws Exception
*/
private List<WalkerEntityref100> getAllFast(long offset, long limit)
throws Exception {
Connection conn = getConnection();
QWalkerEntityref100 t = new QWalkerEntityref100("t");
SQLQuery sq = from(conn, t);
/*
* XXX: Note that we are treating offset and limit differently than
* usual. When using it in a between statement, we need to use
* limit+offset
*/
sq = sq.where(t.entityrefId.between(offset, limit + offset).and(
t.idtypeId.notIn(idTypeDAO.getSkipTypes())));
/*
* Note that we are not sorting the elements here, in order to speed
* things up.
*/
logger.debug("Query: " + sq.toString());
List<WalkerEntityref100> results = sq.list(t);
conn.close();
return results;
}
示例2: getCodeList
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional(readOnly = true)
@Override
public List<CodeEntry> getCodeList(String codeName) {
SQLQuery query = queryFactory.from(qcm);
query.where(qcm.name.eq(codeName));
query.orderBy(qcm.sortOrder.asc());
return query.list(new QBean<>(CodeEntry.class, qcm.value, qcm.label, qcm.sortOrder));
}
示例3: addSpec
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private void addSpec(SQLQuery sqlQuery) {
for (BooleanExpression expression : QueryExampleHelper.getExpressions(pathBase, example)) {
sqlQuery.where(expression);
}
if (example.isDistinct()) {
sqlQuery.distinct();
}
addLimit(example, sqlQuery);
addOffset(example, sqlQuery);
for (OrderSpecifier<?> spec : QueryExampleHelper.getOrderSpecs(pathBase, example)) {
sqlQuery.orderBy(spec);
}
}
示例4: fromService
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private SQLQuery fromService(Transaction tx) {
SQLQuery query = tx.query().from(service)
.join(publishedService).on(publishedService.serviceId.eq(service.id))
.join(environment).on(environment.id.eq(publishedService.environmentId));
if(!s.isTrusted()) {
query.where(environment.confidential.isFalse());
}
return query;
}
示例5: getTemplate
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional
@Override
public MailData getTemplate(String templateName) {
SQLQuery querya = queryDslJdbcOperations.newSqlQuery();
querya.from(mt);
querya.where(mt.templateName.eq(templateName), mt.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
Tuple templ = queryDslJdbcOperations
.queryForObject(querya, new QTuple(mt.id, mt.fromAddr, mt.subject, mt.body));
SQLQuery queryb = queryDslJdbcOperations.newSqlQuery();
queryb.from(mtr);
queryb.where(mtr.templateId.eq(templ.get(mt.id)), mtr.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
List<Tuple> templAddr = queryDslJdbcOperations.query(queryb, new QTuple(mtr.rcptType, mtr.rcptAddr));
List<String> toAddr = new ArrayList<>();
List<String> ccAddr = new ArrayList<>();
List<String> bccAddr = new ArrayList<>();
for (Tuple addr : templAddr) {
RcptType type = RcptType.valueOf(addr.get(mtr.rcptType));
if (type == RcptType.TO) {
toAddr.add(addr.get(mtr.rcptAddr));
}
if (type == RcptType.CC) {
ccAddr.add(addr.get(mtr.rcptAddr));
}
if (type == RcptType.BCC) {
bccAddr.add(addr.get(mtr.rcptAddr));
}
}
MailData template = new MailData();
template.setFromAddr(templ.get(mt.fromAddr));
template.setToAddr(toAddr);
template.setCcAddr(bccAddr);
template.setBccAddr(bccAddr);
template.setSubject(templ.get(mt.subject));
template.setBody(templ.get(mt.body));
return template;
}
示例6: findByValue
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional(readOnly = true)
@Override
public CodeEntry findByValue(String codeName, String value) {
SQLQuery query = queryDslJdbcOperations.newSqlQuery();
query.from(qcm);
query.where(qcm.name.eq(codeName), qcm.value.eq(value), qcm.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
return queryDslJdbcOperations.queryForObject(query, new QBean<>(CodeEntry.class, qcm.value, qcm.label,
qcm.sortOrder));
}
示例7: getCodeList
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional(readOnly = true)
@Override
public List<CodeEntry> getCodeList(String codeName) {
SQLQuery query = queryDslJdbcOperations.newSqlQuery();
query.from(qcm);
query.where(qcm.name.eq(codeName), qcm.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
query.orderBy(qcm.sortOrder.asc());
return queryDslJdbcOperations.query(query, new QBean<>(CodeEntry.class, qcm.value, qcm.label, qcm.sortOrder));
}
示例8: getNumberOfWorkday
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Override
public int getNumberOfWorkday(String name, LocalDate from, LocalDate to) {
SQLQuery query = queryDslJdbcOperations.newSqlQuery();
query.from(h0);
query.where(h0.name.eq(name), h0.dt.between(constant(from), constant(to)), h0.deletedFlg.eq(NOT_DELETED.code()));
long count = queryDslJdbcOperations.queryForObject(query, h0.dt.count());
return Days.daysBetween(from, to).getDays() + 1 - (int) count;
}
示例9: joinSourceDatasetVersion
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private SQLQuery joinSourceDatasetVersion(SQLQuery query) {
query
.join(sourceDatasetVersion).on(sourceDatasetVersion.sourceDatasetId.eq(sourceDataset.id))
.where(sourceDatasetVersion.id.in(new SQLSubQuery().from(sourceDatasetVersion)
.where(sourceDatasetVersion.sourceDatasetId.eq(sourceDataset.id))
.list(sourceDatasetVersion.id.max())));
if(s.isTrusted()) {
return query;
} else {
return query.where(sourceDatasetVersion.metadataConfidential.isFalse());
}
}
示例10: getAllTuples
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private List<Tuple> getAllTuples(long offset, long limit) throws Exception {
Connection conn = getConnection();
QWalkerEntityref100 t = new QWalkerEntityref100("t");
SQLQuery sq = from(conn, t);
/*
* Use the built-in Id to grab a range. Here we are assuming that the
* id's were assigned in a continuous fashion , so be careful, this code
* is not portable.
*
* We also skip over some list of idTypes, again this is very
* customer/data specific.
*/
/*
* XXX: Note that we are treating offset and limit differently than
* usual. When using it in a between statement, we need to use
* limit+offset
*/
sq = sq.where(t.entityrefId.between(offset, limit + offset));
List<Integer> st = idTypeDAO.getSkipTypes();
if (st != null && st.size() > 0) {
logger.debug("Adding constraint to filter skipped types");
sq.where(t.idtypeId.notIn(st));
} else {
logger.debug("No types to skip were specified.");
}
/*
* Note that we are not sorting the elements here, in order to speed
* things up.
*/
logger.debug("Query: " + sq.toString());
List<Tuple> results = sq.list(t.accountnumber, t.accountnumber,
t.identifier, t.idtypeId);
conn.close();
return results;
}
示例11: getNumberOfWorkday
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional
@Override
public int getNumberOfWorkday(String name, LocalDate from, LocalDate to) {
SQLQuery query = queryFactory.from(h0);
query.where(h0.name.eq(name), h0.dt.between(constant(from), constant(to)), h0.deletedFlg.eq(NOT_DELETED.code()));
long count = query.uniqueResult(h0.dt.count());
return Days.daysBetween(from, to).getDays() + 1 - (int) count;
}
示例12: createBaseQuery
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private SQLQuery createBaseQuery(String numberName) {
SQLQuery query = queryDslJdbcOperations.newSqlQuery();
query.from(nm);
query.where(nm.name.eq(numberName), nm.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
return query;
}
示例13: executeGetNotifications
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private Object executeGetNotifications (final GetNotifications query) throws Exception {
final SQLQuery baseQuery = query ().from (datasetActiveNotification);
if (!query.isIncludeRejected ()) {
baseQuery.where (datasetActiveNotification.notificationResult.ne (ConfirmNotificationResult.NOT_OK.name ()));
}
if (query.getSince () != null) {
baseQuery.where (datasetActiveNotification.jobCreateTime.gt (query.getSince ()));
}
final List<StoredNotification> notifications = new ArrayList<> ();
for (final Tuple t: applyListParams (baseQuery.clone (), query, datasetActiveNotification.jobCreateTime)
.list (
datasetActiveNotification.notificationId,
datasetActiveNotification.notificationType,
datasetActiveNotification.notificationResult,
datasetActiveNotification.jobId,
datasetActiveNotification.jobType,
datasetActiveNotification.datasetId,
datasetActiveNotification.datasetIdentification,
datasetActiveNotification.datasetName
)) {
notifications.add (new StoredNotification (
(long)t.get (datasetActiveNotification.notificationId),
ImportNotificationType.valueOf (t.get (datasetActiveNotification.notificationType)),
ConfirmNotificationResult.valueOf (t.get (datasetActiveNotification.notificationResult)),
new JobInfo (
t.get (datasetActiveNotification.jobId),
JobType.valueOf (t.get (datasetActiveNotification.jobType))
),
new BaseDatasetInfo (
t.get (datasetActiveNotification.datasetIdentification),
t.get (datasetActiveNotification.datasetName)
)
));
}
return new InfoList<StoredNotification> (notifications, baseQuery.count ());
}
示例14: commonClause
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private QueryConfigurer commonClause(final AppliedEx50Form form) {
return new QueryConfigurer() {
@Override
public SQLQuery configure(SQLQuery query) {
query.from(et1);
if (StringUtils.isNotEmpty(form.getText10())) {
query.where(et1.text10.startsWith(form.getText10()));
}
if (form.getInt64From() != null) {
query.where(et1.int64.goe(form.getInt64From()));
}
if (form.getInt64To() != null) {
query.where(et1.int64.loe(form.getInt64To()));
}
if (form.getDecimal1From() != null) {
query.where(et1.decimal1.goe(form.getDecimal1From()));
}
if (form.getDecimal1To() != null) {
query.where(et1.decimal1.loe(form.getDecimal1To()));
}
if (form.getDecimal3From() != null) {
query.where(et1.decimal3.goe(form.getDecimal3From()));
}
if (form.getDecimal3To() != null) {
query.where(et1.decimal3.loe(form.getDecimal3To()));
}
if (form.getDtFrom() != null) {
query.where(et1.dt.goe(form.getDtFrom()));
}
if (form.getDtTo() != null) {
query.where(et1.dt.loe(form.getDtTo()));
}
if (form.getTmFrom() != null) {
query.where(et1.tm.goe(form.getTmFrom()));
}
if (form.getTmTo() != null) {
query.where(et1.tm.loe(form.getTmTo()));
}
if (form.getDtmFromD() != null && form.getDtmFromT() != null) {
query.where(et1.dtm.goe(form.getDtmFromD().toLocalDateTime(form.getDtmFromT())));
}
if (form.getDtmToD() != null && form.getDtmToT() != null) {
query.where(et1.dtm.loe(form.getDtmToD().toLocalDateTime(form.getDtmToT())));
}
return query;
}
};
}
示例15: createBaseQuery
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private SQLQuery createBaseQuery(String numberName) {
SQLQuery query = queryFactory.from(nm);
query.where(nm.name.eq(numberName), nm.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
return query;
}