Disjunction and conjunction are logical or logical and can be used to construct complex SQL query conditions. The example is as follows:
Private void checkbsc_lj (criteria querycriteria)
{
Disjunction disjunction = restrictions. disjunction ();
Criterion Cirterion = restrictions. sqlrestriction ("simulportcapacity <simulportcapacityocupied". tolowercase ());
Disjunction. Add (Cirterion );
Cirterion = restrictions. sqlrestriction ("adslportcapacity <adslportcapacityoccupied". tolowercase ());
Disjunction. Add (Cirterion );
Cirterion = restrictions. sqlrestriction ("lanportcapacity <lanportcapacityoccupied". tolowercase ());
Disjunction. Add (Cirterion );
// ONU port. At least one port must be input.
Conjunction conjunction = restrictions. conjunction ();
Cirterion = restrictions. eq ("lanportcapacity", 0 );
Conjunction. Add (Cirterion );
Cirterion = restrictions. eq ("simulportcapacity", 0 );
Conjunction. Add (Cirterion );
Cirterion = restrictions. eq ("adslportcapacity", 0 );
Conjunction. Add (Cirterion );
Disjunction. Add (conjunction );
Querycriteria. Add (disjunction );
}
The constructed conditions are as follows:
Select *
From AAAA this _
Where (simulportcapacity <simulportcapacityocupied or
Adslportcapacity <adslportcapacityoccupied or
Lanportcapacity <lanportcapacityoccupied or
(This _. lanportcapacity =? And this _. simulportcapacity =? And
This _. adslportcapacity = ?))