ひとめでConditionBean
ConditionBeanの機能
データの取得
データの取得 @Java
MemberCB cb = new MemberCB();
cb.setupselect_Memberstatus();
cb.specify().specifyMemberstatus().columnMemberstatusName();
cb.setupselect_MembersecurityAsOne();
cb.setupselect_MemberserviceAsOne().withserviceRank();
cb.setupselect_MemberAddress(currentDate);
cb.specify().derivedMemberLoginList().max(new subQuery<MemberLoginCB>() {
public void query(MemberLoginCB subCB) {
subCB.specify().columnLoginDatetime();
subCB.query().setMobileLoginFlg_Equal_False();
}
}, Member.ALIAs_latestLoginDatetime);
ListResultBean<Member> memberList = memberBhv.selectList(cb);
memberBhv.loadPurchase(memberList, new ConditionBeansetupper<Pu...CB>() {
public void setup(PurchaseCB cb) {
cb.query().addOrderBy_PurchaseDatetime_Desc();
}
});
データの絞り込み
データの絞り込み @Java
...
cb.query().setMemberId_Equal(1);
cb.query().setMemberstatusCode_Equal_正式会員();
cb.query().setMemberId_NotEqual(1);
cb.query().setMemberstatusCode_NotEqual_正式会員(1);
cb.query().setMemberId_GreaterThan(3);
cb.query().setMemberId_LessThan(3);
cb.query().setMemberId_GreaterEqual(3);
cb.query().setMemberId_LessEqual(3);
cb.query().setMemberId_Inscope(memberIdList);
cb.query().setMemberstatusCode_Inscope_AsMemberstatus(cdefList);
cb.query().setMemberName_Prefixsearch("s");
cb.query().setMemberName_Likesearch("vi"
, new LikesearchOption().likeContain());
cb.query().setMemberName_Likesearch("to vi"
, new LikesearchOption().likeContain().splitByBlank());
cb.query().setMemberName_Likesearch("to vi"
, new LikesearchOption().likeContain().splitByBlank().asOrsplit());
cb.query().setBirthdate_IsNull();
cb.query().setBirthdate_IsNotNull();
cb.query().setMemo_IsNullOrEmpty();
Date fromMonth = new HandyDate("2005/10/01").getDate();
Date toMonth = new HandyDate("2005/12/01").getDate();
cb.query().setFormalizedDatetime_FromTo(fromMonth, toMonth
, new FromToOption().compareAsMonth());
Date toYear = new HandyDate("2005/01/01").getDate();
cb.query().setFormalizedDatetime_FromTo(null, toYear
, new FromToOption().compareAsYear().orIsNull());
Date fromDate = new HandyDate("2005/10/01").getDate();
Date toDate = new HandyDate("2005/10/03").getDate();
cb.query().setFormalizedDatetime_DateFromTo(fromDate, toDate);
cb.query().setMemberAge_RangeOf(30, 70, new RnageOfOption().orIsNull());
cb.query().existsPurchaseList(new subQuery<PurchaseCB>() {
public void query(PurchaseCB subCB) {
subCB.query().setPurchasePrice_GreaterEqual(2000);
}
});
cb.query().inscopePurchaseList(new subQuery<PurchaseCB>() {
public void query(PurchaseCB subCB) {
subCB.query().setPurchasePrice_GreaterEqual(2000);
}
});
cb.query().derivedPurchaseList().max(new subQuery<PurchaseCB>() {
public void query(PurchaseCB subCB) {
subCB.specify().columnPurchasePrice();
subCB.query().setPaymentCompleteFlg_Equal_True();
}
}).greaterEqual(2000);
cb.query().scalar_Equal().max(new subQuery<MemberCB>() {
public void query(MemberCB subCB) {
subCB.specify().columnBirthdate();
subCB.query().setMemberstatusCode_Equal_Formalized();
}
});
cb.query().scalar_Equal().max(new subQuery<MemberCB>() {
public void query(MemberCB subCB) {
subCB.specify().columnBirthdate();
}
}).partitionBy(new specifyQuery<MemberCB>() {
public void specify(MemberCB cb) {
cb.specify().columnMemberstatusCode();
}
});
cb.query().myselfInscope(new subQuery<MemberCB>() {
public void query(MemberCB subCB) {
subCB.query().setMemberstatusCode_Equal_Formalized();
}
});
cb.columnQuery(new specifyQuery<MemberCB>() {
public void specify(MemberCB cb) {
cb.specify().columnBirthdate();
}
}).lessThan(new specifyQuery<MemberCB>() {
public void specify(MemberCB cb) {
cb.specify().columnFormalizedDatetime();
}
});
cb.orscopeQuery(new subQuery<MemberCB>() {
public void query(MemberCB orCB) {
orCB.query().setMemberName_Prefixsearch("s");
orCB.query().setMemberName_Prefixsearch("J");
orCB.query().setMemberId_Equal(3);
}
});
cb.orscopeQuery(new subQuery<MemberCB>() {
public void query(MemberCB orCB) {
orCB.query().setMemberstatusCode_Equal_Withdrawal();
orCB.orscopeQueryAndPart(new AndQuery<MemberCB>() {
public void query(MemberCB andCB) {
andCB.query().setMemberId_GreaterEqual(100);
andCB.query().setFormalizedDatetime_IsNull();
}
};
}
});
cb.union(new UnionQuery<MemberCB>() {
public void query(MemberCB unionCB) {
Date targetDate = new HandyDate("2005/01/01").getDate();
unionCB.query().setBirthdate_GreaterEqual(targetDate);
}
});
...
データの並び替え
データの並び替え @Java
...
cb.query().addOrderBy_MemberId_Asc();
cb.query().addOrderBy_FormalizedDatetime_Desc();
cb.query().addOrderBy_Birthdate_Desc().withNullsFirst();
cb.query().addOrderBy_Birthdate_Desc().withNullsLast();
ManualOrderBean mob = new ManualOrderBean();
Date date24before = new HandyDate(currentDate()).addDay(-1).getDate();
mob.when_GreaterThan(date24before);
cb.query().addOrderBy_UpdateDatetime_Asc().withManualOrder(mob);
cb.query().addspecifiedDerivedOrderBy_Desc(Member.ALIAs_latestLoginDatetime);
...
検索スタイル
検索スタイル @Java
...
int count = memberBhv.selectCount(cb);
Member member = memberBhv.selectEntity(cb);
Member member = = memberBhv.selectEntityWithDeletedCheck(cb);
ListResultBean<Member> memberList = memberBhv.selectList(cb);
PagingResultBean<Member> page = memberBhv.selectPage(cb);
Date max = memberBhv.scalarselect(Date.class).max(new scalarQuery<Me...CB>() {
public void query(MemberCB cb) {
cb.specify().columnBirthdate();
cb.query().setMemberstatusCode_Equal_Formalized();
}
});
memberBhv.selectCursor(cb, new EntityRowHandler<Member>() {
public void handle(Member entity) {
Integer memberId = entity.getMemberId();
string memberName = entity.getMemberName();
...
}
});
memberBhv.queryDelete(cb);
Member member = new Member();
member.setMemberstatusCode_仮会員();
memberBhv.queryUpdate(member, cb);
...
オプション
オプション @Java
...
cb.checkInvalidQuery();
cb.lockForUpdate();
...