mybatis查询返回hashmap相关问题
记录是为了更好的成长!
1、mapper.xml描述,注意是parameterType 和 resultType
<select id="findExamineInfoByYear" parameterType="java.util.HashMap" resultType="java.util.HashMap"> select emid,datetime,totalscore,selfscore from examine ,examscore where examine.selfscore = examscore.id and examine.emid = #{emid} and examine.year = #{year} </select>
2、对应的mapper接口
List<Map> findExamineInfoByYear(Map map);
3、返回到页面的json数据格式
[{"selfscore":4,"datetime":"2018-11-12","totalscore":"73","emid":1},{"selfscore":3,"datetime":"2018-12-12","totalscore":"32","emid":1}]
以上内容代表个人观点,仅供参考,不喜勿喷。。。