UserProfileMapper.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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.base.mapper.UserProfileMapper">
  6. <resultMap type="com.zhongzheng.modules.base.domain.UserProfile" id="UserProfileResult">
  7. <result property="id" column="id"/>
  8. <result property="userId" column="user_id"/>
  9. <result property="goodsId" column="goods_id"/>
  10. <result property="status" column="status"/>
  11. <result property="createTime" column="create_time"/>
  12. <result property="updateTime" column="update_time"/>
  13. <result property="oneTime" column="one_time"/>
  14. <result property="lastTime" column="last_time"/>
  15. <result property="keyValue" column="key_value"/>
  16. <result property="createByName" column="create_by_name"/>
  17. <result property="currentStatus" column="current_status"/>
  18. <result property="changeStatus" column="change_status"/>
  19. <result property="text" column="text"/>
  20. <result property="auditTime" column="audit_time"/>
  21. </resultMap>
  22. <resultMap type="com.zhongzheng.modules.base.vo.UserProfileVo" id="UserProfileVo">
  23. <result property="id" column="id"/>
  24. <result property="userId" column="user_id"/>
  25. <result property="goodsId" column="goods_id"/>
  26. <result property="status" column="status"/>
  27. <result property="oneTime" column="one_time"/>
  28. <result property="lastTime" column="last_time"/>
  29. <result property="keyValue" column="key_value"/>
  30. <result property="currentStatus" column="current_status"/>
  31. <result property="changeStatus" column="change_status"/>
  32. <result property="realname" column="realname"/>
  33. <result property="userAccount" column="user_account"/>
  34. <result property="telphone" column="telphone"/>
  35. <result property="idCard" column="id_card"/>
  36. <result property="goodsName" column="goods_name"/>
  37. <result property="goodsCode" column="goods_code"/>
  38. <result property="educationName" column="education_name"/>
  39. <result property="projectName" column="project_name"/>
  40. <result property="businessName" column="business_name"/>
  41. <result property="text" column="text"/>
  42. <result property="auditTime" column="audit_time"/>
  43. </resultMap>
  44. <select id="selectUserProfile" parameterType="com.zhongzheng.modules.base.bo.UserProfileQueryBo" resultMap="UserProfileVo">
  45. SELECT
  46. up.*,
  47. (SELECT u.realname FROM `user` u where u.user_id = up.user_id) as realname,
  48. (SELECT u.user_account FROM `user` u where u.user_id = up.user_id) as user_account,
  49. (SELECT u.telphone FROM `user` u where u.user_id = up.user_id) as telphone,
  50. (SELECT u.id_card FROM `user` u where u.user_id = up.user_id) as id_card,
  51. (SELECT g.goods_name FROM goods g where up.goods_id = g.goods_id) as goods_name,
  52. (SELECT g.`code` FROM goods g where up.goods_id = g.goods_id) as goods_code,
  53. (SELECT cet.education_name FROM goods g LEFT JOIN course_education_type cet on g.education_type_id = cet.id where up.goods_id = g.goods_id) as education_name,
  54. (SELECT cet.project_name FROM goods g LEFT JOIN course_project_type cet on g.project_id = cet.id where up.goods_id = g.goods_id) as project_name,
  55. (SELECT cet.business_name FROM goods g LEFT JOIN course_business cet on g.business_id = cet.id where up.goods_id = g.goods_id) as business_name
  56. FROM
  57. user_profile up
  58. where 1=1
  59. and up.current_status = 1
  60. <if test="status != null and status.size()!=0 ">
  61. AND up.status in
  62. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  63. #{item}
  64. </foreach>
  65. </if>
  66. <if test="id != null and id !='' ">
  67. AND up.id =#{id}
  68. </if>
  69. <if test="typeStatus != null and typeStatus !='' ">
  70. and up.type_status = #{typeStatus}
  71. </if>
  72. <if test="userId != null and userId !='' ">
  73. AND up.user_id =#{userId}
  74. </if>
  75. <if test="goodsId != null and goodsId !='' ">
  76. AND up.goods_id =#{goodsId}
  77. </if>
  78. <if test="educationTypeId != null and educationTypeId !='' ">
  79. AND g.education_type_id =#{educationTypeId}
  80. </if>
  81. <if test="businessId != null and businessId !='' ">
  82. AND g.business_id =#{businessId}
  83. </if>
  84. <if test="schoolId != null and schoolId !='' ">
  85. AND g.school_id =#{schoolId}
  86. </if>
  87. <if test="majorId != null and majorId !='' ">
  88. AND g.major_id =#{majorId}
  89. </if>
  90. <if test="changeStatus != null and changeStatus !='' ">
  91. AND up.change_status =#{changeStatus}
  92. </if>
  93. <if test="realname != null and realname !='' ">
  94. AND (SELECT count(1) FROM `user` u where u.user_id = up.user_id and u.realname like concat('%', #{realname}, '%') )> 0
  95. </if>
  96. order by up.create_time desc
  97. </select>
  98. <select id="getInfo" parameterType="com.zhongzheng.modules.base.bo.UserProfileQueryBo" resultMap="UserProfileVo">
  99. SELECT
  100. up.*,
  101. (SELECT u.realname FROM `user` u where u.user_id = up.user_id) as realname,
  102. (SELECT u.user_account FROM `user` u where u.user_id = up.user_id) as user_account,
  103. (SELECT u.telphone FROM `user` u where u.user_id = up.user_id) as telphone,
  104. (SELECT u.id_card FROM `user` u where u.user_id = up.user_id) as id_card,
  105. (SELECT g.goods_name FROM goods g where up.goods_id = g.goods_id) as goods_name,
  106. (SELECT g.`code` FROM goods g where up.goods_id = g.goods_id) as goods_code,
  107. (SELECT cet.education_name FROM goods g LEFT JOIN course_education_type cet on g.education_type_id = cet.id where up.goods_id = g.goods_id) as education_name,
  108. (SELECT cet.project_name FROM goods g LEFT JOIN course_project_type cet on g.project_id = cet.id where up.goods_id = g.goods_id) as project_name,
  109. (SELECT cet.business_name FROM goods g LEFT JOIN course_business cet on g.business_id = cet.id where up.goods_id = g.goods_id) as business_name
  110. FROM
  111. user_profile up
  112. where 1=1
  113. and up.current_status = 1
  114. and up.type_status = 1
  115. <if test="status != null and status.size()!=0 ">
  116. AND up.status in
  117. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  118. #{item}
  119. </foreach>
  120. </if>
  121. <if test="id != null and id !='' ">
  122. AND up.id =#{id}
  123. </if>
  124. <if test="userId != null and userId !='' ">
  125. AND up.user_id =#{userId}
  126. </if>
  127. <if test="goodsId != null and goodsId !='' ">
  128. AND up.goods_id =#{goodsId}
  129. </if>
  130. order by up.create_time desc LIMIT 1
  131. </select>
  132. <select id="listRecord" parameterType="com.zhongzheng.modules.base.bo.UserProfileQueryBo" resultMap="UserProfileVo">
  133. SELECT
  134. up.*,
  135. (SELECT u.realname FROM `user` u where u.user_id = up.user_id) as realname,
  136. (SELECT u.user_account FROM `user` u where u.user_id = up.user_id) as user_account,
  137. (SELECT u.telphone FROM `user` u where u.user_id = up.user_id) as telphone,
  138. (SELECT u.id_card FROM `user` u where u.user_id = up.user_id) as id_card,
  139. (SELECT g.goods_name FROM goods g where up.goods_id = g.goods_id) as goods_name,
  140. (SELECT g.`code` FROM goods g where up.goods_id = g.goods_id) as goods_code,
  141. (SELECT cet.education_name FROM goods g LEFT JOIN course_education_type cet on g.education_type_id = cet.id where up.goods_id = g.goods_id) as education_name,
  142. (SELECT cet.project_name FROM goods g LEFT JOIN course_project_type cet on g.project_id = cet.id where up.goods_id = g.goods_id) as project_name,
  143. (SELECT cet.business_name FROM goods g LEFT JOIN course_business cet on g.business_id = cet.id where up.goods_id = g.goods_id) as business_name
  144. FROM
  145. user_profile up
  146. where 1=1
  147. and up.type_status = 1
  148. <if test="status != null and status.size()!=0 ">
  149. AND up.status in
  150. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  151. #{item}
  152. </foreach>
  153. </if>
  154. <if test="id != null and id !='' ">
  155. AND up.id =#{id}
  156. </if>
  157. <if test="userId != null and userId !='' ">
  158. AND up.user_id =#{userId}
  159. </if>
  160. <if test="goodsId != null and goodsId !='' ">
  161. AND up.goods_id =#{goodsId}
  162. </if>
  163. <if test="educationTypeId != null and educationTypeId !='' ">
  164. AND g.education_type_id =#{educationTypeId}
  165. </if>
  166. <if test="businessId != null and businessId !='' ">
  167. AND g.business_id =#{businessId}
  168. </if>
  169. <if test="schoolId != null and schoolId !='' ">
  170. AND g.school_id =#{schoolId}
  171. </if>
  172. <if test="majorId != null and majorId !='' ">
  173. AND g.major_id =#{majorId}
  174. </if>
  175. <if test="changeStatus != null and changeStatus !='' ">
  176. AND up.change_status =#{changeStatus}
  177. </if>
  178. order by up.create_time desc
  179. </select>
  180. </mapper>