喜喜检查项的代码框架
This commit is contained in:
@@ -0,0 +1,245 @@
|
||||
package com.rj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.rj.entity.LoveCheckItemChild;
|
||||
import com.rj.service.ILoveCheckItemChildService;
|
||||
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.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项子表 前端控制器(love_check_item_child)
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/loveCheckItemChild")
|
||||
@Tag(name = "恋爱检查项子表", description = "love_check_item_child 表 CRUD")
|
||||
public class LoveCheckItemChildController {
|
||||
|
||||
@Autowired
|
||||
private ILoveCheckItemChildService loveCheckItemChildService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增", description = "新增一条子表记录")
|
||||
public ResponseEntity<Map<String, Object>> add(
|
||||
@Parameter(description = "实体 JSON", required = true)
|
||||
@RequestBody LoveCheckItemChild body) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (body.getId() == null || body.getId().trim().isEmpty()) {
|
||||
body.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
body.setCreateTime(now);
|
||||
body.setUpdateTime(now);
|
||||
boolean success = loveCheckItemChildService.save(body);
|
||||
if (success) {
|
||||
result.put("success", true);
|
||||
result.put("message", "添加成功");
|
||||
result.put("data", body);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "添加失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "添加异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "按主键查询", description = "根据 id(UUID)查询")
|
||||
public ResponseEntity<Map<String, Object>> getById(
|
||||
@Parameter(description = "主键 UUID", required = true) @PathVariable String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
LoveCheckItemChild row = loveCheckItemChildService.getById(id);
|
||||
if (row != null) {
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", row);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "记录不存在");
|
||||
return ResponseEntity.notFound().build();
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "分页列表", description = "支持 parentId、项目名称、场景(模糊)及时间范围等条件")
|
||||
public ResponseEntity<Map<String, Object>> list(
|
||||
@Parameter(description = "页码") @RequestParam(defaultValue = "1") Integer current,
|
||||
@Parameter(description = "每页条数") @RequestParam(defaultValue = "10") Integer size,
|
||||
@Parameter(description = "父级ID(精确)") @RequestParam(required = false) String parentId,
|
||||
@Parameter(description = "项目名称(模糊)") @RequestParam(required = false) String projectName,
|
||||
@Parameter(description = "场景(模糊)") @RequestParam(required = false) String scenario,
|
||||
@Parameter(description = "创建开始时间 yyyy-MM-dd HH:mm:ss") @RequestParam(required = false) String createStartTime,
|
||||
@Parameter(description = "创建结束时间 yyyy-MM-dd HH:mm:ss") @RequestParam(required = false) String createEndTime,
|
||||
@Parameter(description = "修改开始时间 yyyy-MM-dd HH:mm:ss") @RequestParam(required = false) String updateStartTime,
|
||||
@Parameter(description = "修改结束时间 yyyy-MM-dd HH:mm:ss") @RequestParam(required = false) String updateEndTime) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
Page<LoveCheckItemChild> page = new Page<>(current, size);
|
||||
LambdaQueryWrapper<LoveCheckItemChild> qw = new LambdaQueryWrapper<>();
|
||||
if (parentId != null && !parentId.trim().isEmpty()) {
|
||||
qw.eq(LoveCheckItemChild::getParentId, parentId);
|
||||
}
|
||||
if (projectName != null && !projectName.trim().isEmpty()) {
|
||||
qw.like(LoveCheckItemChild::getProjectName, projectName);
|
||||
}
|
||||
if (scenario != null && !scenario.trim().isEmpty()) {
|
||||
qw.like(LoveCheckItemChild::getScenario, scenario);
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
if (createStartTime != null && !createStartTime.trim().isEmpty()) {
|
||||
try {
|
||||
qw.ge(LoveCheckItemChild::getCreateTime, LocalDateTime.parse(createStartTime, formatter));
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "创建开始时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (createEndTime != null && !createEndTime.trim().isEmpty()) {
|
||||
try {
|
||||
qw.le(LoveCheckItemChild::getCreateTime, LocalDateTime.parse(createEndTime, formatter));
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "创建结束时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (updateStartTime != null && !updateStartTime.trim().isEmpty()) {
|
||||
try {
|
||||
qw.ge(LoveCheckItemChild::getUpdateTime, LocalDateTime.parse(updateStartTime, formatter));
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "修改开始时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (updateEndTime != null && !updateEndTime.trim().isEmpty()) {
|
||||
try {
|
||||
qw.le(LoveCheckItemChild::getUpdateTime, LocalDateTime.parse(updateEndTime, formatter));
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "修改结束时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
qw.orderByDesc(LoveCheckItemChild::getUpdateTime);
|
||||
Page<LoveCheckItemChild> p = loveCheckItemChildService.page(page, qw);
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", p.getRecords());
|
||||
result.put("total", p.getTotal());
|
||||
result.put("current", p.getCurrent());
|
||||
result.put("size", p.getSize());
|
||||
result.put("pages", p.getPages());
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新", description = "按主键 id 更新;修改时间由服务端刷新")
|
||||
public ResponseEntity<Map<String, Object>> update(
|
||||
@Parameter(description = "实体 JSON(须含 id)", required = true)
|
||||
@RequestBody LoveCheckItemChild body) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (body.getId() == null || body.getId().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "id 不能为空");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
body.setUpdateTime(LocalDateTime.now());
|
||||
boolean success = loveCheckItemChildService.updateById(body);
|
||||
if (success) {
|
||||
result.put("success", true);
|
||||
result.put("message", "更新成功");
|
||||
result.put("data", body);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "更新失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "更新异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@Operation(summary = "删除", description = "按主键删除")
|
||||
public ResponseEntity<Map<String, Object>> delete(
|
||||
@Parameter(description = "主键 UUID", required = true) @PathVariable String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
boolean success = loveCheckItemChildService.removeById(id);
|
||||
if (success) {
|
||||
result.put("success", true);
|
||||
result.put("message", "删除成功");
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "删除失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "删除异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/batchDelete")
|
||||
@Operation(summary = "批量删除", description = "请求体为 id 字符串列表")
|
||||
public ResponseEntity<Map<String, Object>> batchDelete(
|
||||
@Parameter(description = "主键 UUID 列表", required = true) @RequestBody List<String> ids) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "id 列表不能为空");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
boolean success = loveCheckItemChildService.removeByIds(ids);
|
||||
if (success) {
|
||||
result.put("success", true);
|
||||
result.put("message", "批量删除成功,共 " + ids.size() + " 条");
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "批量删除失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "批量删除异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
249
src/main/java/com/rj/controller/LoveCheckItemController.java
Normal file
249
src/main/java/com/rj/controller/LoveCheckItemController.java
Normal file
@@ -0,0 +1,249 @@
|
||||
package com.rj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.rj.entity.LoveCheckItem;
|
||||
import com.rj.service.ILoveCheckItemService;
|
||||
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.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项表 前端控制器(love_check_item)
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/loveCheckItem")
|
||||
@Tag(name = "恋爱检查项", description = "love_check_item 表 CRUD")
|
||||
public class LoveCheckItemController {
|
||||
|
||||
@Autowired
|
||||
private ILoveCheckItemService loveCheckItemService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增", description = "新增一条检查项记录")
|
||||
public ResponseEntity<Map<String, Object>> add(
|
||||
@Parameter(description = "实体 JSON", required = true)
|
||||
@RequestBody LoveCheckItem body) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (body.getId() == null || body.getId().trim().isEmpty()) {
|
||||
body.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
body.setCreateTime(now);
|
||||
body.setUpdateTime(now);
|
||||
boolean success = loveCheckItemService.save(body);
|
||||
if (success) {
|
||||
result.put("success", true);
|
||||
result.put("message", "添加成功");
|
||||
result.put("data", body);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "添加失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "添加异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "按主键查询", description = "根据 id(UUID)查询")
|
||||
public ResponseEntity<Map<String, Object>> getById(
|
||||
@Parameter(description = "主键 UUID", required = true) @PathVariable String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
LoveCheckItem row = loveCheckItemService.getById(id);
|
||||
if (row != null) {
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", row);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "记录不存在");
|
||||
return ResponseEntity.notFound().build();
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "分页列表", description = "支持 parentId、项目名称、类型、危害星级及时间范围等条件")
|
||||
public ResponseEntity<Map<String, Object>> list(
|
||||
@Parameter(description = "页码") @RequestParam(defaultValue = "1") Integer current,
|
||||
@Parameter(description = "每页条数") @RequestParam(defaultValue = "10") Integer size,
|
||||
@Parameter(description = "父级ID(精确,空串表示不过滤)") @RequestParam(required = false) String parentId,
|
||||
@Parameter(description = "项目名称(模糊)") @RequestParam(required = false) String projectName,
|
||||
@Parameter(description = "类型(模糊)") @RequestParam(required = false) String type,
|
||||
@Parameter(description = "危害星级(精确,1-5)") @RequestParam(required = false) Integer hazardStars,
|
||||
@Parameter(description = "创建开始时间 yyyy-MM-dd HH:mm:ss") @RequestParam(required = false) String createStartTime,
|
||||
@Parameter(description = "创建结束时间 yyyy-MM-dd HH:mm:ss") @RequestParam(required = false) String createEndTime,
|
||||
@Parameter(description = "修改开始时间 yyyy-MM-dd HH:mm:ss") @RequestParam(required = false) String updateStartTime,
|
||||
@Parameter(description = "修改结束时间 yyyy-MM-dd HH:mm:ss") @RequestParam(required = false) String updateEndTime) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
Page<LoveCheckItem> page = new Page<>(current, size);
|
||||
LambdaQueryWrapper<LoveCheckItem> qw = new LambdaQueryWrapper<>();
|
||||
if (parentId != null && !parentId.trim().isEmpty()) {
|
||||
qw.eq(LoveCheckItem::getParentId, parentId);
|
||||
}
|
||||
if (projectName != null && !projectName.trim().isEmpty()) {
|
||||
qw.like(LoveCheckItem::getProjectName, projectName);
|
||||
}
|
||||
if (type != null && !type.trim().isEmpty()) {
|
||||
qw.like(LoveCheckItem::getType, type);
|
||||
}
|
||||
if (hazardStars != null) {
|
||||
qw.eq(LoveCheckItem::getHazardStars, hazardStars);
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
if (createStartTime != null && !createStartTime.trim().isEmpty()) {
|
||||
try {
|
||||
qw.ge(LoveCheckItem::getCreateTime, LocalDateTime.parse(createStartTime, formatter));
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "创建开始时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (createEndTime != null && !createEndTime.trim().isEmpty()) {
|
||||
try {
|
||||
qw.le(LoveCheckItem::getCreateTime, LocalDateTime.parse(createEndTime, formatter));
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "创建结束时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (updateStartTime != null && !updateStartTime.trim().isEmpty()) {
|
||||
try {
|
||||
qw.ge(LoveCheckItem::getUpdateTime, LocalDateTime.parse(updateStartTime, formatter));
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "修改开始时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (updateEndTime != null && !updateEndTime.trim().isEmpty()) {
|
||||
try {
|
||||
qw.le(LoveCheckItem::getUpdateTime, LocalDateTime.parse(updateEndTime, formatter));
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "修改结束时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
qw.orderByDesc(LoveCheckItem::getUpdateTime);
|
||||
Page<LoveCheckItem> p = loveCheckItemService.page(page, qw);
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", p.getRecords());
|
||||
result.put("total", p.getTotal());
|
||||
result.put("current", p.getCurrent());
|
||||
result.put("size", p.getSize());
|
||||
result.put("pages", p.getPages());
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新", description = "按主键 id 更新;修改时间由服务端刷新")
|
||||
public ResponseEntity<Map<String, Object>> update(
|
||||
@Parameter(description = "实体 JSON(须含 id)", required = true)
|
||||
@RequestBody LoveCheckItem body) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (body.getId() == null || body.getId().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "id 不能为空");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
body.setUpdateTime(LocalDateTime.now());
|
||||
boolean success = loveCheckItemService.updateById(body);
|
||||
if (success) {
|
||||
result.put("success", true);
|
||||
result.put("message", "更新成功");
|
||||
result.put("data", body);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "更新失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "更新异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@Operation(summary = "删除", description = "按主键删除")
|
||||
public ResponseEntity<Map<String, Object>> delete(
|
||||
@Parameter(description = "主键 UUID", required = true) @PathVariable String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
boolean success = loveCheckItemService.removeById(id);
|
||||
if (success) {
|
||||
result.put("success", true);
|
||||
result.put("message", "删除成功");
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "删除失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "删除异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/batchDelete")
|
||||
@Operation(summary = "批量删除", description = "请求体为 id 字符串列表")
|
||||
public ResponseEntity<Map<String, Object>> batchDelete(
|
||||
@Parameter(description = "主键 UUID 列表", required = true) @RequestBody List<String> ids) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "id 列表不能为空");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
boolean success = loveCheckItemService.removeByIds(ids);
|
||||
if (success) {
|
||||
result.put("success", true);
|
||||
result.put("message", "批量删除成功,共 " + ids.size() + " 条");
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "批量删除失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "批量删除异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
62
src/main/java/com/rj/entity/LoveCheckItem.java
Normal file
62
src/main/java/com/rj/entity/LoveCheckItem.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.rj.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项表(love_check_item)
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("love_check_item")
|
||||
@Schema(description = "恋爱/择偶检查项")
|
||||
public class LoveCheckItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键,UUID")
|
||||
@TableId("id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "父级ID,UUID,根节点为空")
|
||||
@TableField("parent_id")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "项目名称")
|
||||
@TableField("project_name")
|
||||
private String projectName;
|
||||
|
||||
@Schema(description = "危害程度(星级,1-5,5星危害最大)")
|
||||
@TableField("hazard_stars")
|
||||
private Integer hazardStars;
|
||||
|
||||
@Schema(description = "类型")
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "简述")
|
||||
@TableField("brief")
|
||||
private String brief;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
70
src/main/java/com/rj/entity/LoveCheckItemChild.java
Normal file
70
src/main/java/com/rj/entity/LoveCheckItemChild.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.rj.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项子表(love_check_item_child)
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("love_check_item_child")
|
||||
@Schema(description = "恋爱/择偶检查项子表(场景话术等)")
|
||||
public class LoveCheckItemChild implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键,UUID")
|
||||
@TableId("id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "父级ID,UUID")
|
||||
@TableField("parent_id")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "项目名称")
|
||||
@TableField("project_name")
|
||||
private String projectName;
|
||||
|
||||
@Schema(description = "场景")
|
||||
@TableField("scenario")
|
||||
private String scenario;
|
||||
|
||||
@Schema(description = "话术")
|
||||
@TableField("talk_script")
|
||||
private String talkScript;
|
||||
|
||||
@Schema(description = "引导故事")
|
||||
@TableField("guide_story")
|
||||
private String guideStory;
|
||||
|
||||
@Schema(description = "加分标准")
|
||||
@TableField("bonus_standard")
|
||||
private String bonusStandard;
|
||||
|
||||
@Schema(description = "减分标准")
|
||||
@TableField("deduction_standard")
|
||||
private String deductionStandard;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class LoveWhoI implements Serializable {
|
||||
@TableField("salutation")
|
||||
private String salutation;
|
||||
|
||||
@Schema(description = "性别")
|
||||
@Schema(description = "性别: 下拉框,男或 女")
|
||||
@TableField("gender")
|
||||
private String gender;
|
||||
|
||||
|
||||
14
src/main/java/com/rj/mapper/LoveCheckItemChildMapper.java
Normal file
14
src/main/java/com/rj/mapper/LoveCheckItemChildMapper.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.rj.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rj.entity.LoveCheckItemChild;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项子表 Mapper
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
public interface LoveCheckItemChildMapper extends BaseMapper<LoveCheckItemChild> {
|
||||
|
||||
}
|
||||
14
src/main/java/com/rj/mapper/LoveCheckItemMapper.java
Normal file
14
src/main/java/com/rj/mapper/LoveCheckItemMapper.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.rj.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rj.entity.LoveCheckItem;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项表 Mapper
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
public interface LoveCheckItemMapper extends BaseMapper<LoveCheckItem> {
|
||||
|
||||
}
|
||||
14
src/main/java/com/rj/service/ILoveCheckItemChildService.java
Normal file
14
src/main/java/com/rj/service/ILoveCheckItemChildService.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.rj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.rj.entity.LoveCheckItemChild;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项子表 服务类
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
public interface ILoveCheckItemChildService extends IService<LoveCheckItemChild> {
|
||||
|
||||
}
|
||||
14
src/main/java/com/rj/service/ILoveCheckItemService.java
Normal file
14
src/main/java/com/rj/service/ILoveCheckItemService.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.rj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.rj.entity.LoveCheckItem;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项表 服务类
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
public interface ILoveCheckItemService extends IService<LoveCheckItem> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.rj.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rj.entity.LoveCheckItemChild;
|
||||
import com.rj.mapper.LoveCheckItemChildMapper;
|
||||
import com.rj.service.ILoveCheckItemChildService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项子表 服务实现
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
@Service
|
||||
public class LoveCheckItemChildServiceImpl extends ServiceImpl<LoveCheckItemChildMapper, LoveCheckItemChild>
|
||||
implements ILoveCheckItemChildService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.rj.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rj.entity.LoveCheckItem;
|
||||
import com.rj.mapper.LoveCheckItemMapper;
|
||||
import com.rj.service.ILoveCheckItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 恋爱/择偶检查项表 服务实现
|
||||
*
|
||||
* @author system
|
||||
* @since 2026-04-06
|
||||
*/
|
||||
@Service
|
||||
public class LoveCheckItemServiceImpl extends ServiceImpl<LoveCheckItemMapper, LoveCheckItem>
|
||||
implements ILoveCheckItemService {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user