评估申请的代码架构

This commit is contained in:
2026-04-29 19:01:02 +08:00
parent d547b61843
commit 521cc30f94
10 changed files with 679 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
package com.rj.controller;
import com.rj.entity.LbAssessmentApplication;
import com.rj.service.ILbAssessmentApplicationService;
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/lbAssessmentApplication")
@Tag(name = "申请评估", description = "lb_assessment_application增删改查与分页")
public class LbAssessmentApplicationController {
@Autowired
private ILbAssessmentApplicationService lbAssessmentApplicationService;
@PostMapping("/add")
@Operation(summary = "新增")
public ResponseEntity<Map<String, Object>> add(
@Parameter(description = "实体", required = true) @RequestBody LbAssessmentApplication entity) {
Map<String, Object> result = lbAssessmentApplicationService.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 LbAssessmentApplication entity) {
Map<String, Object> result = lbAssessmentApplicationService.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 = lbAssessmentApplicationService.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) Long tenantId,
@RequestParam(required = false) String applicantName,
@RequestParam(required = false) String applicantPhone,
@RequestParam(required = false) String colleagueName,
@RequestParam(required = false) String teamLeaderName) {
Map<String, Object> result = lbAssessmentApplicationService.pageQuery(
current, size, tenantId, applicantName, applicantPhone, colleagueName, teamLeaderName
);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
return ResponseEntity.internalServerError().body(result);
}
}

View File

@@ -0,0 +1,80 @@
package com.rj.controller;
import com.rj.entity.LbPurchaseApply;
import com.rj.service.ILbPurchaseApplyService;
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.format.annotation.DateTimeFormat;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.Map;
@RestController
@RequestMapping("/api/lbPurchaseApply")
@Tag(name = "进货申请", description = "lb_purchase_apply增删改查与分页")
public class LbPurchaseApplyController {
@Autowired
private ILbPurchaseApplyService lbPurchaseApplyService;
@PostMapping("/add")
@Operation(summary = "新增")
public ResponseEntity<Map<String, Object>> add(
@Parameter(description = "实体", required = true) @RequestBody LbPurchaseApply entity) {
Map<String, Object> result = lbPurchaseApplyService.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 LbPurchaseApply entity) {
Map<String, Object> result = lbPurchaseApplyService.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", required = true) @PathVariable Long id) {
Map<String, Object> result = lbPurchaseApplyService.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 applyUser,
@RequestParam(required = false) String applyPhone,
@RequestParam(required = false) String colleagueName,
@RequestParam(required = false) String teamLeader,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate applyDate) {
Map<String, Object> result = lbPurchaseApplyService.pageQuery(
current, size, tenantId, applyUser, applyPhone, colleagueName, teamLeader, applyDate
);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
return ResponseEntity.internalServerError().body(result);
}
}