AnalyseDetailMapper.xml 2.24 KB
<?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>