LectureUserMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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.LectureUserMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.LectureUser" >
  5. <id column="lid" property="lid" 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. lid, uid, create_time, last_update_time
  12. </sql>
  13. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="com.goafanti.common.model.LectureUserKey" >
  14. select
  15. <include refid="Base_Column_List" />
  16. from lecture_user
  17. where lid = #{lid,jdbcType=BIGINT}
  18. and uid = #{uid,jdbcType=VARCHAR}
  19. </select>
  20. <delete id="deleteByPrimaryKey" parameterType="com.goafanti.common.model.LectureUserKey" >
  21. delete from lecture_user
  22. where lid = #{lid,jdbcType=BIGINT}
  23. and uid = #{uid,jdbcType=VARCHAR}
  24. </delete>
  25. <insert id="insert" parameterType="com.goafanti.common.model.LectureUser" >
  26. insert into lecture_user (lid, uid, create_time,
  27. last_update_time)
  28. values (#{lid,jdbcType=BIGINT}, #{uid,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  29. #{lastUpdateTime,jdbcType=TIMESTAMP})
  30. </insert>
  31. <insert id="insertSelective" parameterType="com.goafanti.common.model.LectureUser" >
  32. insert into lecture_user
  33. <trim prefix="(" suffix=")" suffixOverrides="," >
  34. <if test="lid != null" >
  35. lid,
  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="lid != null" >
  49. #{lid,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.LectureUser" >
  63. update lecture_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 lid = #{lid,jdbcType=BIGINT}
  73. and uid = #{uid,jdbcType=VARCHAR}
  74. </update>
  75. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.LectureUser" >
  76. update lecture_user
  77. set create_time = #{createTime,jdbcType=TIMESTAMP},
  78. last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}
  79. where lid = #{lid,jdbcType=BIGINT}
  80. and uid = #{uid,jdbcType=VARCHAR}
  81. </update>
  82. <delete id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  83. delete
  84. from lecture_user
  85. where id in
  86. <foreach item="item" index="index" collection="list" open="("
  87. separator="," close=")">
  88. #{item}
  89. </foreach>
  90. </delete>
  91. <select id="findLectureUserListByPage" parameterType="String" resultType="com.goafanti.LectureUser.bo.LectureUserListBo">
  92. select
  93. lu.lid,
  94. lu.uid,
  95. lu.create_time as createTime,
  96. lu.last_update_time as lastUpdateTime,
  97. l.name as lectureName,
  98. u.number,
  99. u.mobile,
  100. ui.username,
  101. l.lecture_time as lectureTime,
  102. l.end_time as endTime
  103. from lecture_user lu
  104. left join user u on u.id = lu.uid
  105. left join user_identity ui on ui.uid = lu.uid
  106. left join lecture l on l.id = lu.lid
  107. where u.type = 0
  108. <if test="mobile != null">
  109. and u.mobile = #{mobile,jdbcType=VARCHAR}
  110. </if>
  111. <if test="number != null">
  112. and u.number = #{number,jdbcType=INTEGER}
  113. </if>
  114. <if test="lectureName != null">
  115. and l.name like CONCAT('%',#{lectureName,jdbcType=VARCHAR},'%')
  116. </if>
  117. <if test="username != null">
  118. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  119. </if>
  120. order by lu.last_update_time desc
  121. <if test="page_sql!=null">
  122. ${page_sql}
  123. </if>
  124. </select>
  125. <select id="findLectureUserCount" parameterType="String" resultType="java.lang.Integer">
  126. select
  127. count(1)
  128. from lecture_user lu
  129. left join user u on u.id = lu.uid
  130. left join user_identity ui on ui.uid = lu.uid
  131. left join lecture l on l.id = lu.lid
  132. where u.type = 0
  133. <if test="mobile != null">
  134. and u.mobile = #{mobile,jdbcType=VARCHAR}
  135. </if>
  136. <if test="number != null">
  137. and u.number = #{number,jdbcType=INTEGER}
  138. </if>
  139. <if test="lectureName != null">
  140. and l.name like CONCAT('%',#{lectureName,jdbcType=VARCHAR},'%')
  141. </if>
  142. <if test="username != null">
  143. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  144. </if>
  145. </select>
  146. <select id="findLectureOrgListByPage" parameterType="String" resultType="com.goafanti.LectureUser.bo.LectureUserListBo">
  147. select
  148. lu.lid,
  149. lu.uid,
  150. lu.create_time as createTime,
  151. lu.last_update_time as lastUpdateTime,
  152. l.name as lectureName,
  153. u.number,
  154. u.mobile,
  155. oi.unit_name as unitName,
  156. l.lecture_time as lectureTime,
  157. l.end_time as endTime
  158. from lecture_user lu
  159. left join user u on u.id = lu.uid
  160. left join organization_identity oi on oi.uid = lu.uid
  161. left join lecture l on l.id = lu.lid
  162. where u.type = 1
  163. <if test="mobile != null">
  164. and u.mobile = #{mobile,jdbcType=VARCHAR}
  165. </if>
  166. <if test="number != null">
  167. and u.number = #{number,jdbcType=INTEGER}
  168. </if>
  169. <if test="lectureName != null">
  170. and l.name like CONCAT('%',#{lectureName,jdbcType=VARCHAR},'%')
  171. </if>
  172. <if test="unitName != null">
  173. and oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  174. </if>
  175. order by lu.last_update_time desc
  176. <if test="page_sql!=null">
  177. ${page_sql}
  178. </if>
  179. </select>
  180. <select id="findLectureOrgCount" parameterType="String" resultType="java.lang.Integer">
  181. select
  182. count(1)
  183. from lecture_user lu
  184. left join user u on u.id = lu.uid
  185. left join organization_identity oi on oi.uid = lu.uid
  186. left join lecture l on l.id = lu.lid
  187. where u.type = 1
  188. <if test="mobile != null">
  189. and u.mobile = #{mobile,jdbcType=VARCHAR}
  190. </if>
  191. <if test="number != null">
  192. and u.number = #{number,jdbcType=INTEGER}
  193. </if>
  194. <if test="activityName != null">
  195. and l.name like CONCAT('%',#{lectureName,jdbcType=VARCHAR},'%')
  196. </if>
  197. <if test="unitName != null">
  198. and oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  199. </if>
  200. </select>
  201. </mapper>