Skip to content

zhangaijing/scanner-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sql语句和Mybatis互转工具

Sql转Mybatis

支持批量INSERT,UPDATE,DELETE语句

支持数字、字符串、IN、BETWEEN、LIKE等常用表达式

支持特定特定条件不转换(数值前加#)

使用事例

Sql语句:

select a from table where b in (select b from dtable where c=1 and d=1 and e in (1,3)) and dd=#12313

点击【SQL转Mybatis】按钮直接转换为:

转换后的Mybatis语句:

<select id="getProjectById" resultType="com.sdk.bo.ProjectBO"> select a from table where 1=1 AND b in ( select b from dtable where 1=1 <if test="c!=null and c!=''"> AND c=#{c} </if> <if test="d!=null and d!=''"> and d=#{d} </if> <if test="eList !=null and eList.size()>0"> and e in <foreach item="e" index="index" collection="eList" open="(" separator="," close=")"> #{e} </foreach> </if> ) and dd=12313 </select>

Mybatis转Sql

使用事例

Mybatis语句:

==> Preparing: select id, bucket_name, object_key, etag, version_id, creator, created, file_name, file_ext, file_size, updator, updated, enabled, object_url from ability_obs where id = ?

==> Parameters: 458898(Long)

点击【Mybatis转SQL】按钮直接转换为:

Sql语句:

select id, bucket_name, object_key, etag, version_id, creator, created, file_name, file_ext, file_size, updator, updated, enabled, object_url from ability_obs where id = 458898

Releases

No releases published

Packages

No packages published