@Autowired//已根据数据源自动注入
JdbcTemplate jdbcTemplate;//简单的增删改查@RequestMapping("/customerList")public List<Map<String,Object>>userList(){
String sql ="select * from cust_customer";
List<Map<String, Object>> list_map = jdbcTemplate.queryForList(sql);return list_map;}@RequestMapping("/addPerson")public String addUser(){
String sql ="insert into person values('Acai',16)";
jdbcTemplate.update(sql);
System.out.println(jdbcTemplate.getDataSource().getClass());return"update_ok";}@RequestMapping("/updatePerson")public String updateUser(){
String sql ="update person set name = ? where age = ? ";//封装
Object[] objects =newObject[2];
objects[0]="张三";
objects[1]=16;
jdbcTemplate.update(sql,objects);return"update_ok";}@RequestMapping("/deletePerson/{age}")public String updateUser(@PathVariableint age){
String sql ="delete from person where age = ?";
jdbcTemplate.update(sql,age);return"delete_ok";}