ExamBeforeMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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.ExamBeforeMapper">
  6. <resultMap type="com.zhongzheng.modules.exam.domain.ExamBefore" id="ExamBeforeResult">
  7. <result property="beforeId" column="before_id"/>
  8. <result property="code" column="code"/>
  9. <result property="beforeName" column="before_name"/>
  10. <result property="beforeStartTime" column="before_start_time"/>
  11. <result property="beforeEndTime" column="before_end_time"/>
  12. <result property="beforeStatus" column="before_status"/>
  13. <result property="beforeUrl" column="before_url"/>
  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.ExamBeforeVo" id="ExamBeforeVo">
  19. <result property="beforeId" column="before_id"/>
  20. <result property="code" column="code"/>
  21. <result property="beforeName" column="before_name"/>
  22. <result property="beforeStartTime" column="before_start_time"/>
  23. <result property="beforeEndTime" column="before_end_time"/>
  24. <result property="beforeStatus" column="before_status"/>
  25. <result property="beforeUrl" column="before_url"/>
  26. <result property="status" column="status"/>
  27. <result property="urlName" column="url_name"/>
  28. <result property="url" column="url"/>
  29. <result property="educationName" column="education_name"/>
  30. <result property="projectName" column="project_name"/>
  31. <result property="people" column="people"/>
  32. <result property="businessName" column="business_name"/>
  33. </resultMap>
  34. <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
  35. <result property="id" column="id"/>
  36. <result property="examNumberId" column="exam_number_id"/>
  37. <result property="goodsId" column="goods_id"/>
  38. <result property="goodsName" column="goods_name"/>
  39. <result property="code" column="code"/>
  40. <result property="standPrice" column="stand_price"/>
  41. <result property="goodsStatus" column="goods_status"/>
  42. </resultMap>
  43. <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo" resultMap="ExamNumberGoodsVoResult">
  44. SELECT
  45. goods_id,
  46. goods_name,
  47. CODE,
  48. stand_price,
  49. (case WHEN (SELECT COUNT(eb.before_id) FROM exam_before eb LEFT JOIN exam_before_goods ebg on eb.before_id =ebg.before_id where 1=1 and ebg.goods_id = g.goods_id and eb.status =1) >0 then 0 ELSE 1 end) as goods_status
  50. FROM
  51. goods g
  52. WHERE
  53. 1 = 1
  54. and g.status in(1)
  55. 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
  56. <if test="businessId != null and businessId != ''">
  57. and g.business_id = #{businessId}
  58. </if>
  59. <if test="goodsId != null and goodsId != ''">
  60. and g.goods_id = #{goodsId}
  61. </if>
  62. <if test="projectId != null and projectId != ''">
  63. and g.project_id = #{projectId}
  64. </if>
  65. <if test="goodsType != null and goodsType != ''">
  66. and g.goods_type = #{goodsType}
  67. </if>
  68. </select>
  69. <select id="examNumberGoodsVos" parameterType="long" resultMap="ExamNumberGoodsVoResult">
  70. SELECT
  71. g.goods_id,
  72. g.goods_name,
  73. g.CODE,
  74. g.stand_price
  75. FROM
  76. goods g
  77. LEFT JOIN exam_before_goods ebg ON g.goods_id = ebg.goods_id
  78. WHERE
  79. 1 = 1
  80. AND g.STATUS IN ( 1 )
  81. AND ebg.before_id =#{beforeId}
  82. </select>
  83. <select id="selectByBefore" parameterType="long" resultMap="ExamBeforeVo">
  84. SELECT
  85. *,
  86. (select cet.education_name FROM course_education_type cet where eb.education_type_id= cet.id) as education_name,
  87. (select cpt.project_name FROM course_project_type cpt where eb.project_id= cpt.id) as project_name,
  88. (select cb.business_name FROM course_business cb where eb.business_id= cb.id) as business_name
  89. FROM
  90. exam_before eb
  91. LEFT JOIN exam_before_url ebu on eb.before_url=ebu.before_url_id
  92. where 1=1
  93. and eb.before_id = #{beforeId}
  94. </select>
  95. <select id="queryBefore" parameterType="com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo" resultMap="ExamBeforeVo">
  96. SELECT
  97. *,
  98. (select cet.education_name FROM course_education_type cet where eb.education_type_id= cet.id) as education_name,
  99. (select cpt.project_name FROM course_project_type cpt where eb.project_id= cpt.id) as project_name,
  100. (select cb.business_name FROM course_business cb where eb.business_id= cb.id) as business_name,
  101. (SELECT COUNT(us.apply_id) FROM user_subscribe us where us.before_id = eb.before_id and us.before_status = 1) as people
  102. FROM
  103. exam_before eb
  104. LEFT JOIN exam_before_url ebu on eb.before_url=ebu.before_url_id
  105. where 1=1
  106. <if test="status != null and status.size()!=0 ">
  107. AND eb.status in
  108. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  109. #{item}
  110. </foreach>
  111. </if>
  112. </select>
  113. </mapper>