@RequestMapping("/register")
public void register(){
// 写入数据
User user = new User();
user.setUserName("wg??");
user.setUserPassword("123457888");
userMapper.insert(user);
System.out.println(user.getUserName() + " " + user.getUserPassword() );
}
@RequestMapping("/delete")
public String delete(){
// 通过主键来删除数据
// userMapper.deleteByPrimaryKey((long)1);
UserExample userExample = new UserExample();
userExample.createCriteria().andUserPasswordEqualTo("wg?");
userMapper.deleteByExample(userExample);
return "success";
}
@RequestMapping("/select")
public String select(){
// 查询数据
UserExample userExample = new UserExample();
userExample.createCriteria().andUserPasswordEqualTo("12345788");
List<User> userList = userMapper.selectByExample(userExample);
System.out.println(userList.size()+"?");
if(userList.size()==1){
System.out.println("登录成功");
}else{
System.out.println("登录失败");
}
return "success";
}
@RequestMapping("/updata")
public String updata(){
// 修改数据
User user = new User();
user.setId(1L);
user.setUserName("增幅");
user.setUserPassword("19999");
userMapper.updateByPrimaryKeySelective(user);
return "success";
}