ExamApplyMapper.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberQueryBo" resultMap="ExamNumberGoodsVoResult">
  28. SELECT
  29. goods_id,
  30. goods_name,
  31. CODE,
  32. stand_price,
  33. (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
  34. FROM
  35. goods g
  36. WHERE
  37. 1 = 1
  38. and g.status in(1)
  39. <if test="businessId != null and businessId != ''">
  40. and g.business_id = #{businessId}
  41. </if>
  42. <if test="goodsId != null and goodsId != ''">
  43. and g.goods_id = #{goodsId}
  44. </if>
  45. <if test="projectId != null and projectId != ''">
  46. and g.project_id = #{projectId}
  47. </if>
  48. <if test="goodsType != null and goodsType != ''">
  49. and g.goods_type = #{goodsType}
  50. </if>
  51. </select>
  52. <select id="countGoods" parameterType="long" resultType="long">
  53. SELECT
  54. eag.goods_id
  55. FROM
  56. exam_apply ea
  57. LEFT JOIN exam_apply_goods eag ON ea.apply_id = eag.apply_id where ea.apply_id =#{applyId}
  58. 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
  59. </select>
  60. <select id="examNumberGoodsVos" parameterType="long" resultMap="ExamNumberGoodsVoResult">
  61. SELECT
  62. g.goods_id,
  63. g.goods_name,
  64. g.CODE,
  65. g.stand_price
  66. FROM
  67. goods g
  68. LEFT JOIN exam_apply_goods eag ON g.goods_id = eag.goods_id
  69. WHERE
  70. 1 = 1
  71. AND g.STATUS IN ( 1 )
  72. AND eag.apply_id =#{applyId}
  73. </select>
  74. </mapper>