TaTestLogMapper.xml 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.yunzhi.demo.mapper.TaTestLogMapper">
  4. <select id="getTestLogWithStudent" resultType="com.yunzhi.demo.vo.StudentTestLog">
  5. SELECT
  6. b.student_id,
  7. b.name,
  8. b.sex,
  9. b.phone,
  10. b.e_mail,
  11. a.school_id,
  12. b.school_batch,
  13. b.specialty_id,
  14. a.student_no,
  15. b.person_id,
  16. b.status,
  17. b.create_date,
  18. b.update_date,
  19. a.`name` as test_name,
  20. a.serial_no,
  21. a.attchment,
  22. c.`name` as school_name,
  23. d.`name` as specialty_name
  24. FROM
  25. ta_test_log a
  26. LEFT JOIN ta_student b on a.student_no = b.student_no
  27. LEFT JOIN td_school c on a.school_id = c.school_id
  28. LEFT JOIN td_specialty d on b.specialty_id = d.specialty_id
  29. WHERE
  30. a.`status` > - 1
  31. <if test="studentNo != null and studentNo != ''">
  32. AND a.student_no LIKE CONCAT( '%', #{studentNo}, '%' )
  33. </if>
  34. <if test="schoolId != null and schoolId != ''">
  35. AND a.school_id = #{schoolId}
  36. </if>
  37. <if test="specialtyId != null and specialtyId != ''">
  38. AND b.specialty_id = #{specialtyId}
  39. </if>
  40. ORDER BY
  41. a.create_date DESC
  42. </select>
  43. </mapper>