<?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.SchoolClassesMapper">

    <resultMap type="com.srs.comprehensive.domain.SchoolClasses" id="SchoolClassesMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="className" column="class_name" jdbcType="VARCHAR"/>
        <result property="majorId" column="major_id" jdbcType="INTEGER"/>
        <result property="tId" column="t_id" jdbcType="INTEGER"/>
        <result property="classCode" column="class_code" jdbcType="VARCHAR"/>
        <result property="gradeCode" column="grade_code" jdbcType="VARCHAR"/>
        <result property="majorCode" column="major_code" jdbcType="VARCHAR"/>
        <result property="tNo" column="t_no" jdbcType="VARCHAR"/>
        <result property="writeTime" column="write_time" jdbcType="TIMESTAMP"/>
        <result property="readTime" column="read_time" jdbcType="TIMESTAMP"/>
        <result property="dataStatus" column="data_status" jdbcType="VARCHAR"/>
        <result property="chmodStatus" column="chmod_status" jdbcType="VARCHAR"/>
    </resultMap>

    <!--查询所有-->
    <select id="queryAll" resultMap="SchoolClassesMap">
        select *
        from xgxt_iwh.school_classes  where chmod_status ='1' and data_status ='1'
    </select>

    <!--通过主键修改数据-->
    <update id="update">
        update xgxt_iwh.school_classes
        <set>
            <if test="className != null and className != ''">
                class_name = #{className},
            </if>
            <if test="majorId != null">
                major_id = #{majorId},
            </if>
            <if test="tId != null">
                t_id = #{tId},
            </if>
            <if test="classCode != null and classCode != ''">
                class_code = #{classCode},
            </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>
        </set>
        where id = #{id}
    </update>

</mapper>


