PackageCn.edu.hbcf.common.vo;ImportJava.math.BigDecimal;ImportJava.sql.Timestamp;Importjava.util.Date;ImportJava.util.HashMap;ImportJava.util.Map;ImportCn.edu.hbcf.common.utils.TypeCaseHelper;/*** Common conditional query classes can also be used for parameter passing between MVC layers * *@authorLipenghui **/ Public classCriteria {/*** Store Condition Query Value*/ PrivateMap<string, object>condition; /*** is the difference why is the protected type? */ Private Booleandistinct; /*** Sort Fields*/ PrivateString Orderbyclause; Private intstart; Private intlimit; PrivateInteger Oraclestart; PrivateInteger Oracleend; PublicInteger Getoraclestart () {returnOraclestart; } Public voidSetoraclestart (Integer oraclestart) { This. Oraclestart =Oraclestart; } PublicInteger getoracleend () {returnOracleend; } Public voidsetoracleend (Integer oracleend) { This. Oracleend =Oracleend; } PublicMap<string, object>getcondition () {returncondition; } Public voidSetcondition (map<string, object>condition) { This. Condition =condition; } PublicCriteria () {condition=NewHashmap<string, object>(); } Public voidClear () { This. Condition.clear (); This. Orderbyclause =NULL; This. distinct =false; This. Start = 0; This. Limit = 0; } /*** Add Query criteria * *@paramConditionkey * Name of the query condition *@paramContidionvalue * The value of the query condition *@return */ PublicCriteria put (String key, Object value) { This. Condition.put (key, value); return(Criteria) This; } /*** Get the key value, the C-layer and S-layer parameters when passing the value of the self-converted object * *@paramContionkey * Condition key value *@returnreturns the value mapped by the specified key*/ PublicObject Get (String contionkey) {return This. Condition.get (Contionkey); } PublicMap<string, object>Getconditionmap () {returncondition; } Public voidSetconditionmap (map<string, object>Conditionmap) { This. Condition =Conditionmap; } /*** does it differ * *@return */ Public Booleanisdistinct () {returndistinct; } Public voidSetdistinct (Booleandistinct) { This. distinct =distinct; } /*** Get Sort fields * *@return */ PublicString Getorderbyclause () {returnOrderbyclause; } /*** Set Sort field * *@paramOrderbyclause*/ Public voidSetorderbyclause (String orderbyclause) { This. Orderbyclause =Orderbyclause; } /*** Return key value with BigDecimal * *@paramKey * Name *@returnDate Key Value*/ PublicBigDecimal getasbigdecimal (String key) {Object obj= Typecasehelper.convert (Get (key), "BigDecimal",NULL); if(obj! =NULL) { return(BigDecimal) obj; } Else { return NULL; } } /*** Return key value as Date type * *@paramKey * Name *@returnDate Key Value*/ PublicDate getasdate (String key) {Object obj= Typecasehelper.convert (Get (key), "Date", "YYYY-MM-DD"); if(obj = =NULL) { return(Date) obj; } Else { return NULL; } } /*** Returns the key value as an integer type * *@paramKey * Name *@returnInteger Key Value*/ PublicInteger Getasinteger (String key) {Object obj= Typecasehelper.convert (Get (key), "Integer",NULL); if(obj! =NULL) { return(Integer) obj; } Else { return NULL; } } /*** Returns the key value as a long type * *@paramKey * Name *@returnLong Key Value*/ PublicLong Getaslong (String key) {Object obj= Typecasehelper.convert (Get (key), "Long",NULL); if(obj! =NULL) { return(Long) obj; } Else { return NULL; } } /*** Return key value As String type * *@paramKey * Name *@returnKey Value*/ Publicstring getasstring (String key) {Object obj= Typecasehelper.convert (Get (key), "String",NULL); if(obj! =NULL) { return(String) obj; } Else { return NULL; } } /*** Return key value as timestamp type * *@paramKey * Name *@returnTimestamp key value*/ PublicTimestamp Getastimestamp (String key) {Object obj= Typecasehelper.convert (Get (key), "Timestamp",NULL); if(obj! =NULL) { return(Timestamp) obj; } Else { return NULL; } } /*** Returns the key value as a Boolean type * *@paramKey * Name *@returnBoolean key value*/ PublicBoolean Getasboolean (String key) {Object obj= Typecasehelper.convert (Get (key), "Boolean",NULL); if(obj! =NULL) { return(Boolean) obj; } Else { return NULL; } } Public intGetstart () {returnstart; } Public voidSetstart (intstart) { This. Start =start; } Public intGetlimit () {returnlimit; } Public voidSetlimit (intlimit) { This. Limit =limit; }}
Criteria for public query class