huliguo
3 天以前 11ec7ac8f4832c4274cf61a19cc35cda3de9e0e5
src/main/java/com/linghu/controller/OrderController.java
@@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.linghu.model.common.ResponseResult;
import com.linghu.model.entity.Orders;
import com.linghu.model.dto.KeywordDto;
import com.linghu.model.dto.OrderDto;
import com.linghu.service.OrderService;
@@ -63,7 +64,7 @@
        order.setCreate_time(LocalDateTime.now());
        boolean save = orderService.save(order);
        // 保存关键词
        boolean saveOrderWithKeywords = orderService.saveOrderWithKeywords(orderDto,order.getOrder_id());
        boolean saveOrderWithKeywords = orderService.saveOrderWithKeywords(orderDto, order.getOrder_id());
        if (!saveOrderWithKeywords) {
            return ResponseResult.error("添加关键词失败");
        }
@@ -136,9 +137,9 @@
     */
    @GetMapping
    @ApiOperation("查询订单列表")
    public ResponseResult<List<Orders>> list(
            @RequestParam(required = false) Integer pageNum,
            @RequestParam(required = false) Integer pageSize,
    public ResponseResult<Page<Orders>> list(
            @RequestParam(required = false,defaultValue = "1") Integer pageNum ,
            @RequestParam(required = false,defaultValue = "10") Integer pageSize ,
            @RequestParam(required = false) String clientName,
            @RequestParam(required = false) Integer status,
            @RequestParam(required = false) String createTime) {
@@ -158,14 +159,15 @@
        }
        // 分页查询
        if (pageNum != null && pageSize != null) {
            Page<Orders> pageInfo = new Page<>(pageNum, pageSize);
            Page<Orders> result = orderService.page(pageInfo, queryWrapper);
            return ResponseResult.success(result.getRecords());
        }
            return ResponseResult.success(result);
    }
        // 不分页
        List<Orders> list = orderService.list(queryWrapper);
        return ResponseResult.success(list);
    @GetMapping("/{orderId}/keywordList")
    @ApiOperation("获取订单关联的关键词及提问词")
    public ResponseResult<List<KeywordDto>> getKeywordList(@PathVariable String orderId) {
        List<KeywordDto> result = orderService.getKeywordListByOrderId(orderId);
        return ResponseResult.success(result);
    }
}