ActivityUserMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.goafanti.common.dao.ActivityUserMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.ActivityUser" >
  5. <id column="aid" property="aid" jdbcType="BIGINT" />
  6. <id column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  8. <result column="last_update_time" property="lastUpdateTime" jdbcType="TIMESTAMP" />
  9. </resultMap>
  10. <sql id="Base_Column_List" >
  11. aid, uid, create_time, last_update_time
  12. </sql>
  13. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="com.goafanti.common.model.ActivityUserKey" >
  14. select
  15. <include refid="Base_Column_List" />
  16. from activity_user
  17. where aid = #{aid,jdbcType=BIGINT}
  18. and uid = #{uid,jdbcType=VARCHAR}
  19. </select>
  20. <delete id="deleteByPrimaryKey" parameterType="com.goafanti.common.model.ActivityUserKey" >
  21. delete from activity_user
  22. where aid = #{aid,jdbcType=BIGINT}
  23. and uid = #{uid,jdbcType=VARCHAR}
  24. </delete>
  25. <insert id="insert" parameterType="com.goafanti.common.model.ActivityUser" >
  26. insert into activity_user (aid, uid, create_time,
  27. last_update_time)
  28. values (#{aid,jdbcType=BIGINT}, #{uid,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  29. #{lastUpdateTime,jdbcType=TIMESTAMP})
  30. </insert>
  31. <insert id="insertSelective" parameterType="com.goafanti.common.model.ActivityUser" >
  32. insert into activity_user
  33. <trim prefix="(" suffix=")" suffixOverrides="," >
  34. <if test="aid != null" >
  35. aid,
  36. </if>
  37. <if test="uid != null" >
  38. uid,
  39. </if>
  40. <if test="createTime != null" >
  41. create_time,
  42. </if>
  43. <if test="lastUpdateTime != null" >
  44. last_update_time,
  45. </if>
  46. </trim>
  47. <trim prefix="values (" suffix=")" suffixOverrides="," >
  48. <if test="aid != null" >
  49. #{aid,jdbcType=BIGINT},
  50. </if>
  51. <if test="uid != null" >
  52. #{uid,jdbcType=VARCHAR},
  53. </if>
  54. <if test="createTime != null" >
  55. #{createTime,jdbcType=TIMESTAMP},
  56. </if>
  57. <if test="lastUpdateTime != null" >
  58. #{lastUpdateTime,jdbcType=TIMESTAMP},
  59. </if>
  60. </trim>
  61. </insert>
  62. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ActivityUser" >
  63. update activity_user
  64. <set >
  65. <if test="createTime != null" >
  66. create_time = #{createTime,jdbcType=TIMESTAMP},
  67. </if>
  68. <if test="lastUpdateTime != null" >
  69. last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
  70. </if>
  71. </set>
  72. where aid = #{aid,jdbcType=BIGINT}
  73. and uid = #{uid,jdbcType=VARCHAR}
  74. </update>
  75. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ActivityUser" >
  76. update activity_user
  77. set create_time = #{createTime,jdbcType=TIMESTAMP},
  78. last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}
  79. where aid = #{aid,jdbcType=BIGINT}
  80. and uid = #{uid,jdbcType=VARCHAR}
  81. </update>
  82. <select id="selectByUid" resultMap="BaseResultMap" parameterType="java.lang.String" >
  83. select
  84. <include refid="Base_Column_List" />
  85. from activity_user
  86. where uid = #{uid,jdbcType=VARCHAR}
  87. </select>
  88. <select id="findActivityUserListByPage" parameterType="String" resultType="com.goafanti.activityUser.bo.ActivityUserListBo">
  89. select
  90. au.aid,
  91. au.uid,
  92. au.create_time as createTime,
  93. au.last_update_time as lastUpdateTime,
  94. a.name as activityName,
  95. u.number,
  96. u.mobile,
  97. ui.username,
  98. a.start_time as startTime,
  99. a.end_time as endTime,
  100. a.enroll_deadline as enrollDeadline
  101. from activity_user au
  102. left join user u on u.id = au.uid
  103. left join user_identity ui on ui.uid = au.uid
  104. left join activity a on a.id = au.aid
  105. where u.type = 0
  106. <if test="mobile != null">
  107. and u.mobile = #{mobile,jdbcType=VARCHAR}
  108. </if>
  109. <if test="number != null">
  110. and u.number = #{number,jdbcType=INTEGER}
  111. </if>
  112. <if test="activityName != null">
  113. and a.name like CONCAT('%',#{activityName,jdbcType=VARCHAR},'%')
  114. </if>
  115. <if test="username != null">
  116. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  117. </if>
  118. order by au.last_update_time desc
  119. <if test="page_sql!=null">
  120. ${page_sql}
  121. </if>
  122. </select>
  123. <select id="findActivityUserCount" parameterType="String" resultType="java.lang.Integer">
  124. select
  125. count(1)
  126. from activity_user au
  127. left join user u on u.id = au.uid
  128. left join user_identity ui on ui.uid = au.uid
  129. left join activity a on a.id = au.aid
  130. where u.type = 0
  131. <if test="mobile != null">
  132. and u.mobile = #{mobile,jdbcType=VARCHAR}
  133. </if>
  134. <if test="number != null">
  135. and u.number = #{number,jdbcType=INTEGER}
  136. </if>
  137. <if test="activityName != null">
  138. and a.name like CONCAT('%',#{activityName,jdbcType=VARCHAR},'%')
  139. </if>
  140. <if test="username != null">
  141. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  142. </if>
  143. </select>
  144. <select id="findActivityOrgListByPage" parameterType="String" resultType="com.goafanti.activityUser.bo.ActivityUserListBo">
  145. select
  146. au.aid,
  147. au.uid,
  148. au.create_time as createTime,
  149. au.last_update_time as lastUpdateTime,
  150. a.name as activityName,
  151. u.number,
  152. u.mobile,
  153. oi.unit_name as unitName,
  154. a.start_time as startTime,
  155. a.end_time as endTime,
  156. a.enroll_deadline as enrollDeadline
  157. from activity_user au
  158. left join user u on u.id = au.uid
  159. left join organization_identity oi on oi.uid = au.uid
  160. left join activity a on a.id = au.aid
  161. where u.type = 1
  162. <if test="mobile != null">
  163. and u.mobile = #{mobile,jdbcType=VARCHAR}
  164. </if>
  165. <if test="number != null">
  166. and u.number = #{number,jdbcType=INTEGER}
  167. </if>
  168. <if test="activityName != null">
  169. and a.name like CONCAT('%',#{activityName,jdbcType=VARCHAR},'%')
  170. </if>
  171. <if test="unitName != null">
  172. and ui.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  173. </if>
  174. order by au.last_update_time desc
  175. <if test="page_sql!=null">
  176. ${page_sql}
  177. </if>
  178. </select>
  179. <select id="findActivityOrgCount" parameterType="String" resultType="java.lang.Integer">
  180. select
  181. count(1)
  182. from activity_user au
  183. left join user u on u.id = au.uid
  184. left join organization_identity oi on oi.uid = au.uid
  185. left join activity a on a.id = au.aid
  186. where u.type = 1
  187. <if test="mobile != null">
  188. and u.mobile = #{mobile,jdbcType=VARCHAR}
  189. </if>
  190. <if test="number != null">
  191. and u.number = #{number,jdbcType=INTEGER}
  192. </if>
  193. <if test="activityName != null">
  194. and a.name like CONCAT('%',#{activityName,jdbcType=VARCHAR},'%')
  195. </if>
  196. <if test="unitName != null">
  197. and ui.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  198. </if>
  199. </select>
  200. </mapper>