You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
815 B

<?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.example.mapper.StudentCourseMapper">
<select id="selectAll" resultType="com.example.entity.StudentCourse">
select student_course.*, student.name as studentName from student_course
left join student
on student_course.student_id = student.id
<where>
<if test="name != null">and student_course.name like concat('%', #{name}, '%')</if>
<if test="no != null">and student_course.no like concat('%', #{no}, '%')</if>
<if test="studentId != null">and student_course.student_id = #{studentId}</if>
</where>
order by id desc
</select>
</mapper>