Files
en-edu/enlish-service/src/main/resources/mapper/StudentDOMapper.xml

34 lines
1.4 KiB
XML

<?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.StudentDOMapper">
<resultMap id="BaseResultMap" type="com.yinlihupo.enlish.service.domain.dataobject.StudentDO">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="class_id" jdbcType="INTEGER" property="classId" />
<result column="grade_id" jdbcType="INTEGER" property="gradeId" />
<result column="initial_vocabulary_size" jdbcType="INTEGER" property="initialVocabularySize" />
<result column="current_vocabulary_size" jdbcType="INTEGER" property="currentVocabularySize" />
</resultMap>
<sql id="Base_Column_List">
id, `name`, class_id, grade_id, initial_vocabulary_size, current_vocabulary_size
</sql>
<select id="selectStudentDOListByClassIdAndGradeId" resultMap="BaseResultMap">
select *
from student
where 1 = 1
<if test="classId != null">
AND class_id = #{classId}
</if>
<if test="gradeId != null">
AND grade_id = #{gradeId}
</if>
LIMIT #{offset}, #{pageSize}
</select>
<select id="selectStudentCount">
select count(1)
from student
</select>
</mapper>