package com.fengshun.tst.entity; import com.alibaba.fastjson.JSON; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.transaction.Transactional; import java.util.HashMap; import java.util.Map; @Transactional @RestController @RequestMapping("/sss/dict") public class TestController { @Resource TestService ts; @GetMapping("/test") public String test (){ Map<String, String> map = new HashMap<>(); map.put("123","456"); map.put("178", "789"); String str = JSON.toJSONString(map); TestEntity t = new TestEntity(); t.setMap(str); t.setId("1"); ts.save(t); return "1111111"; } @GetMapping("/test1") public String test1 (){ TestEntity t = ts.findOne("1"); String map = t.getMap(); Map maps1 = (Map)JSON.parse(map); System.out.println(maps1); return "22"; } }