mybatis执行sql查询时返回值null

6 篇文章 0 订阅

我这的原因是 在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>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值