<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<!DOCTYPE mapper
PUBLIC "-////DTD Mapper 3.0//EN">
<
mapper
namespace
=
""
>
<!-- Result Map-->
<
resultMap
type
=
""
id
=
"BaseResultMap"
>
<
result
property
=
"id"
column
=
"id"
/>
<
result
property
=
"name"
column
=
"name"
/>
<
result
property
=
"sex"
column
=
"sex"
/>
<
result
property
=
"birs"
column
=
"birs"
jdbcType
=
"TIMESTAMP"
/>
<
result
property
=
"message"
column
=
"message"
jdbcType
=
"CLOB"
javaType = "" typeHandler =""/>
</
resultMap
>
<
sql
id
=
"Tabel_Name"
>
t_users
</
sql
>
<!-- 表中所有列 -->
<
sql
id
=
"Base_Column_List"
>
id,name,sex,birs,message
</
sql
>
<!-- 查询条件 -->
<
sql
id
=
"Example_Where_Clause"
>
where 1=1
<
trim
suffixOverrides
=
","
>
<
if
test
=
"id != null"
>
and id = #{id}
</
if
>
<
if
test
=
"name != null and name != ''"
>
and name like concat(concat('%', '${name}'), '%')
</
if
>
<
if
test
=
"sex != null and sex != ''"
>
and sex like concat(concat('%', '${sex}'), '%')
</
if
>
<
if
test
=
"birs != null"
>
and birs = #{birs}
</
if
>
<
if
test
=
"message != null"
>
and message = #{message}
</
if
>
</
trim
>
</
sql
>
<!-- 2.查询列表 -->
<
select
id
=
"queryByList"
resultMap
=
"BaseResultMap"
parameterType
=
"Object"
>
select
<
include
refid
=
"Base_Column_List"
/>
from t_users
<
include
refid
=
"Example_Where_Clause"
/>
</
select
>
</
mapper
>