package cn.edu.tju.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
public class DemoController {
@Autowired
private NamedParameterJdbcTemplate jdbcTemplate;
@RequestMapping("getInfo")
public String test(){
Map<String, Object> parameterMap = new HashMap<>();
parameterMap.put("age", 55);
int result = jdbcTemplate.update("update student set username='test' " +
"where age=:age", parameterMap);
return "hello " ;
}
}