54 lines
1.7 KiB
XML
54 lines
1.7 KiB
XML
<?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="PronoStat">
|
|
|
|
<insert id="insertPronoStat" parameterType="PronoStat">
|
|
INSERT INTO pronostat(
|
|
uid, aispeech, totalscore, totalnum, areaid)
|
|
VALUES (#{uid}, #{aiSpeech}, #{totalScore}, #{totalNum}, #{areaId});
|
|
</insert>
|
|
|
|
<update id="updatePronoStat" parameterType="PronoStat">
|
|
|
|
|
|
UPDATE pronostat
|
|
SET uid=#{uid}, aispeech=#{aiSpeech}, totalscore=#{totalScore}, totalnum=#{totalNum}, areaid=#{areaId}
|
|
where uid=#{uid} and aiSpeech=#{aiSpeech}
|
|
|
|
</update>
|
|
|
|
<select id="getPronoStatByKey" parameterType="java.util.Map" resultType="PronoStat">
|
|
|
|
|
|
|
|
|
|
SELECT uid, aispeech, totalscore, totalnum, areaid
|
|
FROM pronostat WHERE uid=#{uid} and aiSpeech=#{aiSpeech} and areaId=#{areaId}
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getSeqPronoStat" resultType="Integer" useCache="false" flushCache="true">
|
|
|
|
SELECT nextval('seq_pronoStatId') ;
|
|
|
|
</select>
|
|
|
|
<select id="getPronoStatsByUid" parameterType="java.util.HashMap" resultType="PronoStat">
|
|
SELECT uid, aispeech, totalscore, totalnum, areaid
|
|
FROM pronostat WHERE uid=#{uid} and areaId=#{areaId}
|
|
order by aispeech
|
|
|
|
</select>
|
|
|
|
<select id="getAvgscoreByUid" parameterType="java.util.HashMap" resultType="java.util.HashMap">
|
|
|
|
select case when howmuch = 0 then 0 else totalScore/howmuch::numeric end as score,
|
|
0 as accuracy, 0 as fluent , 0 as integrity
|
|
from UserHonor
|
|
where uid = #{uid} and areaId=#{areaId}
|
|
|
|
</select>
|
|
|
|
</mapper> |