MyBatis中@Param注解

直接上代码

//UserMapper.java
//高级查询
List  query(@Param("qo")UserObjectQuery qo);
//UserMapper.xml
<select id="query" resultType="User">
    SELECT id,name,sn,deptid FROM t_user
    <where>
        <if test="qo.keyword!=null">AND name LIKE concat('%',#{qo.keyword},'%')if>
    where>
select>

//UserMapper.java
//高级查询
List  query(UserObjectQuery qo);
//UserMapper.xml
<select id="query" resultType="User">
    SELECT id,name,sn,deptid FROM t_user
    <where>
        <if test="keyword!=null">AND name LIKE concat('%',#{keyword},'%')if>
    where>
select>

你可能感兴趣的:(Java,MyBatis)