@Override
public EasyuiResult<List<StoreStatistics>> findAllmonthMoney(Integer page,Integer rows,String storeId,Map<String, Object> map) {
Page<StoreStatistics> StoreStatistics = storeStatisticsDao.findAll(new Specification<StoreStatistics>() {
@Override
public Predicate toPredicate(Root<StoreStatistics> root,CriteriaQuery<?> query, CriteriaBuilder cb) {
query.multiselect(cb.sum(root.<Integer> get("month")).alias("month"));
query.groupBy(root.get("year"),root.get("month"));
if(map.get("EQ_year")!=null){
query.where(cb.equal(root.get("year"), map.get("EQ_year")),cb.equal(root.get("month"), map.get("EQ_month")),cb.equal(root.get("storeId"),storeId));
}else{
query.where(cb.equal(root.get("storeId"),storeId));
}
return null;
}
}, new PageRequest(page - 1, rows, new Sort(Sort.Direction.DESC, new String[] { "createdTime" })));
return EasyUtils.returnPage(StoreStatistics.class, StoreStatistics);
SQL语句 select
storestati0_.id as id1_70_,
storestati0_.create_user as create_u2_70_,
storestati0_.created_ip as created_3_70_,
storestati0_.created_time as created_4_70_,
storestati0_.day as day5_70_,
storestati0_.lockversion as lockvers6_70_,
storestati0_.month as month7_70_,
storestati0_.update_time as update_t8_70_,
storestati0_.year as year9_70_,
storestati0_.merchant_mobile as merchan10_70_,
storestati0_.monthly_income as monthly11_70_,
storestati0_.store_id as store_i12_70_,
storestati0_.store_name as store_n13_70_,
storestati0_.today_income as today_i14_70_,
storestati0_.total_income as total_i15_70_
from
wk_store_statistics storestati0_
where
storestati0_.store_id=40
group by
storestati0_.year ,
storestati0_.month
order by
storestati0_.created_time desc limit ?query.multiselect(cb.sum(root.<Integer> get("month")).alias("month"));没有效果
public EasyuiResult<List<StoreStatistics>> findAllmonthMoney(Integer page,Integer rows,String storeId,Map<String, Object> map) {
Page<StoreStatistics> StoreStatistics = storeStatisticsDao.findAll(new Specification<StoreStatistics>() {
@Override
public Predicate toPredicate(Root<StoreStatistics> root,CriteriaQuery<?> query, CriteriaBuilder cb) {
query.multiselect(cb.sum(root.<Integer> get("month")).alias("month"));
query.groupBy(root.get("year"),root.get("month"));
if(map.get("EQ_year")!=null){
query.where(cb.equal(root.get("year"), map.get("EQ_year")),cb.equal(root.get("month"), map.get("EQ_month")),cb.equal(root.get("storeId"),storeId));
}else{
query.where(cb.equal(root.get("storeId"),storeId));
}
return null;
}
}, new PageRequest(page - 1, rows, new Sort(Sort.Direction.DESC, new String[] { "createdTime" })));
return EasyUtils.returnPage(StoreStatistics.class, StoreStatistics);
SQL语句 select
storestati0_.id as id1_70_,
storestati0_.create_user as create_u2_70_,
storestati0_.created_ip as created_3_70_,
storestati0_.created_time as created_4_70_,
storestati0_.day as day5_70_,
storestati0_.lockversion as lockvers6_70_,
storestati0_.month as month7_70_,
storestati0_.update_time as update_t8_70_,
storestati0_.year as year9_70_,
storestati0_.merchant_mobile as merchan10_70_,
storestati0_.monthly_income as monthly11_70_,
storestati0_.store_id as store_i12_70_,
storestati0_.store_name as store_n13_70_,
storestati0_.today_income as today_i14_70_,
storestati0_.total_income as total_i15_70_
from
wk_store_statistics storestati0_
where
storestati0_.store_id=40
group by
storestati0_.year ,
storestati0_.month
order by
storestati0_.created_time desc limit ?query.multiselect(cb.sum(root.<Integer> get("month")).alias("month"));没有效果
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货