<select id = "" resultMap = ""> select * from table <choose> <when test=" type == 'x1' '"> ...
<select id = "" resultMap = ""> select * from table <choose> <when test=" type == 'x1' '"> ...
一、需求 后台使用orcale数据库,mybatis做持久层,前台搜索功能,根据类型搜索,但是数据库中没有类型字段, 所以需要在where条件语句中进行判断,当type == x1 时 ...
一、<choose><when><otherwise> 这是一套标签, 功能类似于 switch...case... ...
choose标签是按顺序判断其内部when标签中的test条件出否成立,如果有一个成立,则 choose 结束。当 choose 中所有 when 的条件都不满则时,则执行 otherwise 中的sql。类似于Java 的 switch 语句,choose 为 switch,when ...
一、choose 标签 choose 主要用于分支判断,类似于 java 中带了 break的 switch...case,只会满足所有分支中的一个。 语法格式: 标签说明: <choose>:选择 ...