Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ 需求 ]支持直接审核MyBatis的XML文件 #3

Closed
hhyo opened this issue Nov 5, 2018 · 13 comments
Closed

[ 需求 ]支持直接审核MyBatis的XML文件 #3

hhyo opened this issue Nov 5, 2018 · 13 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@hhyo
Copy link
Owner

hhyo commented Nov 5, 2018

  • 第一阶段
    在SQL上线DDL语句时支持提交MyBatis的XML文件,自动解析成SQL语句,和DDL语句一起在工单详情展示,供DBA人肉审核
  • 第二阶段
    按照审核规则(可依靠soar)自动审核XML解析的语句,给出修改建议,分值低的语句自动驳回。
@hhyo hhyo added help wanted Extra attention is needed enhancement New feature or request labels Nov 5, 2018
@kai23333
Copy link

请问一下,支持直接审核MyBatis的XML文件,这个功能现在有了吗

@hhyo
Copy link
Owner Author

hhyo commented Nov 25, 2018

@kai23333 目前还没有

@hhyo
Copy link
Owner Author

hhyo commented Nov 28, 2018

可参考
image

@kai23333
Copy link

请问,如果mapper.xml文件里带有if标签的语句也可以拿出来吗,我通过读取mapper.xml,if标签是解析不出来的,这个是可以解析出来吗?

@hhyo
Copy link
Owner Author

hhyo commented Nov 30, 2018

请问,如果mapper.xml文件里带有if标签的语句也可以拿出来吗,我通过读取mapper.xml,if标签是解析不出来的,这个是可以解析出来吗?

是可以的,动态SQL就只有那几个固定的标签,最初的想法是利用MyBatis内部getBoundSql的方法来生成SQL,但是只实现一部分,过程中发现parameterType是可以在其他地方定义的,XML并不包含所有信息。

@hhyo
Copy link
Owner Author

hhyo commented Jan 27, 2019

完成XML解析成SQL:https://github.com/hhyo/mybatis-mapper2sql
后续扩展下系统内SOAR的方法就可以实现自动审核

@hhyo hhyo pinned this issue Feb 26, 2019
@hhyo hhyo mentioned this issue Mar 4, 2019
3 tasks
@hhyo
Copy link
Owner Author

hhyo commented Mar 4, 2019

对应分支:https://github.com/hhyo/archery/tree/feature/mybatis

@hhyo hhyo changed the title 支持直接审核MyBatis的XML文件 [ 需求 ]支持直接审核MyBatis的XML文件 Mar 10, 2019
@hhyo hhyo unpinned this issue Mar 18, 2019
@kai23333
Copy link

老师好,我想问一下这个parameterType在哪里自己定义,我解析到where后面比如有if标签就没有了(小菜鸡一枚)

@hhyo
Copy link
Owner Author

hhyo commented Jul 11, 2019

老师好,我想问一下这个parameterType在哪里自己定义,我解析到where后面比如有if标签就没有了(小菜鸡一枚)

参考 https://github.com/hhyo/mybatis-mapper2sql

以及Archery平台的SQL分析模块

@kai23333
Copy link

这里看过了,我用的是java,没大看明白。。。,还是谢谢老师

@hhyo hhyo closed this as completed Jul 15, 2019
@hhyo
Copy link
Owner Author

hhyo commented Jul 28, 2019

按照最初的需求,将xml文件纳入SQL上线的DDL工单中,用作前置审核

@hhyo hhyo reopened this Jul 28, 2019
@saigu
Copy link

saigu commented Sep 2, 2019

您好,请问这里将xml文件转为sql,是带占位符带吗?soar支持带占位符带sql诊断吗?

@hhyo
Copy link
Owner Author

hhyo commented Sep 2, 2019

@saigu 带占位符,soar也支持,具体可以访问demo站点的SQL分析模块体验

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants