where set trim 三个标签的用法
- where标签
如果该标签包含的元素中有返回值,就插入一个where,如果where后面的字符串是以AND 和OR开头的,就将其剔除
UserMapper接口:
/**
* WHERE标签的使用
* @param sysUser
* @return
*/
List<SysUser> selectByUser2(SysUser sysUser);
UserMapper.xml文件:
<!-- WHERE标签的使用 -->
<select id="selectByUser2" parameterType="SysUser" resultType="SysUser">
SELECT
id,
user_name userName,
user_password userPassword,
user_email userEmail,
user_info userInfo,
head_img headImg,
create_time createTime
FROM
sys_user
<where>
<if test = "userName != null and userName != ''">
A