UserController { @GetMapping("createUserTable") public String createUserTable() throws Exception { String sql = "CREATE TABLE `user` (\n" + " `id` int(10) NOT NULL AUTO_INCREMENT,\n" + " `username` varchar(100) DEFAULT NULL,\n" + " `password` varchar(100) DEFAULT NULL,\n" + " PRIMARY KEY (`id`)\n" + ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\n" + "\n"; jdbcTemplate.execute(sql); return "创建表成功"; }  @GetMapping("createUserTable") String createUserTable(); @GetMapping("saveUserTest") String saveUserTest(); @GetMapping("batchSave") String batchSaveUser(); @GetMapping("add") String addUser(String userName, String passWord); @GetMapping("updateUserPassword") String updateUserPassword(int id, String passWord); @GetMapping("deleteUserById") String deleteUserById(int id); @GetMapping("getUserByName") List getUserByName(String userName); @GetMapping("getMapById") Map getMapById(Integer id); @GetMapping("getUserById") User getUserById(Integer id); @GetMapping("list") List<User> list();  }
@Test public void createUserTable() throws Exception { String sql = "CREATE TABLE `user` (\n" + " `id` int(10) NOT NULL AUTO_INCREMENT,\n" + " `username` varchar(100) DEFAULT NULL,\n" + " `password` varchar(100) DEFAULT NULL,\n" + " PRIMARY KEY (`id`)\n" + ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\n" + "\n"; jdbcTemplate.execute(sql); }