ExamApplyMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
  19. <result property="id" column="id"/>
  20. <result property="examNumberId" column="exam_number_id"/>
  21. <result property="goodsId" column="goods_id"/>
  22. <result property="goodsName" column="goods_name"/>
  23. <result property="code" column="code"/>
  24. <result property="standPrice" column="stand_price"/>
  25. <result property="goodsStatus" column="goods_status"/>
  26. </resultMap>
  27. <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplySiteVo" id="ExamApplySiteVo">
  28. <result property="id" column="id"/>
  29. <result property="siteId" column="site_id"/>
  30. <result property="applyId" column="apply_id"/>
  31. <result property="status" column="status"/>
  32. <result property="status" column="status"/>
  33. <result property="siteAddress" column="site_address"/>
  34. <result property="people" column="people"/>
  35. </resultMap>
  36. <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplySiteTimeVo" id="ExamApplySiteTimeVo">
  37. <result property="id" column="id"/>
  38. <result property="applySiteId" column="apply_site_id"/>
  39. <result property="siteTime" column="site_time"/>
  40. <result property="examTime" column="exam_time"/>
  41. </resultMap>
  42. <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberQueryBo" resultMap="ExamNumberGoodsVoResult">
  43. SELECT
  44. goods_id,
  45. goods_name,
  46. CODE,
  47. stand_price,
  48. (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
  49. FROM
  50. goods g
  51. WHERE
  52. 1 = 1
  53. and g.status in(1)
  54. <if test="businessId != null and businessId != ''">
  55. and g.business_id = #{businessId}
  56. </if>
  57. <if test="goodsId != null and goodsId != ''">
  58. and g.goods_id = #{goodsId}
  59. </if>
  60. <if test="projectId != null and projectId != ''">
  61. and g.project_id = #{projectId}
  62. </if>
  63. <if test="goodsType != null and goodsType != ''">
  64. and g.goods_type = #{goodsType}
  65. </if>
  66. </select>
  67. <select id="countGoods" parameterType="long" resultType="long">
  68. SELECT
  69. eag.goods_id
  70. FROM
  71. exam_apply ea
  72. LEFT JOIN exam_apply_goods eag ON ea.apply_id = eag.apply_id where ea.apply_id =#{applyId}
  73. 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
  74. </select>
  75. <select id="examNumberGoodsVos" parameterType="long" resultMap="ExamNumberGoodsVoResult">
  76. SELECT
  77. g.goods_id,
  78. g.goods_name,
  79. g.CODE,
  80. g.stand_price
  81. FROM
  82. goods g
  83. LEFT JOIN exam_apply_goods eag ON g.goods_id = eag.goods_id
  84. WHERE
  85. 1 = 1
  86. AND g.STATUS IN ( 1 )
  87. AND eag.apply_id =#{applyId}
  88. </select>
  89. <select id="addressExam" parameterType="map" resultMap="ExamApplySiteVo">
  90. SELECT
  91. *,
  92. es.site_address,
  93. es.people
  94. FROM
  95. exam_apply_site eas
  96. LEFT JOIN exam_site es on eas.site_id = es.site_id
  97. WHERE
  98. eas.apply_id =#{applyId}
  99. and eas.`status` =#{status}
  100. </select>
  101. <select id="addressTimeExam" parameterType="map" resultMap="ExamApplySiteTimeVo">
  102. SELECT
  103. *
  104. FROM
  105. exam_apply_site_time east
  106. where 1=1
  107. and east.apply_site_id =#{id}
  108. </select>
  109. </mapper>