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

    <resultMap type="com.srs.comprehensive.domain.InfoTeacher" id="InfoTeacherMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="teacherName" column="teacher_name" jdbcType="VARCHAR"/>
        <result property="gender" column="gender" jdbcType="VARCHAR"/>
        <result property="age" column="age" jdbcType="INTEGER"/>
        <result property="tNo" column="t_no" jdbcType="VARCHAR"/>
        <result property="deptId" column="dept_id" jdbcType="INTEGER"/>
        <result property="phone" column="phone" 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="InfoTeacherMap">
        select
          id, teacher_name, gender, age, t_no, dept_id, phone, write_time, read_time, data_status, chmod_status
        from xgxt_iwh.info_teacher
        <where>
            <if test="writeTime != null">
               and write_time = #{writeTime}
            </if>
            <if test="readTime != null">
               and read_time = #{readTime}
            </if>
            <if test="dataStatus != null and dataStatus != ''">
                and data_status = #{dataStatus}
            </if>
            <if test="chmodStatus != null and chmodStatus != ''">
               and chmod_status = #{chmodStatus}
            </if>
        </where>

    </select>


    <!--通过主键修改数据-->
    <update id="update">
        update xgxt_iwh.info_teacher
        <set>
            <if test="teacherName != null and teacherName != ''">
                teacher_name = #{teacherName},
            </if>
            <if test="gender != null and gender != ''">
                gender = #{gender},
            </if>
            <if test="age != null">
                age = #{age},
            </if>
            <if test="tNo != null">
                t_no = #{tNo},
            </if>
            <if test="deptId != null">
                dept_id = #{deptId},
            </if>
            <if test="phone != null and phone != ''">
                phone = #{phone},
            </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>


