- 想要
Mybatis
自动生成的xml
文件中sql
代码带有判断空,如下:
<if test="type!=null and type!=''">
AND type = #{type}
</if>
- 有没有这种功能?在哪里配置?
Mybatis
自动生成的 xml
文件中 sql
代码带有判断空,如下:<if test="type!=null and type!=''">
AND type = #{type}
</if>
mybatis-generator
可以生成如下代码
<if test="type!=null">
AND type = #{type}
</if>
如果要支持 and type!=''
等自定义功能, 可以自己编写plugin
4 回答1.5k 阅读✓ 已解决
4 回答1.3k 阅读✓ 已解决
1 回答2.6k 阅读✓ 已解决
2 回答765 阅读✓ 已解决
2 回答1.8k 阅读
2 回答1.7k 阅读
2 回答1.3k 阅读
问题解决了,修改 Mybaits Generator 配置即可。