Magician has released a new version
This update is mainly to upgrade Magician-Web and Magician-JDBC.
The changes are as follows:
Fix the problem that the wildcard of magician-Web interceptor is too strict
Enhance the sql helper of Magician-JDBC
The interceptor wildcard is too strict
In the previous version, if our interface URL is like this:
[/Api/order/list, /api/order/create, /api/lottery/list]
If you want to intercept all interfaces beginning with api, you can definitely consider configuring in the interceptor
Unfortunately, the previous version does not support it. You must either configure [pattren="/api/order/"] to intercept all interfaces beginning with [/api/order/], or configure [pattren="/api/lottery/ "] Intercept all interfaces beginning with [/api/lottery/], or configure like the following
But this will be a bit problematic. It is not flexible enough. It is equivalent to limiting the number of URL levels. It must be equal to 3 levels, not more or less. So the new version fixes this small problem, now it can be configured like this
Enhanced SqlBuilder of Magician-JDBC
Let me take a query as an example. Previously the where condition must be like this
There are three problems with writing like this
The parameter of the where method is too long and difficult to read
If the conditions require dynamic splicing, you have to define a StringBuffer yourself
The last group by, order by, limit, etc. are nested with where, which is a bit strange
So in this version, this area has been enhanced, and the example above is still the same, we can change it to this
Where can be passed in multiple times, and SqlBuilder will automatically splice these conditions. If written in this way, line by line is very clear, and if you encounter the need to dynamically spell sql, you can do this
Let's talk about a little episode here. The sql assistant should be able to understand it literally. It is just an assistant for writing sql, not the design idea of sql coding, let alone the JPA set of things. He is just a tool to assist in writing sql. And only for the addition, deletion and modification of a single table.
Magician-JDBC has followed the design direction of writing SQL from the beginning. All peripheral tools are for writing SQL more conveniently. Don't understand it wrongly, ^_^.
Magician official website: https://www.magician-io.com
版权声明: 本文为 InfoQ 作者【Magician网络编程包】的原创文章。
原文链接:【http://xie.infoq.cn/article/53f54e61771e6749f90db4651】。
本文遵守【CC-BY 4.0】协议,转载请保留原文出处及本版权声明。
评论