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}]

 

 

 

 

 

 

 

 

以上内容代表个人观点,仅供参考,不喜勿喷。。。

posted @ 2018-11-26 09:52  刚刚睡醒  阅读(6057)  评论(0编辑  收藏  举报