UserProfileMapper.xml 9.6 KB

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