InfoUserMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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.ruoyi.system.mapper.InfoUserMapper">
  6. <resultMap type="InfoUser" id="InfoUserResult">
  7. <result property="userId" column="user_id" />
  8. <result property="userName" column="user_name" />
  9. <result property="phone" column="phone" />
  10. <result property="nickName" column="nick_name" />
  11. <result property="userType" column="user_type" />
  12. <result property="email" column="email" />
  13. <result property="sex" column="sex" />
  14. <result property="avatar" column="avatar" />
  15. <result property="password" column="password" />
  16. <result property="status" column="status" />
  17. <result property="delFlag" column="del_flag" />
  18. <result property="cid" column="cid" />
  19. <result property="mycode" column="mycode" />
  20. <result property="thiscode" column="thiscode" />
  21. <result property="commission" column="commission" />
  22. <result property="annex" column="annex" />
  23. <result property="auditStatus" column="audit_status" />
  24. <result property="telPhone" column="tel_Phone" />
  25. <result property="shijStatus" column="shij_status" />
  26. <result property="driversLicense" column="drivers_license" />
  27. <result property="drivingLicense" column="driving_license" />
  28. <result property="vehiclePhotos" column="vehicle_photos" />
  29. <result property="licensePlate" column="license_plate" />
  30. <result property="fullName" column="full_name" />
  31. <result property="idNumber" column="id_number" />
  32. <result property="merchantType" column="merchant_type" />
  33. <result property="bankAccount" column="bank_account" />
  34. <result property="passportPhoto" column="passport_photo" />
  35. <result property="bankPhoto" column="bank_photo" />
  36. <result property="merchantIntroduction" column="merchant_introduction" />
  37. <result property="offline" column="offline" />
  38. </resultMap>
  39. <sql id="selectInfoUserVo">
  40. select * from info_user
  41. </sql>
  42. <select id="selectInfoUserList" parameterType="InfoUser" resultMap="InfoUserResult">
  43. <include refid="selectInfoUserVo"/>
  44. <where>
  45. <if test="userName != null and userName != ''"> and BINARY user_name like concat('%', #{userName}, '%') </if>
  46. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  47. <if test="nickName != null and nickName != ''"> and BINARY nick_name like concat('%', #{nickName}, '%')</if>
  48. <if test="userType != null and userType != ''"> and user_type = #{userType}</if>
  49. <if test="email != null and email != ''"> and email = #{email}</if>
  50. <if test="status != null and status != ''"> and status = #{status}</if>
  51. <if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
  52. <if test="mycode != null and mycode != ''"> and mycode = #{mycode}</if>
  53. <if test="thiscode != null and thiscode != ''"> and thiscode = #{thiscode}</if>
  54. <if test="commission != null and commission != ''"> and commission = #{commission}</if>
  55. <if test="annex != null and annex != ''"> and annex = #{annex}</if>
  56. <if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
  57. <if test="telPhone != null and telPhone != ''"> and tel_phone = #{telPhone}</if>
  58. <if test="shijStatus != null and shijStatus != ''"> and shij_status = #{shijStatus}</if>
  59. </where>
  60. order by user_id desc
  61. </select>
  62. <select id="selectInfoUserByUserId" parameterType="Long" resultMap="InfoUserResult">
  63. <include refid="selectInfoUserVo"/>
  64. where user_id = #{userId}
  65. </select>
  66. <insert id="insertInfoUser" parameterType="InfoUser" useGeneratedKeys="true" keyProperty="userId">
  67. insert into info_user
  68. <trim prefix="(" suffix=")" suffixOverrides=",">
  69. <if test="userName != null and userName != ''">user_name,</if>
  70. <if test="phone != null and phone != ''">phone,</if>
  71. <if test="nickName != null and nickName != ''">nick_name,</if>
  72. <if test="userType != null and userType != ''">user_type,</if>
  73. <if test="email != null">email,</if>
  74. <if test="sex != null">sex,</if>
  75. <if test="avatar != null and avatar != ''">avatar,</if>
  76. <if test="password != null">password,</if>
  77. <if test="status != null and status != ''">status,</if>
  78. <if test="delFlag != null">del_flag,</if>
  79. <if test="cid != null">cid,</if>
  80. <if test="mycode != null">mycode,</if>
  81. <if test="thiscode != null">thiscode,</if>
  82. <if test="commission != null">commission,</if>
  83. <if test="annex != null">annex,</if>
  84. <if test="auditStatus != null">audit_status,</if>
  85. <if test="telPhone != null">tel_phone,</if>
  86. <if test="shijStatus != null">shij_status,</if>
  87. <if test="driversLicense != null">drivers_license,</if>
  88. <if test="drivingLicense != null">driving_license,</if>
  89. <if test="vehiclePhotos != null">vehicle_photos,</if>
  90. <if test="passportPhoto != null">passport_photo,</if>
  91. <if test="bankPhoto != null">bank_photo,</if>
  92. <if test="merchantIntroduction != null">merchant_introduction,</if>
  93. <if test="offline != null">offline</if>
  94. </trim>
  95. <trim prefix="values (" suffix=")" suffixOverrides=",">
  96. <if test="userName != null and userName != ''">#{userName},</if>
  97. <if test="phone != null and phone != ''">#{phone},</if>
  98. <if test="nickName != null and nickName != ''">#{nickName},</if>
  99. <if test="userType != null and userType != ''">#{userType},</if>
  100. <if test="email != null">#{email},</if>
  101. <if test="sex != null">#{sex},</if>
  102. <if test="avatar != null and avatar != ''">#{avatar},</if>
  103. <if test="password != null">#{password},</if>
  104. <if test="status != null and status != ''">#{status},</if>
  105. <if test="delFlag != null">#{delFlag},</if>
  106. <if test="cid != null">#{cid},</if>
  107. <if test="mycode != null">#{mycode},</if>
  108. <if test="thiscode != null">#{thiscode},</if>
  109. <if test="commission != null">#{commission},</if>
  110. <if test="annex != null">#{annex},</if>
  111. <if test="auditStatus != null">#{auditStatus},</if>
  112. <if test="telPhone != null">#{telPhone},</if>
  113. <if test="shijStatus != null">#{shijStatus},</if>
  114. <if test="driversLicense != null">#{driversLicense},</if>
  115. <if test="drivingLicense != null">#{drivingLicense},</if>
  116. <if test="vehiclePhotos != null">#{vehiclePhotos},</if>
  117. <if test="passportPhoto != null">#{passportPhoto},</if>
  118. <if test="bankPhoto != null">#{bankPhoto},</if>
  119. <if test="merchantIntroduction != null">#{merchantIntroduction},</if>
  120. <if test="offline !=null">#{offline}</if>
  121. </trim>
  122. </insert>
  123. <update id="updateInfoUser" parameterType="InfoUser">
  124. update info_user
  125. <trim prefix="SET" suffixOverrides=",">
  126. <if test="userName != null and userName != ''">user_name = #{userName},</if>
  127. <if test="phone != null and phone != ''">phone = #{phone},</if>
  128. <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
  129. <if test="userType != null and userType != ''">user_type = #{userType},</if>
  130. <if test="email != null">email = #{email},</if>
  131. <if test="sex != null">sex = #{sex},</if>
  132. <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
  133. <if test="password != null">password = #{password},</if>
  134. <if test="status != null and status != ''">status = #{status},</if>
  135. <if test="delFlag != null">del_flag = #{delFlag},</if>
  136. <if test="cid != null">cid = #{cid},</if>
  137. <if test="mycode != null">mycode = #{mycode},</if>
  138. <if test="thiscode != null">thiscode = #{thiscode},</if>
  139. <if test="commission != null">commission = #{commission},</if>
  140. <if test="annex != null">annex = #{annex},</if>
  141. <if test="auditStatus != null">audit_status = #{auditStatus},</if>
  142. <if test="telPhone != null">tel_phone = #{telPhone},</if>
  143. <if test="shijStatus != null">shij_status = #{shijStatus},</if>
  144. <if test="driversLicense != null">drivers_license = #{driversLicense},</if>
  145. <if test="drivingLicense != null">driving_license = #{drivingLicense},</if>
  146. <if test="vehiclePhotos != null">vehicle_photos = #{vehiclePhotos},</if>
  147. <if test="passportPhoto != null">passport_photo = #{passportPhoto},</if>
  148. <if test="bankPhoto != null">bank_photo = #{bankPhoto},</if>
  149. <if test="merchantIntroduction != null">merchant_introduction = #{merchantIntroduction},</if>
  150. <if test="offline != null">offline =#{offline}</if>
  151. </trim>
  152. where user_id = #{userId}
  153. </update>
  154. <update id="deleteInfoUserByUserId" parameterType="Long">
  155. update info_user SET del_flag=1 where user_id = #{userId}
  156. </update>
  157. <update id="deleteInfoUserByUserIds" parameterType="String">
  158. update info_user SET del_flag=1 where user_id in
  159. <foreach item="userId" collection="array" open="(" separator="," close=")">
  160. #{userId}
  161. </foreach>
  162. </update>
  163. <select id="countUsersByUserTypeAndCreatedAt" resultType="int">
  164. SELECT COUNT(*)
  165. FROM info_user
  166. <where>
  167. user_type = #{userType}
  168. AND status = 0
  169. AND del_flag = 0
  170. <if test="createdAt != null">
  171. AND created_at &gt; #{createdAt}
  172. </if>
  173. </where>
  174. </select>
  175. <select id="getUserSum" resultType="int" >
  176. SELECT IFNULL(COUNT(*),0) FROM info_user
  177. <where>
  178. user_type=#{userType}
  179. <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
  180. and created_at between #{startDate} and #{endDate}
  181. </if>
  182. <if test="startDate != null and startDate != '' and (endDate == null or endDate == '')">
  183. and created_at >= #{startDate}
  184. </if>
  185. <if test="(startDate == null or startDate == '') and (endDate != null and endDate != '')">
  186. and created_at &lt;= #{endDate}
  187. </if>
  188. </where>
  189. </select>
  190. </mapper>