package com.bdqn.dao;
import java.util.List;
import com.bdqn.entity.User;
publicinterfaceUserDao {
List<User> selectAll();
int deleteByid(int uid);
int update(User user);
List<User> selectByName(String str);
int insert(User user);
}
UserDaoXml.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"><mappernamespace="com.bdqn.dao.UserDao"><selectid="count"resultType="int">
select count(1) from user
</select><selectid="selectAll"resultType="com.bdqn.entity.User">
select *from user
</select><deleteid="deleteByid"parameterType="int" >
delete from user where uid=#{uid}
</delete><updateid="update"parameterType="com.bdqn.entity.User">
update user set uname=#{uname},upwd=#{upwd} where uid=#{uid}
</update><selectid="selectByName"resultType="com.bdqn.entity.User"parameterType="String">
select uid,uname,upwd from user where uname like concat('%',#{str},'%')
<!--关键字:concat --></select><insertid="insert"parameterType="com.bdqn.entity.User">
insert into user values(#{uid},#{uname},#{upwd})
</insert></mapper>