AnalyseDetailMapper.xml
2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?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.jevon.mapper.AnalyseDetailMapper" >
<resultMap id="BaseResultMap" type="com.jevon.model.AnalyseDetail" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="analyse_id" property="analyseId" jdbcType="INTEGER" />
<result column="question_number" property="questionNumber" jdbcType="VARCHAR" />
<result column="question_type" property="questionType" jdbcType="INTEGER" />
<result column="difficult" property="difficult" jdbcType="INTEGER" />
<result column="score" property="score" jdbcType="FLOAT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<insert id="insertBatch" parameterType="java.util.List">
insert into sz_learn_analyse_detail (analyse_id, question_number,question_type,difficult,score,create_time)
values
<foreach collection="list" item="emp" separator=",">
(#{emp.analyseId},#{emp.questionNumber},#{emp.questionType},#{emp.difficult},#{emp.score},#{emp.createTime})
</foreach>
</insert>
<select id="selectByAnalyseId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select * from sz_learn_analyse_detail where analyse_id = #{analyseId} order by id
</select>
<select id="selectDifficult" parameterType="com.jevon.model.AnalyseDetail" resultType="java.lang.Double">
select sum(score) from sz_learn_analyse_detail where analyse_id = #{analyseId} and difficult =#{difficult}
</select>
<select id="selectDifficultDetail" parameterType="com.jevon.model.AnalyseDetail" resultMap="BaseResultMap">
select * from sz_learn_analyse_detail where analyse_id = #{analyseId} and difficult =#{difficult}
</select>
<select id="selectQuestionType" parameterType="java.lang.Integer" resultType="java.lang.String">
select DISTINCT question_type from sz_learn_analyse_detail where analyse_id = #{analyseId}
</select>
<select id="selectSumType" parameterType="com.jevon.model.AnalyseDetail" resultType="java.lang.Double">
select sum(score) from sz_learn_analyse_detail where analyse_id = #{analyseId} and question_type =#{questionType}
</select>
</mapper>