<?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.GradeClassDOMapper">
    <resultMap id="BaseResultMap" type="com.yinlihupo.enlish.service.domain.dataobject.GradeClassDO">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="class_id" jdbcType="INTEGER" property="classId" />
        <result column="grade_id" jdbcType="INTEGER" property="gradeId" />
    </resultMap>

    <select id="selectByClassIds" resultMap="BaseResultMap">
        select * from grade_class where class_id in
        <foreach collection="classIds" item="classId" separator="," open="(" close=")">
            #{classId}
        </foreach>
    </select>
    <select id="selectByGradeId" resultType="java.lang.Integer">
        select count(1)
        from grade_class
        where grade_id = #{gradeId}
    </select>

    <insert id="insert">
        insert into grade_class
            (class_id, grade_id)
        values
            (#{classId}, #{gradeId})
    </insert>

    <delete id="deleteByClassId">
        delete from grade_class where class_id = #{classId}
    </delete>
</mapper>