MyBatis-Plus using (3) - Condition builder

Description:

  Appearing below the first reference boolean condition indicates that the condition is added in the last generated sql

  A plurality of the following methods within the code block are down from the full complement of parameters into individual boolean types, the default is true

  The following are presented as generic Param subclass instance Wrapper (both having all methods of AbstractWrapper)

  R appearing in the following method as a generic reference, the wrapper is in the general String, is a function of the LambdaWrapper (Example: Entity :: getId, Entity for the entity class, the id field is getId getMethod)

  The following parameters of the method are represented by database fields column R, when R is a particular type String compared database field name (field name is wrapped with its own keyword database escape!)! Instead entity class data field name! !!, another specific type when R is SFunction project runtime is not supported by its own eclipse compiler !!!

  The following examples are plain wrapper, to the Senate to form Map and List are json performance!

  If you use the parameters of the Map or List is empty, it will not join sql generated in the last !!!

  Have any questions on open source point of view, I see clicks do not understand the function of learning new knowledge

caveat:

  wrapper heavy

  Transport wrapper can be compared with a map for your controller receives a value (momentary cool development, maintenance crematorium)

  RPC calls the correct posture is transmitted to write a DTO, the callee then perform a corresponding operation according to the DTO

  We refuse to accept any issue regarding RPC transmission Wrapper error related even pr

 

1. AbstractWrapper

Description: QueryWrapper (LambdaQueryWrapper) and UpdateWrapper (LambdaUpdateWrapper) parent. Where conditions for generating the sql, entity attributes are also used to generate the conditions where the sql

Note:   the Entity generated where conditions are conditions where the use of various api generated no association behavior

1.1 allEq ( all eq or individual isNull)

allEq(Map<R, V> params)
allEq(Map<R, V> params, boolean null2IsNull)
allEq(boolean condition, Map<R, V> params, boolean null2IsNull)

The individual parameters:

  params: key for the database field name, value is the value of a field

  null2IsNull: the call to true in the map's value is null isNull method, false to ignore the value is null

Example 1: allEq ({id: 1, name: "Wang", age: null}) ---> id = 1 and name = 'Wang' and age is null

Example 2: allEq ({id: 1, name: "Wang", age: null}, false) ---> id = 1 and name = 'Wang'

1.2 eq (equal =)

eq(R column, Object val)
eq(boolean condition, R column, Object val)

 

  • Appearing below the first parameter boolean conditionrepresents the condition whether the addition of the last generation of the sql
  • A plurality of the following methods within the code block are down from a full complement of individual booleantypes of the parameters, defaultstrue
  • Generic appearing below Paramare Wrappersub-class instance (each having AbstractWrapperall methods)
  • Appear in the following method parameters in Ra generic, it is in common wrapper String, in LambdaWrapper the function (for example: Entity::getId, Entityan entity class, getIdfor the field idof getMethod )
  • The following parameters of the method R columnare represented by database fields, when the Rparticular type Stringwhen compared to a database field names ( column names of the database key wrapped their escape! )! Instead !!! entity class data field name, other when the Rspecific type is SFunctionwhen the project runtime is not supported by its own eclipse compiler !!!
  • The following examples are plain wrapper, into the reference to Mapand Listin are jsonin the form of performance!
  • If the use of the parameter Mapor Listis empty , it is not added in the last generated sql!
  • Have any questions on open source point of view, I do not understand the function of clicks I learn new things

Guess you like

Origin www.cnblogs.com/huanshilang/p/11985526.html