50 lines
2.1 KiB
XML
50 lines
2.1 KiB
XML
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||
|
<mapper namespace="com.example.demo1.dao.UserDao">
|
||
|
|
||
|
<select id="findBySearch" resultType="com.example.demo1.entity.User">
|
||
|
select * from user
|
||
|
<where>
|
||
|
<if test="params!=null and params.username!=null and params.username!=''">
|
||
|
and username like concat('%',#{params.username},'%')
|
||
|
</if>
|
||
|
<if test="params!=null and params.phone!=null and params.phone!=''">
|
||
|
and phone like concat('%',#{params.phone},'%')
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
</mapper>
|
||
|
<!--<mapper namespace="com.example.demo1.mapper.UserMapper">-->
|
||
|
|
||
|
<!-- <sql id="Base_Column_List">-->
|
||
|
<!-- id,username,password,name,phone,email,avatar,role-->
|
||
|
<!-- </sql>-->
|
||
|
<!-- <insert id="insert" parameterType="com.example.demo1.entity.User" useGeneratedKeys="true">-->
|
||
|
<!-- insert into user-->
|
||
|
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
|
||
|
<!-- <if test="id !=null">id,</if>-->
|
||
|
<!-- <if test="username !=null">username,</if>-->
|
||
|
<!-- <if test="password !=null">password,</if>-->
|
||
|
<!-- <if test="name !=null">name,</if>-->
|
||
|
<!-- <if test="phone !=null">phone,</if>-->
|
||
|
<!-- <if test="email !=null">email,</if>-->
|
||
|
<!-- <if test="avatar !=null">avatar,</if>-->
|
||
|
<!-- <if test="role !=null">role,</if>-->
|
||
|
|
||
|
<!-- </trim>-->
|
||
|
<!-- <trim prefix="values(" suffix=")" suffixOverrides=",">-->
|
||
|
<!-- <if test="id !=null">#{id},</if>-->
|
||
|
<!-- <if test="username !=null">#{username},</if>-->
|
||
|
<!-- <if test="password !=null">#{password},</if>-->
|
||
|
<!-- <if test="name !=null">#{name},</if>-->
|
||
|
<!-- <if test="phone !=null">#{phone},</if>-->
|
||
|
<!-- <if test="email !=null">#{email},</if>-->
|
||
|
<!-- <if test="avatar !=null">#{avatar},</if>-->
|
||
|
<!-- <if test="role !=null">#{role},</if>-->
|
||
|
|
||
|
|
||
|
<!-- </trim>-->
|
||
|
<!-- </insert>-->
|
||
|
<!--</mapper>-->
|