EasyCode 官方地址
有中文官網,安裝使用文檔一應俱全。就不多廢話了。
簡單看下生成代碼的界面
idea》database》 找到數據庫表
(支持多選)
右鍵》EeayCode》Generate Code
看下設置所在
自定義模板
在mapper.xml
里加個多條件列表查尋試試:
<!--多條件列表查尋-->
<select id="listByParam" resultMap="$!{tableInfo.name}Map">
select
#allSqlColumn()
from $!{tableInfo.obj.parent.name}.$!tableInfo.obj.name
<trim prefix="WHERE" prefixOverrides="AND |OR ">
#foreach($column in $tableInfo.pkColumn)
<if test="ids != null">
<foreach item="item" index="index" collection="ids" open=" AND( " separator=" or " close=" ) ">
$column.obj.name = #{item}
</foreach>
</if>
#end
#foreach($column in $tableInfo.otherColumn)
<if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end">
$!column.obj.name = #{$!column.name},
</if>
#if($column.type.equals("java.util.Date"))
<if test="$!{column.name}Begin !=null and $!{column.name}Begin !=''">
<![CDATA[
AND $!column.obj.name >= #{$!{column.name}Begin}
]]>
</if>
<if test="$!{column.name}End !=null and $!{column.name}End !=''">
<![CDATA[
AND $!column.obj.name >= #{$!{column.name}End}
]]>
</if>
#end
#end
</trim>
<if test="orderType == null or orderType == '' or orderType=='default'">
order by $!column.obj.name asc
</if>
<if test="offset != null and offset == '' and limit != null and limit == ''">
limit #{offset}, #{limit}
</if>
</select>