AI问答代码框架
This commit is contained in:
250
src/main/java/com/rj/controller/AiQaItemController.java
Normal file
250
src/main/java/com/rj/controller/AiQaItemController.java
Normal file
@@ -0,0 +1,250 @@
|
||||
package com.rj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.rj.entity.AiQaItem;
|
||||
import com.rj.service.IAiQaItemService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
|
||||
/**
|
||||
* AI 问答子表 前端控制器
|
||||
*
|
||||
* <p>对应表:ai_qa_item</p>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/aiQaItem")
|
||||
@Tag(name = "AI问答子表", description = "AI问答子表增删改查与分页")
|
||||
public class AiQaItemController {
|
||||
|
||||
@Autowired
|
||||
private IAiQaItemService aiQaItemService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增", description = "新增 AI 问答子表记录")
|
||||
public ResponseEntity<Map<String, Object>> add(
|
||||
@Parameter(description = "实体", required = true) @RequestBody AiQaItem entity) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (entity.getId() == null || entity.getId().trim().isEmpty()) {
|
||||
entity.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (entity.getCreateTime() == null) {
|
||||
entity.setCreateTime(now);
|
||||
}
|
||||
entity.setUpdateTime(now);
|
||||
boolean ok = aiQaItemService.save(entity);
|
||||
if (ok) {
|
||||
result.put("success", true);
|
||||
result.put("message", "添加成功");
|
||||
result.put("data", entity);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "添加失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_item add error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "添加异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "按ID查询")
|
||||
public ResponseEntity<Map<String, Object>> getById(@PathVariable String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
AiQaItem one = aiQaItemService.getById(id);
|
||||
if (one != null) {
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", one);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "记录不存在");
|
||||
return ResponseEntity.notFound().build();
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_item get error, id={}", id, e);
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().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 parentId,
|
||||
@RequestParam(required = false) String tenantId,
|
||||
@RequestParam(required = false) String questSrc,
|
||||
@RequestParam(required = false) String createStartTime,
|
||||
@RequestParam(required = false) String createEndTime) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
Page<AiQaItem> page = new Page<>(current, size);
|
||||
LambdaQueryWrapper<AiQaItem> q = new LambdaQueryWrapper<>();
|
||||
if (parentId != null && !parentId.trim().isEmpty()) {
|
||||
q.eq(AiQaItem::getParentId, parentId);
|
||||
}
|
||||
if (tenantId != null && !tenantId.trim().isEmpty()) {
|
||||
q.eq(AiQaItem::getTenantId, tenantId);
|
||||
}
|
||||
if (questSrc != null && !questSrc.trim().isEmpty()) {
|
||||
q.like(AiQaItem::getQuestSrc, questSrc);
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
if (createStartTime != null && !createStartTime.trim().isEmpty()) {
|
||||
try {
|
||||
q.ge(AiQaItem::getCreateTime, LocalDateTime.parse(createStartTime, formatter));
|
||||
} catch (Exception ex) {
|
||||
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 {
|
||||
q.le(AiQaItem::getCreateTime, LocalDateTime.parse(createEndTime, formatter));
|
||||
} catch (Exception ex) {
|
||||
result.put("success", false);
|
||||
result.put("message", "创建结束时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
q.orderByDesc(AiQaItem::getCreateTime);
|
||||
Page<AiQaItem> data = aiQaItemService.page(page, q);
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", data.getRecords());
|
||||
result.put("total", data.getTotal());
|
||||
result.put("current", data.getCurrent());
|
||||
result.put("size", data.getSize());
|
||||
result.put("pages", data.getPages());
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_item list error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/listByParentId")
|
||||
@Operation(summary = "按主表ID列表查询(不分页)")
|
||||
public ResponseEntity<Map<String, Object>> listByParentId(@RequestParam String parentId) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
LambdaQueryWrapper<AiQaItem> q = new LambdaQueryWrapper<>();
|
||||
q.eq(AiQaItem::getParentId, parentId);
|
||||
q.orderByDesc(AiQaItem::getCreateTime);
|
||||
List<AiQaItem> list = aiQaItemService.list(q);
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", list);
|
||||
result.put("count", list.size());
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_item listByParentId error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新")
|
||||
public ResponseEntity<Map<String, Object>> update(@RequestBody AiQaItem entity) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (entity.getId() == null || entity.getId().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "ID不能为空");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
boolean ok = aiQaItemService.updateById(entity);
|
||||
if (ok) {
|
||||
result.put("success", true);
|
||||
result.put("message", "更新成功");
|
||||
result.put("data", aiQaItemService.getById(entity.getId()));
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "更新失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_item update error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "更新异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@Operation(summary = "删除")
|
||||
public ResponseEntity<Map<String, Object>> delete(@PathVariable String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
boolean ok = aiQaItemService.removeById(id);
|
||||
if (ok) {
|
||||
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) {
|
||||
log.error("ai_qa_item delete error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "删除异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/batchDelete")
|
||||
@Operation(summary = "批量删除")
|
||||
public ResponseEntity<Map<String, Object>> batchDelete(@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 ok = aiQaItemService.removeByIds(ids);
|
||||
if (ok) {
|
||||
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) {
|
||||
log.error("ai_qa_item batchDelete error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "批量删除异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
240
src/main/java/com/rj/controller/AiQaMainController.java
Normal file
240
src/main/java/com/rj/controller/AiQaMainController.java
Normal file
@@ -0,0 +1,240 @@
|
||||
package com.rj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.rj.entity.AiQaMain;
|
||||
import com.rj.service.IAiQaMainService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
|
||||
/**
|
||||
* AI 问答主表 前端控制器
|
||||
*
|
||||
* <p>对应表:ai_qa_main</p>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/aiQaMain")
|
||||
@Tag(name = "AI问答主表", description = "AI问答主表增删改查与分页")
|
||||
public class AiQaMainController {
|
||||
|
||||
@Autowired
|
||||
private IAiQaMainService aiQaMainService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增", description = "新增 AI 问答主表记录")
|
||||
public ResponseEntity<Map<String, Object>> add(
|
||||
@Parameter(description = "实体", required = true) @RequestBody AiQaMain entity) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (entity.getId() == null || entity.getId().trim().isEmpty()) {
|
||||
entity.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (entity.getCreateTime() == null) {
|
||||
entity.setCreateTime(now);
|
||||
}
|
||||
entity.setUpdateTime(now);
|
||||
boolean ok = aiQaMainService.save(entity);
|
||||
if (ok) {
|
||||
result.put("success", true);
|
||||
result.put("message", "添加成功");
|
||||
result.put("data", entity);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "添加失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_main add error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "添加异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "按ID查询")
|
||||
public ResponseEntity<Map<String, Object>> getById(@PathVariable String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
AiQaMain one = aiQaMainService.getById(id);
|
||||
if (one != null) {
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", one);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "记录不存在");
|
||||
return ResponseEntity.notFound().build();
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_main get error, id={}", id, e);
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().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 title,
|
||||
@RequestParam(required = false) String qaType,
|
||||
@RequestParam(required = false) String salesId,
|
||||
@RequestParam(required = false) String salesPhone,
|
||||
@RequestParam(required = false) String salesName,
|
||||
@RequestParam(required = false) String createStartTime,
|
||||
@RequestParam(required = false) String createEndTime) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
Page<AiQaMain> page = new Page<>(current, size);
|
||||
LambdaQueryWrapper<AiQaMain> q = new LambdaQueryWrapper<>();
|
||||
if (tenantId != null && !tenantId.trim().isEmpty()) {
|
||||
q.eq(AiQaMain::getTenantId, tenantId);
|
||||
}
|
||||
if (title != null && !title.trim().isEmpty()) {
|
||||
q.like(AiQaMain::getTitle, title);
|
||||
}
|
||||
if (qaType != null && !qaType.trim().isEmpty()) {
|
||||
q.eq(AiQaMain::getQaType, qaType);
|
||||
}
|
||||
if (salesId != null && !salesId.trim().isEmpty()) {
|
||||
q.eq(AiQaMain::getSalesId, salesId);
|
||||
}
|
||||
if (salesPhone != null && !salesPhone.trim().isEmpty()) {
|
||||
q.like(AiQaMain::getSalesPhone, salesPhone);
|
||||
}
|
||||
if (salesName != null && !salesName.trim().isEmpty()) {
|
||||
q.like(AiQaMain::getSalesName, salesName);
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
if (createStartTime != null && !createStartTime.trim().isEmpty()) {
|
||||
try {
|
||||
q.ge(AiQaMain::getCreateTime, LocalDateTime.parse(createStartTime, formatter));
|
||||
} catch (Exception ex) {
|
||||
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 {
|
||||
q.le(AiQaMain::getCreateTime, LocalDateTime.parse(createEndTime, formatter));
|
||||
} catch (Exception ex) {
|
||||
result.put("success", false);
|
||||
result.put("message", "创建结束时间格式错误,请使用:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
q.orderByDesc(AiQaMain::getCreateTime);
|
||||
Page<AiQaMain> data = aiQaMainService.page(page, q);
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", data.getRecords());
|
||||
result.put("total", data.getTotal());
|
||||
result.put("current", data.getCurrent());
|
||||
result.put("size", data.getSize());
|
||||
result.put("pages", data.getPages());
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_main list error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新")
|
||||
public ResponseEntity<Map<String, Object>> update(@RequestBody AiQaMain entity) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (entity.getId() == null || entity.getId().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "ID不能为空");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
boolean ok = aiQaMainService.updateById(entity);
|
||||
if (ok) {
|
||||
result.put("success", true);
|
||||
result.put("message", "更新成功");
|
||||
result.put("data", aiQaMainService.getById(entity.getId()));
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
result.put("success", false);
|
||||
result.put("message", "更新失败");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
} catch (Exception e) {
|
||||
log.error("ai_qa_main update error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "更新异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@Operation(summary = "删除")
|
||||
public ResponseEntity<Map<String, Object>> delete(@PathVariable String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
boolean ok = aiQaMainService.removeById(id);
|
||||
if (ok) {
|
||||
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) {
|
||||
log.error("ai_qa_main delete error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "删除异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/batchDelete")
|
||||
@Operation(summary = "批量删除")
|
||||
public ResponseEntity<Map<String, Object>> batchDelete(@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 ok = aiQaMainService.removeByIds(ids);
|
||||
if (ok) {
|
||||
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) {
|
||||
log.error("ai_qa_main batchDelete error", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "批量删除异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import java.util.Locale;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -62,6 +63,9 @@ public class AudioManagementSegmentsController {
|
||||
@RequestBody AudioManagementSegments segment) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (segment.getId() == null || segment.getId().trim().isEmpty()) {
|
||||
segment.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
if (segment.getCreateTime() == null) {
|
||||
segment.setCreateTime(LocalDateTime.now());
|
||||
}
|
||||
|
||||
59
src/main/java/com/rj/entity/AiQaItem.java
Normal file
59
src/main/java/com/rj/entity/AiQaItem.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.rj.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* AI 问答子表
|
||||
*
|
||||
* <p>对应表:ai_qa_item</p>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName(value = "ai_qa_item", autoResultMap = true)
|
||||
@Schema(description = "AI问答子表")
|
||||
public class AiQaItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键,UUID")
|
||||
@TableId("id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "主表ID(ai_qa_main.id)")
|
||||
@TableField("parent_id")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "问题来源")
|
||||
@TableField("quest_src")
|
||||
private String questSrc;
|
||||
|
||||
@Schema(description = "回答内容(JSON)")
|
||||
@TableField(value = "answer_text", typeHandler = JacksonTypeHandler.class)
|
||||
private JsonNode answerText;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
@TableField("tenant_id")
|
||||
private String tenantId;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@TableField("remarks")
|
||||
private String remarks;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
65
src/main/java/com/rj/entity/AiQaMain.java
Normal file
65
src/main/java/com/rj/entity/AiQaMain.java
Normal file
@@ -0,0 +1,65 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* AI 问答主表
|
||||
*
|
||||
* <p>对应表:ai_qa_main</p>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("ai_qa_main")
|
||||
@Schema(description = "AI问答主表")
|
||||
public class AiQaMain implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键,UUID")
|
||||
@TableId("id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "主题")
|
||||
@TableField("title")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "问题类型")
|
||||
@TableField("qa_type")
|
||||
private String qaType;
|
||||
|
||||
@Schema(description = "销售ID")
|
||||
@TableField("sales_id")
|
||||
private String salesId;
|
||||
|
||||
@Schema(description = "销售手机号")
|
||||
@TableField("sales_phone")
|
||||
private String salesPhone;
|
||||
|
||||
@Schema(description = "销售姓名")
|
||||
@TableField("sales_name")
|
||||
private String salesName;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
@TableField("tenant_id")
|
||||
private String tenantId;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@TableField("remarks")
|
||||
private String remarks;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
14
src/main/java/com/rj/mapper/AiQaItemMapper.java
Normal file
14
src/main/java/com/rj/mapper/AiQaItemMapper.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.rj.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rj.entity.AiQaItem;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AI 问答子表 Mapper
|
||||
*
|
||||
* <p>对应表:ai_qa_item</p>
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiQaItemMapper extends BaseMapper<AiQaItem> {
|
||||
}
|
||||
14
src/main/java/com/rj/mapper/AiQaMainMapper.java
Normal file
14
src/main/java/com/rj/mapper/AiQaMainMapper.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.rj.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rj.entity.AiQaMain;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AI 问答主表 Mapper
|
||||
*
|
||||
* <p>对应表:ai_qa_main</p>
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiQaMainMapper extends BaseMapper<AiQaMain> {
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.rj.mapper;
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rj.entity.AudioManagementSegments;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
@@ -16,6 +17,7 @@ import java.util.List;
|
||||
*
|
||||
* 对应表:audio_management_segments
|
||||
*/
|
||||
@Mapper
|
||||
public interface AudioManagementSegmentsMapper extends BaseMapper<AudioManagementSegments> {
|
||||
|
||||
/**
|
||||
|
||||
12
src/main/java/com/rj/service/IAiQaItemService.java
Normal file
12
src/main/java/com/rj/service/IAiQaItemService.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.rj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.rj.entity.AiQaItem;
|
||||
|
||||
/**
|
||||
* AI 问答子表 服务类
|
||||
*
|
||||
* <p>对应表:ai_qa_item;常规 CRUD 与分页见 {@link IService}。</p>
|
||||
*/
|
||||
public interface IAiQaItemService extends IService<AiQaItem> {
|
||||
}
|
||||
12
src/main/java/com/rj/service/IAiQaMainService.java
Normal file
12
src/main/java/com/rj/service/IAiQaMainService.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.rj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.rj.entity.AiQaMain;
|
||||
|
||||
/**
|
||||
* AI 问答主表 服务类
|
||||
*
|
||||
* <p>对应表:ai_qa_main;常规 CRUD 与分页见 {@link IService}。</p>
|
||||
*/
|
||||
public interface IAiQaMainService extends IService<AiQaMain> {
|
||||
}
|
||||
14
src/main/java/com/rj/service/impl/AiQaItemServiceImpl.java
Normal file
14
src/main/java/com/rj/service/impl/AiQaItemServiceImpl.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.rj.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rj.entity.AiQaItem;
|
||||
import com.rj.mapper.AiQaItemMapper;
|
||||
import com.rj.service.IAiQaItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* AI 问答子表 服务实现
|
||||
*/
|
||||
@Service
|
||||
public class AiQaItemServiceImpl extends ServiceImpl<AiQaItemMapper, AiQaItem> implements IAiQaItemService {
|
||||
}
|
||||
14
src/main/java/com/rj/service/impl/AiQaMainServiceImpl.java
Normal file
14
src/main/java/com/rj/service/impl/AiQaMainServiceImpl.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.rj.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rj.entity.AiQaMain;
|
||||
import com.rj.mapper.AiQaMainMapper;
|
||||
import com.rj.service.IAiQaMainService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* AI 问答主表 服务实现
|
||||
*/
|
||||
@Service
|
||||
public class AiQaMainServiceImpl extends ServiceImpl<AiQaMainMapper, AiQaMain> implements IAiQaMainService {
|
||||
}
|
||||
Reference in New Issue
Block a user