<?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.yinlihupo.enlish.service.domain.mapper.GradeDOMapper">
    <resultMap id="BaseResultMap" type="com.yinlihupo.enlish.service.domain.dataobject.GradeDO">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="title" jdbcType="VARCHAR" property="title" />
        <result column="time" jdbcType="TIMESTAMP" property="time" />
    </resultMap>

    <select id="selectById" resultMap="BaseResultMap">
        select *
        from grade
        where id = #{id}
    </select>

    <select id="selectByGradeIds" resultMap="BaseResultMap">
        select *
        from grade
        where id in
        <foreach collection="gradeIds" item="gradeId" separator="," open="(" close=")">
            #{gradeId}
        </foreach>
    </select>

    <select id="selectList" resultMap="BaseResultMap">
        select *
        from grade
        limit #{startIndex},#{pageSize}
    </select>

    <select id="selectCount" resultType="java.lang.Integer">
        select count(1)
        from grade
    </select>

    <insert id="insert">
        insert into grade
            (title, time)
        values
            (#{name}, now())
    </insert>

    <delete id="deleteById">
        delete from grade
        where id = #{id}
    </delete>

</mapper>