UserSubscribeMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.user.mapper.UserSubscribeMapper">
  6. <resultMap type="com.zhongzheng.modules.user.domain.UserSubscribe" id="UserSubscribeResult">
  7. <result property="subscribeId" column="subscribe_id"/>
  8. <result property="goodsId" column="goods_id"/>
  9. <result property="userId" column="user_id"/>
  10. <result property="subscribeStatus" column="subscribe_status"/>
  11. <result property="beforeStatus" column="before_status"/>
  12. <result property="examStatus" column="exam_status"/>
  13. <result property="performance" column="performance"/>
  14. <result property="result" column="result"/>
  15. <result property="certificateCode" column="certificate_code"/>
  16. <result property="applyId" column="apply_id"/>
  17. <result property="studentType" column="student_type"/>
  18. <result property="examExpend" column="exam_expend"/>
  19. <result property="beforeExpend" column="before_expend"/>
  20. <result property="createTime" column="create_time"/>
  21. <result property="updateTime" column="update_time"/>
  22. </resultMap>
  23. <resultMap type="com.zhongzheng.modules.user.vo.UserSubscribeVo" id="UserSubscribeVo">
  24. <result property="subscribeId" column="subscribe_id"/>
  25. <result property="goodsId" column="goods_id"/>
  26. <result property="userId" column="user_id"/>
  27. <result property="subscribeStatus" column="subscribe_status"/>
  28. <result property="beforeStatus" column="before_status"/>
  29. <result property="examStatus" column="exam_status"/>
  30. <result property="performance" column="performance"/>
  31. <result property="result" column="result"/>
  32. <result property="certificateCode" column="certificate_code"/>
  33. <result property="applyId" column="apply_id"/>
  34. <result property="studentType" column="student_type"/>
  35. <result property="examExpend" column="exam_expend"/>
  36. <result property="beforeExpend" column="before_expend"/>
  37. <result property="createTime" column="create_time"/>
  38. <result property="goodsName" column="goods_name"/>
  39. <result property="categoryName" column="category_name"/>
  40. <result property="goodsCode" column="goods_code"/>
  41. <result property="remark" column="remark"/>
  42. <result property="standPrice" column="stand_price"/>
  43. <result property="realname" column="realname"/>
  44. <result property="idCard" column="id_card"/>
  45. <result property="applyName" column="apply_name"/>
  46. <result property="beforeId" column="before_id"/>
  47. <result property="beforeName" column="before_name"/>
  48. <result property="applySiteAddress" column="apply_site_address"/>
  49. <result property="applySiteStartTime" column="apply_site_start_time"/>
  50. <result property="applySiteEndTime" column="apply_site_end_time"/>
  51. <result property="applySiteExamTime" column="apply_site_exam_time"/>
  52. <result property="applySiteAddressTrain" column="apply_site_address_train"/>
  53. <result property="applySiteStartTrainTime" column="apply_site_start_train_time"/>
  54. <result property="applySiteEndTrainTime" column="apply_site_end_train_time"/>
  55. <result property="applySiteExamTrainTime" column="apply_site_exam_train_time"/>
  56. <result property="applyStartTime" column="apply_start_time"/>
  57. <result property="applyEndTime" column="apply_end_time"/>
  58. </resultMap>
  59. <select id="listSubscribe" parameterType="com.zhongzheng.modules.user.bo.UserSubscribeQueryBo" resultMap="UserSubscribeVo">
  60. SELECT
  61. *,
  62. (SELECT g.goods_name FROM goods g where us.goods_id = g.goods_id) as goods_name,
  63. (SELECT g.code FROM goods g where us.goods_id = g.goods_id) as goods_code,
  64. (SELECT g.stand_price FROM goods g where us.goods_id = g.goods_id) as stand_price,
  65. (SELECT m.category_name FROM goods g LEFT JOIN major m on g.major_id= m.id where us.goods_id = g.goods_id) as category_name,
  66. (SELECT u.realname FROM `user` u where us.user_id = u.user_id) as realname,
  67. (SELECT u.id_card FROM `user` u where us.user_id = u.user_id) as id_card,
  68. (SELECT ea.apply_name FROM exam_apply ea where ea.apply_id = us.apply_id) as apply_name,
  69. (SELECT ea.apply_start_time FROM exam_apply ea where ea.apply_id = us.apply_id) as apply_start_time,
  70. (SELECT ea.applyEndTime FROM exam_apply ea where ea.apply_id = us.apply_id) as apply_end_time,
  71. (SELECT eb.before_name FROM exam_before eb where eb.before_id = us.before_id) as before_name
  72. FROM
  73. user_subscribe us
  74. WHERE
  75. 1 =1
  76. <if test="userId != null and userId != '' ">
  77. and us.user_id = #{userId}
  78. </if>
  79. <if test="goodsId != null and goodsId != '' ">
  80. and us.goods_id = #{goodsId}
  81. </if>
  82. <if test="subscribeId != null and subscribeId != '' ">
  83. and us.subscribe_id = #{subscribeId}
  84. </if>
  85. <if test="subscribeStatus != null and subscribeStatus != '' ">
  86. and us.subscribe_status = #{subscribeStatus}
  87. </if>
  88. <if test="applyId != null and applyId != '' ">
  89. and us.apply_id = #{applyId}
  90. </if>
  91. <if test="studentType != null and studentType != '' ">
  92. and us.student_type = #{studentType}
  93. </if>
  94. <if test="examStatus != null ">
  95. and us.exam_status = #{examStatus}
  96. </if>
  97. <if test="examExpend != null ">
  98. and us.exam_expend is NOT NULL
  99. </if>
  100. <if test="beforeExpend != null ">
  101. and us.before_expend is NOT NULL
  102. </if>
  103. <if test="majorId != null and majorId != '' ">
  104. and (SELECT m.id FROM goods g LEFT JOIN major m on g.major_id= m.id where us.goods_id = g.goods_id) = #{majorId}
  105. </if>
  106. <if test="realname != null and realname != '' ">
  107. and (SELECT u.realname FROM `user` u where us.user_id = u.user_id) like concat('%', #{realname}, '%')
  108. </if>
  109. </select>
  110. </mapper>