Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1

This commit is contained in:
xzb 2022-09-27 14:53:29 +08:00
commit 1af3786341
3 changed files with 51 additions and 31 deletions

View File

@ -1,20 +0,0 @@
package club.joylink.rtss.entity.paper.question;
import java.io.Serializable;
import lombok.Data;
/**
* @author
*
*/
@Data
public class PaperQuestionWithBLOBs extends PaperQuestion implements Serializable {
/**
* 问题内容
*/
private String topic;
private String questions;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,45 @@
package club.joylink.rtss.vo.client.voice;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Base64;
@Data
@Slf4j
public class VoiceRecognitionVO {
private byte[] data;
private String filePath;
public VoiceRecognitionVO(String filePath){
this.filePath = filePath;
}
public VoiceRecognitionVO(String filePath,MultipartFile file){
this(filePath);
this.load(file);
}
public VoiceRecognitionVO(String filePath,String base64Str){
this(filePath);
this.load(base64Str);
}
public VoiceRecognitionVO(String filePath,byte[] bb){
this(filePath);
this.data = bb;
}
private void load(MultipartFile file){
try {
this.data = file.getBytes();
} catch (IOException e) {
log.error("加载数据失败 file{}",file.getOriginalFilename() + " errMsg:{}",e.getMessage(),e);
this.data = new byte[0];
}
}
private void load(String base64Str){
String base64 = base64Str.substring(base64Str.indexOf("base64,") + "base64,".length());
byte[] bytes = Base64.getDecoder().decode(base64.trim());
this.data = bytes;
}
}

View File

@ -77,10 +77,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `type`, create_user_id, create_time, project_code, company_id, race_lable, is_del,question_answer
</sql>
<sql id="Blob_Column_List">
question, question_option
id, `type`, create_user_id, create_time, project_code, company_id, race_lable, is_del,question_answer,question, question_option
</sql>
<!--<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.race2.PaperQuestionExample" resultMap="ResultMapWithBLOBs">
select
@ -112,8 +109,7 @@
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from paper_question
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
@ -133,8 +129,7 @@
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from paper_question
where id = #{id,jdbcType=BIGINT}
</select>
@ -148,7 +143,7 @@
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestion">
insert into paper_question (id, `type`, create_user_id,
create_time, project_code, company_id,
race_lable, is_del, question,
@ -159,7 +154,7 @@
#{raceLable,jdbcType=VARCHAR}, #{isDel,jdbcType=INTEGER}, #{question,jdbcType=LONGVARCHAR},
#{questionOption,jdbcType=LONGVARCHAR},#{questionAnswer,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestion">
insert into paper_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -313,7 +308,7 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestion">
update paper_question
<set>
<if test="type != null">