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

    <select id="selectClassDOById" resultType="com.yinlihupo.enlish.service.domain.dataobject.ClassDO">
        select *
        from `class`
        where id = #{id}
    </select>

    <select id="selectClassDOList" resultMap="BaseResultMap">
        select *
        from `class`
        limit #{startIndex}, #{pageSize}
    </select>

    <select id="selectClassDOCount" resultType="java.lang.Integer">
        select count(1)
        from `class`
    </select>

    <select id="selectClassDOListByIds" resultType="com.yinlihupo.enlish.service.domain.dataobject.ClassDO">
        select *
        from `class`
        where id in
        <foreach collection="classIds" item="classId" separator="," close=")" open="(" index="">
            #{classId}
        </foreach>
    </select>

    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
        insert into `class`
        (title)
        values (#{title})
    </insert>

    <delete id="delete">
        delete from `class`
        where id = #{id}
    </delete>
</mapper>