package com.controller;

import com.transaction_.AEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @RequestMapping("uu")
    @ResponseBody
    public String uu() {
        try {
            AEntity aEntity = jdbcTemplate.queryForObject("select * from wb_tbl_a where id = ?",
                    new BeanPropertyRowMapper<AEntity>(AEntity.class),
                    "105"
            );
        } catch (EmptyResultDataAccessException e) {
            return e.getMessage();
        }
        return "uu";
    }
}
