<?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.srs.comprehensive.mapper.SumClassTwoMapper">

    <resultMap type="SumClassTwo" id="SumClassTwoS">
        <result property="id"    column="id"    />
        <result property="stuNo"    column="stu_no"    />
        <result property="totalScore"    column="total_score"    />
        <result property="stuYearId"    column="stu_year_id"    />
        <result property="writeTime"    column="write_time"    />
        <result property="readTime"    column="read_time"    />
        <result property="dataStatus"    column="data_status"    />
        <result property="chmodStatus"    column="chmod_status"    />
        <result property="stuYearCode"    column="stu_year_code"    />
    </resultMap>
    <sql id="selectSumSportTest">
        select * from sum_class_two
    </sql>
    <select id="selectSumClassTwoAll" parameterType="SumSportTest" resultMap="SumClassTwoS">
        <include refid="selectSumSportTest"/>
        where data_status='1' and chmod_status='1'
    </select>

    <insert id="insertSumSportTest" parameterType="SumClassTwo">
        insert into sum_class_two
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="stuNo != null and stuNo != ''">stu_no,</if>
            <if test="testScore != null">test_score,</if>
            <if test="stuYearId != null">stu_year_id,</if>
            <if test="writeTime != null">write_time,</if>
            <if test="readTime != null">read_time,</if>
            <if test="dataStatus != null and dataStatus != ''">data_status,</if>
            <if test="chmodStatus != null and chmodStatus != ''">chmod_status,</if>
            <if test="stuYearCode != null and stuYearCode != ''">stu_year_code,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="stuNo != null and stuNo != ''">#{stuNo},</if>
            <if test="testScore != null">#{testScore},</if>
            <if test="stuYearId != null">#{stuYearId},</if>
            <if test="writeTime != null">#{writeTime},</if>
            <if test="readTime != null">#{readTime},</if>
            <if test="dataStatus != null and dataStatus != ''">#{dataStatus},</if>
            <if test="chmodStatus != null and chmodStatus != ''">#{chmodStatus},</if>
            <if test="stuYearCode != null and stuYearCode != ''">#{stuYearCode},</if>
        </trim>
    </insert>
    <update id="updateSum" parameterType="SumClassTwo">
        update sum_class_two
        <trim prefix="SET" suffixOverrides=",">
            <if test="stuNo != null and stuNo != ''">stu_no = #{stuNo},</if>
            <if test="testScore != null">test_score = #{testScore},</if>
            <if test="stuYearId != null">stu_year_id = #{stuYearId},</if>
            <if test="writeTime != null">write_time = #{writeTime},</if>
            <if test="readTime != null">read_time = #{readTime},</if>
            <if test="dataStatus != null and dataStatus != ''">data_status = #{dataStatus},</if>
            <if test="chmodStatus != null and chmodStatus != ''">chmod_status = #{chmodStatus},</if>
            <if test="stuYearCode != null and stuYearCode != ''">stu_year_code = #{stuYearCode},</if>
        </trim>
        where id = #{id}
    </update>
</mapper>