package com.example.demo.page;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;


import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@ResponseBody
public class UserData {
    @Autowired
    JdbcTemplate jdbcTemplate = new JdbcTemplate();
    @PostMapping(value = "/personal/statistics")
    public List<Map<String, Object>> getData(@RequestBody Map<String,Object> data){
        System.out.println(data);
        String name = (String) data.get("username");
        System.out.println(name);
        String sql = "select * from userscoreinfo where username = ?";
        return jdbcTemplate.queryForList(sql, name);
    }

}
