78 lines
3.3 KiB
Java
78 lines
3.3 KiB
Java
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);
|
|
}
|
|
}
|