1.修改获取开场白接口的返回结构

2.添加获取评论接口
This commit is contained in:
2025-07-23 16:02:43 +08:00
parent cc82f85e00
commit e74a8bfd98
8 changed files with 109 additions and 12 deletions

View File

@@ -2,9 +2,11 @@ package com.yupi.springbootinit.controller;
import com.yupi.springbootinit.common.BaseResponse;
import com.yupi.springbootinit.common.ResultUtils;
import com.yupi.springbootinit.model.entity.AiComment;
import com.yupi.springbootinit.model.entity.AiTemplate;
import com.yupi.springbootinit.model.vo.common.AccountCrawlCount;
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
import com.yupi.springbootinit.service.AiCommentService;
import com.yupi.springbootinit.service.AiTemplateService;
import com.yupi.springbootinit.service.CommonService;
import com.yupi.springbootinit.service.CountryInfoService;
@@ -34,6 +36,9 @@ public class CommonController {
@Resource
private CommonService commonService;
@Resource
private AiCommentService aiCommentService;
@PostMapping("country_info")
public BaseResponse<List<CountryInfoVO>> countryInfo() {
@@ -48,10 +53,20 @@ public class CommonController {
@GetMapping("prologue")
public BaseResponse<List<String>> getPrologue(){
List<AiTemplate> list = aiTemplateService.list();
ArrayList<String> strings = new ArrayList<>();
ArrayList<String> prologueList = new ArrayList<>();
list.forEach(item -> {
strings.add(item.getContent());
prologueList.add(item.getContent());
});
return ResultUtils.success(strings);
return ResultUtils.success(prologueList);
}
@GetMapping("comment")
public BaseResponse<List<String>> getComment(){
List<AiComment> list = aiCommentService.list();
ArrayList<String> commentList = new ArrayList<>();
list.forEach(item -> {
commentList.add(item.getContent());
});
return ResultUtils.success(commentList);
}
}

View File

@@ -0,0 +1,12 @@
package com.yupi.springbootinit.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yupi.springbootinit.model.entity.AiComment;
/*
* @author: ziin
* @date: 2025/7/23 16:00
*/
public interface AiCommentMapper extends BaseMapper<AiComment> {
}

View File

@@ -0,0 +1,33 @@
package com.yupi.springbootinit.model.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/*
* @author: ziin
* @date: 2025/7/23 16:00
*/
@ApiModel(description="ai_comment")
@Data
@TableName(value = "ai_comment")
public class AiComment {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value="主键")
private Integer id;
/**
* 具体评论
*/
@TableField(value = "content")
@ApiModelProperty(value="具体评论")
private String content;
}

View File

@@ -24,13 +24,6 @@ public class AiTemplate {
@ApiModelProperty(value="主键")
private Integer id;
/**
* 语言
*/
@TableField(value = "`language`")
@ApiModelProperty(value="语言")
private String language;
/**
* 具体话术
*/

View File

@@ -0,0 +1,13 @@
package com.yupi.springbootinit.service;
import com.yupi.springbootinit.model.entity.AiComment;
import com.baomidou.mybatisplus.extension.service.IService;
/*
* @author: ziin
* @date: 2025/7/23 16:00
*/
public interface AiCommentService extends IService<AiComment>{
}

View File

@@ -0,0 +1,18 @@
package com.yupi.springbootinit.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.springbootinit.model.entity.AiComment;
import com.yupi.springbootinit.mapper.AiCommentMapper;
import com.yupi.springbootinit.service.AiCommentService;
/*
* @author: ziin
* @date: 2025/7/23 16:00
*/
@Service
public class AiCommentServiceImpl extends ServiceImpl<AiCommentMapper, AiComment> implements AiCommentService{
}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yupi.springbootinit.mapper.AiCommentMapper">
<resultMap id="BaseResultMap" type="com.yupi.springbootinit.model.entity.AiComment">
<!--@mbg.generated-->
<!--@Table ai_comment-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="content" jdbcType="VARCHAR" property="content" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, content
</sql>
</mapper>

View File

@@ -5,11 +5,10 @@
<!--@mbg.generated-->
<!--@Table ai_template-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="language" jdbcType="VARCHAR" property="language" />
<result column="content" jdbcType="VARCHAR" property="content" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, `language`, content
id, content
</sql>
</mapper>