feat: 移植工程
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
package com.cxx.home.controller;
|
||||
|
||||
import com.cxx.common.ReadView;
|
||||
import com.cxx.common.WriteView;
|
||||
import com.cxx.common.dto.StatsChartDto;
|
||||
import com.cxx.common.dto.bill.BillCategoryDto;
|
||||
import com.cxx.common.dto.bill.BillItemDto;
|
||||
import com.cxx.common.dto.bill.BillRecordDto;
|
||||
import com.cxx.common.dto.bill.BillSummaryDto;
|
||||
import com.cxx.home.service.BillRecordService;
|
||||
import com.cxx.common.vo.bill.BillQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/bill")
|
||||
@Tag(name = "账单记录")
|
||||
public class BillController {
|
||||
@Resource
|
||||
private BillRecordService billRecordService;
|
||||
|
||||
@Operation(summary = "新增账单")
|
||||
@PostMapping("")
|
||||
public Boolean addBillRecord(@RequestBody @JsonView(WriteView.class) BillRecordDto billRecordDto) {
|
||||
return billRecordService.saveOrUpdateBillRecord(0L, billRecordDto);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新账单")
|
||||
@PutMapping("/{id}")
|
||||
public Boolean updateBillRecord(@PathVariable("id") long id,
|
||||
@RequestBody @JsonView(WriteView.class) BillRecordDto billRecordDto) {
|
||||
return billRecordService.saveOrUpdateBillRecord(id, billRecordDto);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除账单")
|
||||
@DeleteMapping("/{id}")
|
||||
public Boolean deleteBillRecord(@PathVariable("id") long id) {
|
||||
return billRecordService.deleteBillRecord(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询账单记录")
|
||||
@GetMapping("/{id}")
|
||||
public @JsonView(ReadView.class) BillRecordDto queryBillRecord(@PathVariable("id") long id) {
|
||||
return billRecordService.queryBillRecord(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询账单概要")
|
||||
@GetMapping("/summary")
|
||||
public @JsonView(ReadView.class) List<BillSummaryDto> queryBillSummary(BillQueryVo billQueryVo) {
|
||||
return billRecordService.queryBillSummary(billQueryVo);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询账单统计")
|
||||
@GetMapping("/stats/{type}")
|
||||
public List<StatsChartDto> queryBillStats(@PathVariable("type") String type, BillQueryVo billQueryVo) {
|
||||
return billRecordService.queryBillStats(type, billQueryVo);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询账户")
|
||||
@GetMapping("/pay")
|
||||
public @JsonView(ReadView.class) List<BillItemDto> queryBillPay() {
|
||||
return billRecordService.queryBillPay();
|
||||
}
|
||||
|
||||
@Operation(summary = "查询账本")
|
||||
@GetMapping("/book")
|
||||
public @JsonView(ReadView.class) List<BillItemDto> queryBillBook() {
|
||||
return billRecordService.queryBillBook();
|
||||
}
|
||||
|
||||
@Operation(summary = "查询账单类型")
|
||||
@GetMapping("/category")
|
||||
public List<BillCategoryDto> queryBillCategory() {
|
||||
return billRecordService.queryBillCategory();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user