springboot + JDBC 我想从数据库拿到我想要的值。我已经可以拿到全部值了,但是我只想获得其中的userpwd,只输出userpwd的值。以及为什么我的密码是123,但是结果却变成了B@647e9406。如何转码?
package com.example.springboot.connection;
import jdk.nashorn.internal.objects.NativeDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
public class JDBCConnection {
@Autowired
JdbcTemplate jdbcTemplate;
private NativeDate JSONSerializer;
@GetMapping("/userlist")
public void userlist(@RequestParam(value = "username", required = true) String username) {
String sql = "select * from userdate where username = " + username;
List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
System.out.println(maps);
}
}
我只想获得其中的userpwd。以及密码解码回我设置的123
你加密过 所以查出来的是B@647e9406 解密看你用啥加密的 一般有个方法是能弄出密码的
你直接登录进去数据库去查,会发现密码就是这个东西。
因为密码是已经加密了的啊,现在谁还会明文去存密码?
解码要看你加密咋加的 只获取密码就get("userPwd")就行了 查出来不是个map吗