Skip to content

Latest commit

 

History

History
49 lines (47 loc) · 1.59 KB

README.md

File metadata and controls

49 lines (47 loc) · 1.59 KB

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