ExamNumberMapper.xml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.exam.mapper.ExamNumberMapper">
  6. <resultMap type="com.zhongzheng.modules.exam.domain.ExamNumber" id="ExamNumberResult">
  7. <result property="examNumberId" column="exam_number_id"/>
  8. <result property="code" column="code"/>
  9. <result property="examNumber" column="exam_number"/>
  10. <result property="doNumber" column="do_number"/>
  11. <result property="status" column="status"/>
  12. <result property="createTime" column="create_time"/>
  13. <result property="updateTime" column="update_time"/>
  14. <result property="goodsType" column="goods_type"/>
  15. <result property="educationTypeId" column="education_type_id"/>
  16. <result property="businessId" column="business_id"/>
  17. <result property="projectId" column="project_id"/>
  18. </resultMap>
  19. <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberVo" id="ExamNumberVoResult">
  20. <result property="examNumberId" column="exam_number_id"/>
  21. <result property="code" column="code"/>
  22. <result property="examNumber" column="exam_number"/>
  23. <result property="doNumber" column="do_number"/>
  24. <result property="status" column="status"/>
  25. <result property="goodsType" column="goods_type"/>
  26. <result property="educationTypeId" column="education_type_id"/>
  27. <result property="businessId" column="business_id"/>
  28. <result property="projectId" column="project_id"/>
  29. </resultMap>
  30. <select id="ListExamNumber" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberQueryBo" resultMap="ExamNumberVoResult">
  31. SELECT
  32. *,
  33. (SELECT cet.education_name FROM course_education_type cet where cet.id = en.education_type_id) as education_name,
  34. (SELECT cpt.project_name FROM course_project_type cpt where cpt.id = en.project_id) as project_name,
  35. (SELECT cb.business_name FROM course_business cb where cb.id = en.business_id) as business_name
  36. FROM
  37. exam_number en where 1=1
  38. <if test="status != null and status.size()!=0 ">
  39. AND en.status in
  40. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  41. #{item}
  42. </foreach>
  43. </if>
  44. <if test="examNumberId != null and examNumberId != ''">
  45. AND en.exam_number_id = #{examNumberId}
  46. </if>
  47. <if test="goodsId != null and goodsId != ''">
  48. AND AND (SELECT COUNT(eng.id) FROM exam_number_goods eng where eng.goods_id =#{goodsId}) > 0
  49. </if>
  50. order by en.create_time desc
  51. </select>
  52. </mapper>