Serviceimpl 这样写的
// 修改用户信息
public int updateByid(User user){
int i = userMapper.updateById(user);
return i;
}
controller里面这样写的
// 修改用户信息
@PostMapping("update")
public int update (@RequestBody User user){
System.out.println("修改操作开始==============================================");
int update = userService.updateByid(user);
System.out.println(update+"update应该返回的值");
System.out.println("修改操作完成==============================================");
return update;
}
报错了
JDBC Connection [HikariProxyConnection@1765617826 wrapping com.mysql.cj.jdbc.ConnectionImpl@39f50341] will not be managed by Spring
==> Preparing: UPDATE user SET code=?, userName=?, userPsw=?, userImg=?, userPhoneno=?, userAddress=?, userSex=? WHERE userId=? AND isDelete=0
==> Parameters: (String), qhy(String), 123456(String), https://img1.baidu.com/it/u=1415221871,1310171240&fm=253&fmt=auto&app=138&f=JPG?w=400&h=400(String), 15216477190(Long), 济南市(String), 0(Integer), 3(Long)
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@44996dab]
2022-04-09 19:26:13.055 ERROR 17424 --- [nio-8081-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: Unknown column 'userId' in 'where clause'
### The error may exist in com/example/mapper/UserMapper.java (best guess)
### The error may involve com.example.mapper.UserMapper.updateById-Inline
### The error occurred while setting parameters
### SQL: UPDATE user SET code=?, userName=?, userPsw=?, userImg=?, userPhoneno=?, userAddress=?, userSex=? WHERE userId=? AND isDelete=0
### Cause: java.sql.SQLSyntaxErrorException: Unknown column 'userId' in 'where clause'