抵扣金管理

This commit is contained in:
2026-05-21 11:09:04 +08:00
parent 6d0cfcdd84
commit b8aff6d0a0
5 changed files with 369 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
package com.rj.controller;
import com.rj.entity.LbDeductionAmount;
import com.rj.service.ILbDeductionAmountService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/api/lbDeductionAmount")
@Tag(name = "抵扣金记录", description = "lb_deduction_amount 增删改查与分页")
public class LbDeductionAmountController {
@Autowired
private ILbDeductionAmountService lbDeductionAmountService;
@PostMapping("/add")
@Operation(summary = "新增")
public ResponseEntity<Map<String, Object>> add(
@Parameter(description = "实体id 为空时自动生成 UUID", required = true)
@RequestBody LbDeductionAmount entity) {
Map<String, Object> result = lbDeductionAmountService.add(entity);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
return ResponseEntity.badRequest().body(result);
}
@PutMapping("/update")
@Operation(summary = "编辑")
public ResponseEntity<Map<String, Object>> update(
@Parameter(description = "实体", required = true) @RequestBody LbDeductionAmount entity) {
Map<String, Object> result = lbDeductionAmountService.update(entity);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
return ResponseEntity.badRequest().body(result);
}
@DeleteMapping("/delete/{id}")
@Operation(summary = "删除")
public ResponseEntity<Map<String, Object>> delete(
@Parameter(description = "主键ID(UUID)", required = true) @PathVariable String id) {
Map<String, Object> result = lbDeductionAmountService.deleteById(id);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
return ResponseEntity.badRequest().body(result);
}
@GetMapping("/list")
@Operation(summary = "分页查询")
public ResponseEntity<Map<String, Object>> list(
@RequestParam(defaultValue = "1") Integer current,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(required = false) String tenantId,
@RequestParam(required = false) String userName,
@RequestParam(required = false) String userPhone,
@Parameter(description = "创建时间起,格式 yyyy-MM-dd HH:mm:ss")
@RequestParam(required = false) String createTimeStart,
@Parameter(description = "创建时间止,格式 yyyy-MM-dd HH:mm:ss")
@RequestParam(required = false) String createTimeEnd) {
Map<String, Object> result = lbDeductionAmountService.pageQuery(
current, size, tenantId, userName, userPhone, createTimeStart, createTimeEnd
);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
return ResponseEntity.internalServerError().body(result);
}
}