mybatis执行sql查询时返回值null

我这的原因是 在sql中使用as  ,使用as时 别名必须与resultType返回实体类中的属性一致,不能使用引号带的别名;

<select id="analyzeFranchisee" parameterType="string" resultType="com.dny.website.entity.Analyze">
        select case when principal is null then '统计' else principal end as principal,count(*) as quantum,
            sum(case when communicate='1' then 1 else 0 end) as communicate,
            sum(case when communicate='0' then 1 else 0 end) as not_communicate,
            sum(case when intention='1' then 1 else 0 end) as intention,
            sum(case when intention='0' then 1 else 0 end) not_intention,
            sum(case when custo_Signing='1' then 1 else 0 end) as signing,
            sum(case when custo_Signing='0' then 1 else 0 end) as not_signing,
            Ifnull(sum(Signing_money),0) as money 
            from franchisee 
            <where>
                principal!='not'
                <if test="source!=null and source!=''">
                    and source=#{source}
                </if>
                <if test="minTime!=null and minTime!=''">
                    and commit_time>=concat('',${minTime},'00:00:00')
                </if>
                <if test="maxTime!=null and maxTime!=''">
                    and commit_time&lt;=concat('',${maxTime},'23:59:59')
                </if>
            </where>
               group by principal with rollup 
    </select>

猜你喜欢

转载自blog.csdn.net/kelly921011/article/details/88338346