ClubTemporaryMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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.caimei.modules.user.dao.ClubTemporaryDao">
  4. <sql id="clubTemporaryColumns">
  5. a.id AS "id",
  6. a.userId AS "userId",
  7. a.confirmUserId AS "confirmUserId",
  8. a.name AS "name",
  9. a.shortName AS "shortName",
  10. a.bindMobile AS "bindMobile",
  11. a.contractEmail AS "contractEmail",
  12. a.linkMan AS "linkMan",
  13. a.linkManIdentity AS "linkManIdentity",
  14. a.provinceId AS "provinceId",
  15. a.cityId AS "cityId",
  16. a.townId AS "townId",
  17. a.address AS "address",
  18. a.shopPhoto AS "shopPhoto",
  19. a.businessLicense AS "businessLicense",
  20. a.socialCreditCode AS "socialCreditCode",
  21. a.firstClubType AS "firstClubType",
  22. a.secondClubType AS "secondClubType",
  23. a.department AS "department",
  24. a.medicalPracticeLicense AS "medicalPracticeLicense",
  25. a.mainProduct AS "mainProduct",
  26. a.isAgreed AS "isAgreed",
  27. a.addTime AS "addTime",
  28. IFNULL(s.name,s.linkMan) AS "spName",
  29. if(csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime,1,0) as svipUserFlag
  30. </sql>
  31. <sql id="clubTemporaryJoins">
  32. LEFT JOIN serviceprovider s ON s.userID = a.userId
  33. LEFT JOIN cm_svip_user csu ON csu.userId = a.userId
  34. </sql>
  35. <select id="get" resultType="ClubTemporary">
  36. SELECT
  37. <include refid="clubTemporaryColumns"/>,
  38. d.name AS "province",
  39. c.name AS "city",
  40. b.name AS "town"
  41. FROM club_temporary a
  42. <include refid="clubTemporaryJoins"/>
  43. LEFT JOIN town b ON b.townID=a.townID
  44. LEFT JOIN city c ON c.cityID=b.cityID
  45. LEFT JOIN province d ON d.provinceID=c.provinceID
  46. WHERE a.id = #{id}
  47. </select>
  48. <select id="findList" resultType="ClubTemporary">
  49. SELECT
  50. <include refid="clubTemporaryColumns"/>
  51. FROM club_temporary a
  52. <include refid="clubTemporaryJoins"/>
  53. <where>
  54. <if test="name != null and name != ''">
  55. AND a.name LIKE
  56. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  57. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  58. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  59. </if>
  60. <if test="bindMobile != null and bindMobile != ''">
  61. AND a.bindMobile LIKE
  62. <if test="dbName == 'oracle'">'%'||#{bindMobile}||'%'</if>
  63. <if test="dbName == 'mssql'">'%'+#{bindMobile}+'%'</if>
  64. <if test="dbName == 'mysql'">concat('%',#{bindMobile},'%')</if>
  65. </if>
  66. <if test="contractEmail != null and contractEmail != ''">
  67. AND a.contractEmail LIKE
  68. <if test="dbName == 'oracle'">'%'||#{contractEmail}||'%'</if>
  69. <if test="dbName == 'mssql'">'%'+#{contractEmail}+'%'</if>
  70. <if test="dbName == 'mysql'">concat('%',#{contractEmail},'%')</if>
  71. </if>
  72. <if test="linkMan != null and linkMan != ''">
  73. AND a.linkMan LIKE
  74. <if test="dbName == 'oracle'">'%'||#{linkMan}||'%'</if>
  75. <if test="dbName == 'mssql'">'%'+#{linkMan}+'%'</if>
  76. <if test="dbName == 'mysql'">concat('%',#{linkMan},'%')</if>
  77. </if>
  78. <if test="startTime != null and startTime != ''">
  79. AND a.addTime <![CDATA[ > ]]> #{startTime}
  80. </if>
  81. <if test="endTime != null and endTime != ''">
  82. AND a.addTime <![CDATA[ < ]]> #{endTime}
  83. </if>
  84. </where>
  85. <choose>
  86. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  87. ORDER BY ${page.orderBy}
  88. </when>
  89. <otherwise>
  90. ORDER BY a.addTime DESC
  91. </otherwise>
  92. </choose>
  93. </select>
  94. <select id="findAllList" resultType="ClubTemporary">
  95. SELECT
  96. <include refid="clubTemporaryColumns"/>
  97. FROM club_temporary a
  98. <include refid="clubTemporaryJoins"/>
  99. <where>
  100. </where>
  101. <choose>
  102. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  103. ORDER BY ${page.orderBy}
  104. </when>
  105. <otherwise>
  106. </otherwise>
  107. </choose>
  108. </select>
  109. <insert id="insert" parameterType="ClubTemporary" keyProperty="id" useGeneratedKeys="true">
  110. INSERT INTO club_temporary(
  111. id,
  112. userId,
  113. name,
  114. shortName,
  115. bindMobile,
  116. contractEmail,
  117. linkMan,
  118. linkManIdentity,
  119. provinceId,
  120. cityId,
  121. townId,
  122. address,
  123. shopPhoto,
  124. businessLicense,
  125. socialCreditCode,
  126. firstClubType,
  127. secondClubType,
  128. department,
  129. medicalPracticeLicense,
  130. mainProduct,
  131. isAgreed,
  132. addTime
  133. ) VALUES (
  134. #{id},
  135. #{userId},
  136. #{name},
  137. #{shortName},
  138. #{bindMobile},
  139. #{contractEmail},
  140. #{linkMan},
  141. #{linkManIdentity},
  142. #{provinceId},
  143. #{cityId},
  144. #{townId},
  145. #{address},
  146. #{shopPhoto},
  147. #{businessLicense},
  148. #{socialCreditCode},
  149. #{firstClubType},
  150. #{secondClubType},
  151. #{department},
  152. #{medicalPracticeLicense},
  153. #{mainProduct},
  154. #{isAgreed},
  155. #{addTime}
  156. )
  157. </insert>
  158. <update id="update">
  159. UPDATE club_temporary SET
  160. userId = #{userId},
  161. confirmUserId = #{confirmUserId},
  162. name = #{name},
  163. shortName = #{shortName},
  164. bindMobile = #{bindMobile},
  165. contractEmail = #{contractEmail},
  166. linkMan = #{linkMan},
  167. linkManIdentity = #{linkManIdentity},
  168. provinceId = #{provinceId},
  169. cityId = #{cityId},
  170. townId = #{townId},
  171. address = #{address},
  172. shopPhoto = #{shopPhoto},
  173. businessLicense = #{businessLicense},
  174. socialCreditCode = #{socialCreditCode},
  175. firstClubType = #{firstClubType},
  176. secondClubType = #{secondClubType},
  177. department = #{department},
  178. medicalPracticeLicense = #{medicalPracticeLicense},
  179. mainProduct = #{mainProduct},
  180. isAgreed = #{isAgreed},
  181. addTime = #{addTime}
  182. WHERE id = #{id}
  183. </update>
  184. <delete id="delete">
  185. DELETE FROM club_temporary
  186. WHERE id = #{id}
  187. </delete>
  188. <insert id="insertClubConfirmRecord">
  189. INSERT INTO `club_confirm_record` (
  190. `userId`,
  191. `systemUserId`,
  192. `images`,
  193. `remarks`,
  194. `confirmTime`
  195. )
  196. VALUES
  197. (
  198. #{userId},
  199. #{systemUserId},
  200. #{images},
  201. #{remarks},
  202. #{confirmTime}
  203. )
  204. </insert>
  205. <select id="findConfirmRecord" resultType="com.caimei.modules.user.entity.ClubConfirmRecord">
  206. SELECT
  207. `id`,
  208. `userId`,
  209. `systemUserId`,
  210. `images`,
  211. `remarks`,
  212. `confirmTime`
  213. FROM
  214. `club_confirm_record`
  215. WHERE
  216. userId = #{userId}
  217. ORDER BY
  218. confirmTime DESC
  219. </select>
  220. <select id="findByConfirmUserId" resultType="com.caimei.modules.user.entity.ClubTemporary">
  221. SELECT
  222. <include refid="clubTemporaryColumns"/>
  223. FROM club_temporary a
  224. <include refid="clubTemporaryJoins"/>
  225. WHERE a.confirmUserId = #{userId}
  226. </select>
  227. </mapper>