nili
7 months ago
3 changed files with 46 additions and 5 deletions
@ -0,0 +1,32 @@ |
|||||
|
package awesome.group.game.service; |
||||
|
|
||||
|
import awesome.group.game.dao.bean.MatrixAdvAggregation; |
||||
|
import awesome.group.game.dao.mapper.MatrixAdvAggregationMapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
public class AggregationService { |
||||
|
@Resource |
||||
|
private MatrixAdvAggregationMapper aggregationMapper; |
||||
|
|
||||
|
public long getIncome(List<Integer> appIds, int startDate, int endDate) { |
||||
|
if (CollectionUtils.isEmpty(appIds)) { |
||||
|
return 0L; |
||||
|
} |
||||
|
LambdaQueryWrapper<MatrixAdvAggregation> query = new QueryWrapper<MatrixAdvAggregation>() |
||||
|
.select("sum(income) as income").lambda(); |
||||
|
query.in(MatrixAdvAggregation::getAppId, appIds); |
||||
|
query.between(MatrixAdvAggregation::getDate, startDate, endDate); |
||||
|
MatrixAdvAggregation data = aggregationMapper.selectOne(query); |
||||
|
if (data == null) { |
||||
|
return 0L; |
||||
|
} |
||||
|
return data.getIncome(); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue