ExamApplyMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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.ExamApplyMapper">
  6. <resultMap type="com.zhongzheng.modules.exam.domain.ExamApply" id="ExamApplyResult">
  7. <result property="applyId" column="exam_apply_id"/>
  8. <result property="applyUrl" column="apply_url"/>
  9. <result property="applyName" column="apply_name"/>
  10. <result property="applyIntroduce" column="apply_introduce"/>
  11. <result property="applyStatus" column="apply_status"/>
  12. <result property="applyStartTime" column="apply_start_time"/>
  13. <result property="applyEndTime" column="apply_end_time"/>
  14. <result property="createTime" column="create_time"/>
  15. <result property="updateTime" column="update_time"/>
  16. <result property="status" column="status"/>
  17. </resultMap>
  18. <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplyVo" id="ExamApplyVo">
  19. <result property="applyId" column="exam_apply_id"/>
  20. <result property="applyUrl" column="apply_url"/>
  21. <result property="applyName" column="apply_name"/>
  22. <result property="applyIntroduce" column="apply_introduce"/>
  23. <result property="applyStatus" column="apply_status"/>
  24. <result property="applyStartTime" column="apply_start_time"/>
  25. <result property="applyEndTime" column="apply_end_time"/>
  26. <result property="status" column="status"/>
  27. <result property="educationName" column="education_name"/>
  28. <result property="projectName" column="project_name"/>
  29. <result property="businessName" column="business_name"/>
  30. <result property="cancelPeople" column="cancel_people"/>
  31. <result property="people" column="people"/>
  32. </resultMap>
  33. <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
  34. <result property="id" column="id"/>
  35. <result property="examNumberId" column="exam_number_id"/>
  36. <result property="goodsId" column="goods_id"/>
  37. <result property="goodsName" column="goods_name"/>
  38. <result property="code" column="code"/>
  39. <result property="standPrice" column="stand_price"/>
  40. <result property="goodsStatus" column="goods_status"/>
  41. </resultMap>
  42. <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplySiteVo" id="ExamApplySiteVo">
  43. <result property="id" column="id"/>
  44. <result property="siteId" column="site_id"/>
  45. <result property="applyId" column="apply_id"/>
  46. <result property="status" column="status"/>
  47. <result property="status" column="status"/>
  48. <result property="siteAddress" column="site_address"/>
  49. <result property="people" column="people"/>
  50. </resultMap>
  51. <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplySiteTimeVo" id="ExamApplySiteTimeVo">
  52. <result property="id" column="id"/>
  53. <result property="applySiteId" column="apply_site_id"/>
  54. <result property="siteTime" column="site_time"/>
  55. <result property="examTime" column="exam_time"/>
  56. </resultMap>
  57. <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberQueryBo" resultMap="ExamNumberGoodsVoResult">
  58. SELECT
  59. goods_id,
  60. goods_name,
  61. CODE,
  62. stand_price,
  63. (case WHEN (SELECT COUNT(ea.apply_id) FROM exam_apply ea LEFT JOIN exam_apply_goods eag on ea.apply_id =eag.apply_id where 1=1 and eag.goods_id = g.goods_id and ea.status =1) >0 then 0 ELSE 1 end) as goods_status
  64. FROM
  65. goods g
  66. WHERE
  67. 1 = 1
  68. and g.status in(1)
  69. and (SELECT COUNT(eng.id) FROM exam_number_goods eng LEFT JOIN exam_number en on eng.exam_number_id = en.exam_number_id where eng.goods_id =g.goods_id and en.`status` = 1) > 0
  70. <if test="businessId != null and businessId != ''">
  71. and g.business_id = #{businessId}
  72. </if>
  73. <if test="goodsId != null and goodsId != ''">
  74. and g.goods_id = #{goodsId}
  75. </if>
  76. <if test="projectId != null and projectId != ''">
  77. and g.project_id = #{projectId}
  78. </if>
  79. <if test="goodsType != null and goodsType != ''">
  80. and g.goods_type = #{goodsType}
  81. </if>
  82. </select>
  83. <select id="countGoods" parameterType="long" resultType="long">
  84. SELECT
  85. eag.goods_id
  86. FROM
  87. exam_apply ea
  88. LEFT JOIN exam_apply_goods eag ON ea.apply_id = eag.apply_id where ea.apply_id =#{applyId}
  89. and (SELECT COUNT(eay.apply_id) FROM exam_apply eay LEFT JOIN exam_apply_goods eags ON eay.apply_id = eags.apply_id where eags.goods_id = eag.goods_id and eags.apply_id != eag.apply_id and eay.status =1) > 0
  90. </select>
  91. <select id="examNumberGoodsVos" parameterType="long" resultMap="ExamNumberGoodsVoResult">
  92. SELECT
  93. g.goods_id,
  94. g.goods_name,
  95. g.CODE,
  96. g.stand_price
  97. FROM
  98. goods g
  99. LEFT JOIN exam_apply_goods eag ON g.goods_id = eag.goods_id
  100. WHERE
  101. 1 = 1
  102. AND g.STATUS IN ( 1 )
  103. AND eag.apply_id =#{applyId}
  104. </select>
  105. <select id="addressExam" parameterType="map" resultMap="ExamApplySiteVo">
  106. SELECT
  107. *,
  108. es.site_address,
  109. es.people
  110. FROM
  111. exam_apply_site eas
  112. LEFT JOIN exam_site es on eas.site_id = es.site_id
  113. WHERE
  114. eas.apply_id =#{applyId}
  115. and eas.`status` =#{status}
  116. </select>
  117. <select id="addressTimeExam" parameterType="map" resultMap="ExamApplySiteTimeVo">
  118. SELECT
  119. *
  120. FROM
  121. exam_apply_site_time east
  122. where 1=1
  123. and east.apply_site_id =#{id}
  124. </select>
  125. <select id="selectByApply" parameterType="long" resultMap="ExamApplyVo">
  126. SELECT
  127. * ,
  128. (select cet.education_name FROM course_education_type cet where ea.education_type_id= cet.id) as education_name,
  129. (select cpt.project_name FROM course_project_type cpt where ea.project_id= cpt.id) as project_name,
  130. (select cb.business_name FROM course_business cb where ea.business_id= cb.id) as business_name
  131. FROM
  132. exam_apply ea
  133. where 1=1
  134. and ea.apply_id = #{applyId}
  135. </select>
  136. <select id="queryExam" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultMap="ExamApplyVo">
  137. SELECT
  138. * ,
  139. (select cet.education_name FROM course_education_type cet where ea.education_type_id= cet.id) as education_name,
  140. (select cpt.project_name FROM course_project_type cpt where ea.project_id= cpt.id) as project_name,
  141. (select cb.business_name FROM course_business cb where ea.business_id= cb.id) as business_name,
  142. (SELECT COUNT(us.apply_id) FROM user_subscribe us where us.apply_id = ea.apply_id and us.subscribe_status = 1) as people,
  143. (SELECT COUNT(us.apply_id) FROM user_subscribe us where us.apply_id = ea.apply_id and us.subscribe_status = 2) as cancel_people
  144. FROM
  145. exam_apply ea
  146. where 1=1
  147. <if test="status != null and status.size()!=0 ">
  148. AND ea.status in
  149. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  150. #{item}
  151. </foreach>
  152. </if>
  153. </select>
  154. </mapper>