You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.9 KiB
70 lines
1.9 KiB
package com.example.demo.controller;
|
|
|
|
import com.example.demo.domain.vo.Consume;
|
|
import com.example.demo.domain.vo.Gold;
|
|
import com.example.demo.domain.vo.Page;
|
|
import com.example.demo.domain.vo.Result;
|
|
import com.example.demo.service.ConsumeService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @program: gold-java
|
|
* @ClassName ConsumeController
|
|
* @description:消费模块
|
|
* @author: Double
|
|
* @create: 2025−06-23 13:06
|
|
* @Version 1.0
|
|
**/
|
|
|
|
@RestController
|
|
@RequestMapping("/consume")
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
@CrossOrigin
|
|
public class ConsumeController {
|
|
|
|
@Autowired
|
|
private ConsumeService consumeService;
|
|
|
|
//消耗明细
|
|
@PostMapping("/selectAll")
|
|
public Result selcetAll(@RequestBody Page page) {
|
|
if (ObjectUtils.isEmpty(page.getPageNum())) {
|
|
return Result.error("页码数为空!");
|
|
}
|
|
if (ObjectUtils.isEmpty(page.getPageSize())) {
|
|
return Result.error("页大小为空!");
|
|
} else {
|
|
return Result.success(consumeService.selectAll(page.getPageNum(), page.getPageSize()));
|
|
}
|
|
|
|
}
|
|
|
|
//消耗明细筛选
|
|
@PostMapping("/selectBy")
|
|
public Result selcetBy(@RequestBody Page page) {
|
|
if (ObjectUtils.isEmpty(page.getPageNum())) {
|
|
return Result.error("页码数为空!");
|
|
}
|
|
if (ObjectUtils.isEmpty(page.getPageSize())) {
|
|
return Result.error("页大小为空!");
|
|
} else {
|
|
return Result.success(consumeService.selectBy(page.getPageNum(), page.getPageSize(), page.getConsume()));
|
|
}
|
|
|
|
}
|
|
|
|
//消耗金币统计
|
|
@PostMapping("/statsGold")
|
|
public Result statsGold() {
|
|
Gold gold = consumeService.statsGold();
|
|
return Result.success(gold);
|
|
}
|
|
|
|
}
|