//原生sql+接口映射——可行
@Query(value = "select SUM(IF(type='recharge_online' and module='balance',money_points,0))+SUM(IF(type='consume' and consume_type='recharge_online',money_points,0)) as recharge_online, SUM(IF(type='present_online' and module='balance',money_points,0))+SUM(IF(type='consume' and consume_type='present_online',money_points,0)) as present_online, SUM(IF(type<>'present_online' and type<>'recharge_online' and module='balance',money_points,0))+SUM(IF(type='consume' and consume_type='other',money_points,0)) as other from socialx_order o where o.status = 'succeed'", nativeQuery = true)
List<MultiBalance> getMultiMoneyPointsForBalance();
//非原生sql+使用表名——不可行----非原生sql需要使用映射类
@Query(value = "select SUM(case when type='recharge_online' and module='balance' then money_points else 0 end)+SUM(case when type='consume' and consume_type='recharge_online' then money_points else 0 end) as recharge_online, SUM(case when type='present_online' and module='balance' then money_points else 0 end)+SUM(case when type='consume' and consume_type='present_online' then money_points else 0 end) as present_online, SUM(case when type<>'present_online' and type<>'recharge_online' and module='balance' then money_points else 0 end)+SUM(case when type='consume' and consume_type='other' then money_points else 0 end) as other from socialx_order o where o.status = 'succeed'")
List<Map> getMultiMoneyPointsForBalance();
//非原生sql+使用类名+表字段或者类字段——都可行
@Query(value = "select SUM(case when type='recharge_online' and module='balance' then money_points else 0 end)+SUM(case when type='consume' and consume_type='recharge_online' then money_points else 0 end) as recharge_online, SUM(case when type='present_online' and module='balance' then money_points else 0 end)+SUM(case when type='consume' and consume_type='present_online' then money_points else 0 end) as present_online, SUM(case when type<>'present_online' and type<>'recharge_online' and module='balance' then money_points else 0 end)+SUM(case when type='consume' and consume_type='other' then money_points else 0 end) as other from SocialxOrder o where o.status = 'succeed'")
List<MultiBalance> getMultiMoneyPointsForBalance();