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

    <resultMap type="com.srs.comprehensive.domain.SchoolMajor" id="SchoolMajorMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="majorName" column="major_name" jdbcType="VARCHAR"/>
        <result property="deptId" column="dept_id" jdbcType="INTEGER"/>
        <result property="introduction" column="introduction" jdbcType="VARCHAR"/>
        <result property="majorCode" column="major_code" 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"/>
        <result property="deptCode" column="dept_code" jdbcType="VARCHAR"/>
    </resultMap>

    <!--查询所有-->
    <select id="queryAll" resultMap="SchoolMajorMap">
        select
          id, major_name, dept_id, introduction, major_code, write_time, read_time, data_status, chmod_status,dept_code
        from xgxt_iwh.school_major where chmod_status ='1' and data_status ='1'

    </select>
    

    <!--通过主键修改数据-->
    <update id="update">
        update xgxt_iwh.school_major
        <set>
            <if test="majorName != null and majorName != ''">
                major_name = #{majorName},
            </if>
            <if test="deptId != null">
                dept_id = #{deptId},
            </if>
            <if test="introduction != null and introduction != ''">
                introduction = #{introduction},
            </if>
            <if test="majorCode != null and majorCode != ''">
                major_code = #{majorCode},
            </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>


