>Mybatis 统计查询时,sql返回多个参数,怎么接收
>>第一种方法:
最近做项目的时候碰到一个问题,查询一个表单,返回多个字段和函数计算的值,对于mybatis来说返回类型就不好定义了,
需求分析
计算当天所有的评价人数,评价分数,评价次数,表的结构如下:
二 实现
定义一个返回类:
public class SellerAllEvalPo {
private Integer totalScore;
private Integer totalEval;
private Integer totalPeople;
(get/set略)
sql语句:
<select id="getSellerAllScore" resultType="SellerAllEvalPo">
select sum(eval_num) as total_eval, sum(total_score) as total_score from seller_eval_day
<where>