The method of passing multiple parameters to the Interface in Mybatis
This article introduces the relevant knowledge of "how to input multiple parameters into the interface in Mybatis". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Use @ Param annotations
List getJgQjcs (@ Param (value = "jgbm") String jgbm, @ Param (value = "csbm") String csbm)
Directly take the corresponding name parameter value in the corresponding mapper file
SELECT a.JGBM ON a.JGBM=b.JGBM and b.CSBM=# coalesce (b.CSBM) AS CSBM,coalesce (b.CSZmc.MRZ) AS CSZ FROM SYS_ZCJG a LEFT JOIN SYS_CSSZ b ON a.JGBM=b.JGBM and b.CSBM=# {csbm,jdbcType=VARCHAR} LEFT JOIN SYS_CSLB c ON c.CSBM=# {csbm,jdbcType=VARCHAR} WHERE a.jgbm=# {jgbm,jdbcType=VARCHAR}
2. Use sequential position to identify parameters.
SELECT a.JGBM ON c.CSBM=# coalesce (b.CSBM, C.CSBM) AS CSBM,coalesce (b.CSZ, C.MRZ) AS CSZ FROM SYS_ZCJG a LEFT JOIN SYS_CSSZ b ON a.JGBM=b.JGBM and b.CSBM=# {1} LEFT JOIN SYS_CSLB c ON c.CSBM=# {1} CSBM {0}
3. The commonly used map is used as a method input parameter
The first one is recommended by individuals, which is convenient to see the incoming parameters intuitively.
This is the end of the content of "the method of passing multiple parameters to the interface in Mybatis". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!