赞
踩
- <select id="selectLikeUser" resultType="com.cjc.mybatis.entity.User">
- select * from t_user where username like '%${name}%'
- </select>
- <select id="selectLikeUser" resultType="com.cjc.mybatis.entity.User">
- select * from t_user where username like concat('%',#{name},'%')
- </select>
User selectLikeUser(String name);
- <select id="selectLikeUser" resultType="com.cjc.mybatis.entity.User">
- select * from t_user where username like "%"#{name}"%"
- </select>
- @Test
- public void test15() {
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
- UserMapper mapper = sqlSession.getMapper(UserMapper.class);
- User user = mapper.selectLikeUser("小");
- System.out.println("user = " + user);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。