TAppUserMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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.bussiness.mapper.TAppUserMapper">
  6. <resultMap type="com.ruoyi.bussiness.domain.TAppUser" id="TAppUserResult">
  7. <result property="userId" column="user_id" />
  8. <result property="loginName" column="login_name" />
  9. <result property="loginPassword" column="login_password" />
  10. <result property="phone" column="phone" />
  11. <result property="isTest" column="is_test" />
  12. <result property="address" column="address" />
  13. <result property="walletType" column="wallet_type" />
  14. <result property="status" column="status" />
  15. <result property="totleAmont" column="totle_amont" />
  16. <result property="buff" column="buff" />
  17. <result property="appParentIds" column="app_parent_ids" />
  18. <result property="activeCode" column="active_code" />
  19. <result property="registerIp" column="register_ip" />
  20. <result property="host" column="host" />
  21. <result property="adminParentIds" column="admin_parent_ids" />
  22. <result property="email" column="email" />
  23. <result property="level" column="level" />
  24. <result property="isFreeze" column="is_freeze" />
  25. <result property="createBy" column="create_by" />
  26. <result property="createTime" column="create_time" />
  27. <result property="updateBy" column="update_by" />
  28. <result property="updateTime" column="update_time" />
  29. <result property="remark" column="remark" />
  30. <result property="searchValue" column="search_value" />
  31. <result property="isBlack" column="is_black" />
  32. <result property="rechargeAmont" column="recharge_amont" />
  33. </resultMap>
  34. <sql id="selectTAppUserVo">
  35. select user_id, login_name, login_password, phone, is_test, address, wallet_type, status, totle_amont, buff, app_parent_ids, active_code, register_ip, host, admin_parent_ids, email, level, is_freeze, create_by, create_time, update_by, update_time, remark, search_value, is_black, recharge_amont from t_app_user
  36. </sql>
  37. <select id="selectTAppUserList" parameterType="TAppUser" resultMap="TAppUserResult">
  38. <include refid="selectTAppUserVo"/>
  39. <where>
  40. <if test="userId != null"> and user_id =#{userId}</if>
  41. <if test="loginName != null and loginName != ''"> and login_name like concat('%', #{loginName}, '%')</if>
  42. <if test="loginPassword != null and loginPassword != ''"> and login_password = #{loginPassword}</if>
  43. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  44. <if test="isTest != null "> and is_test = #{isTest}</if>
  45. <if test="address != null and address != ''"> and address = #{address}</if>
  46. <if test="walletType != null and walletType != ''"> and wallet_type = #{walletType}</if>
  47. <if test="status != null "> and status = #{status}</if>
  48. <if test="totleAmont != null "> and totle_amont = #{totleAmont}</if>
  49. <if test="buff != null "> and buff = #{buff}</if>
  50. <if test="appParentIds != null and appParentIds != ''"> and find_in_set(#{appParentIds},app_parent_ids)</if>
  51. <if test="activeCode != null and activeCode != ''"> and active_code = #{activeCode}</if>
  52. <if test="registerIp != null and registerIp != ''"> and register_ip = #{registerIp}</if>
  53. <if test="host != null and host != ''"> and host = #{host}</if>
  54. <if test="adminParentIds != null and adminParentIds!=''"> and find_in_set(#{adminParentIds},admin_parent_ids)</if>
  55. <if test="email != null and email != ''"> and email = #{email}</if>
  56. <if test="level != null "> and level = #{level}</if>
  57. <if test="isFreeze != null and isFreeze!=''"> and is_freeze = #{isFreeze}</if>
  58. <if test="searchValue != null and searchValue != ''"> and search_value = #{searchValue}</if>
  59. <if test="isBlack != null "> and is_black = #{isBlack}</if>
  60. <if test="rechargeAmont != null "> and recharge_amont = #{rechargeAmont}</if>
  61. </where>
  62. </select>
  63. <select id="selectTAppUserByUserId" parameterType="Long" resultMap="TAppUserResult">
  64. <include refid="selectTAppUserVo"/>
  65. where user_id = #{userId}
  66. </select>
  67. <select id="selectByUserLoginName" resultType="com.ruoyi.bussiness.domain.TAppUser"
  68. parameterType="java.lang.String">
  69. <include refid="selectTAppUserVo"/>
  70. where
  71. IF(wallet_type='TRON',address=#{loginName}, LOWER(address) = LOWER(#{loginName})) or login_name=#{loginName}
  72. </select>
  73. <select id="selectByAddress" resultType="com.ruoyi.bussiness.domain.TAppUser"
  74. parameterType="java.lang.String">
  75. <include refid="selectTAppUserVo"/>
  76. where LOWER(address) = LOWER(#{address})
  77. </select>
  78. <select id="selectActiveCodeList" resultType="java.lang.String">
  79. select active_code from t_app_user
  80. </select>
  81. <select id="selectUnboundAppUser" resultType="com.ruoyi.bussiness.domain.TAppUser"
  82. parameterType="com.ruoyi.bussiness.domain.TAppUser">
  83. select user_id AS userId,
  84. login_name,
  85. phone,
  86. status,
  87. create_time as creataTime,
  88. update_by AS updateBy,
  89. update_time AS updateTime,
  90. IF(find_in_set(#{adminParentIds},admin_parent_ids),"true","false") as flag
  91. from t_app_user
  92. where status = '0'
  93. <if test="loginName !=null and loginName !=''">
  94. and login_name like CONCAT('%',#{loginName},'%')
  95. </if>
  96. <if test="userId !=null">
  97. and user_id = #{userId}
  98. </if>
  99. order by flag desc
  100. </select>
  101. <select id="getTAppUserList" resultType="com.ruoyi.bussiness.domain.TAppUser"
  102. parameterType="com.ruoyi.bussiness.domain.TAppUser">
  103. select a.user_id AS userId, a.login_name AS loginName, a.login_password AS loginPassword, a.phone, a.is_test AS isTest, a.address,
  104. a.wallet_type AS walletType, a.status, a.totle_amont AS totleAmont, a.buff, a.app_parent_ids AS appParentIds, a.active_code AS activeCode, a.register_ip AS registerIp,
  105. a.host, a.admin_parent_ids AS adminParentIds, a.email, a.level, a.is_freeze AS isFreeze, a.create_by AS createBy, a.create_time AS createTime, a.update_by AS updateBy,
  106. a.update_time AS updateTime, a.remark, a.search_value AS searchValue, a.is_black AS isBlack, a.recharge_amont AS rechargeAmont,
  107. (
  108. SELECT
  109. GROUP_CONCAT( s.user_name ORDER BY FIND_IN_SET(s.user_id,a.admin_parent_ids) )
  110. FROM
  111. sys_user s
  112. WHERE
  113. FIND_IN_SET(s.user_id,a.admin_parent_ids)
  114. ) AS adminParentNames,
  115. (
  116. SELECT
  117. GROUP_CONCAT(t.login_name ORDER BY FIND_IN_SET(t.user_id,a.app_parent_ids) )
  118. from
  119. t_app_user t
  120. where FIND_IN_SET(t.user_id,a.app_parent_ids)
  121. ) AS appParentNames ,
  122. (
  123. select IFNULL(b.win_num, 0)
  124. from t_app_user_detail b where a.user_id = b.user_id
  125. ) AS win_num ,
  126. (
  127. select IFNULL(c.lose_num, 0)
  128. from t_app_user_detail c where a.user_id = c.user_id
  129. ) AS lose_num
  130. from t_app_user a
  131. <where>
  132. <if test="userId != null"> and a.user_id =#{userId}</if>
  133. <if test="loginName != null and loginName != ''"> and a.login_name like concat('%', #{loginName}, '%')</if>
  134. <if test="loginPassword != null and loginPassword != ''"> and a.login_password = #{loginPassword}</if>
  135. <if test="phone != null and phone != ''"> and a.phone = #{phone}</if>
  136. <if test="isTest != null "> and a.is_test = #{isTest}</if>
  137. <if test="address != null and address != ''"> and a.address = #{address}</if>
  138. <if test="walletType != null and walletType != ''"> and a.wallet_type = #{walletType}</if>
  139. <if test="status != null "> and a.status = #{status}</if>
  140. <if test="totleAmont != null "> and a.totle_amont = #{totleAmont}</if>
  141. <if test="buff != null "> and a.buff = #{buff}</if>
  142. <if test="appParentIds != null and appParentIds != ''"> and find_in_set(#{appParentIds},a.app_parent_ids)</if>
  143. <if test="activeCode != null and activeCode != ''"> and a.active_code = #{activeCode}</if>
  144. <if test="registerIp != null and registerIp != ''"> and a.register_ip = #{registerIp}</if>
  145. <if test="host != null and host != ''"> and a.host = #{host}</if>
  146. <if test="adminParentIds != null and adminParentIds!=''"> and find_in_set(#{adminParentIds},a.admin_parent_ids)</if>
  147. <if test="email != null and email != ''"> and a.email = #{email}</if>
  148. <if test="level != null "> and a.level = #{level}</if>
  149. <if test="isFreeze != null and isFreeze!=''"> and a.is_freeze = #{isFreeze}</if>
  150. <if test="searchValue != null and searchValue != ''"> and a.search_value = #{searchValue}</if>
  151. </where>
  152. </select>
  153. <select id="getListByPledge" resultType="com.ruoyi.bussiness.domain.TAppUser"
  154. parameterType="com.ruoyi.bussiness.domain.TAppUser">
  155. select a.user_id AS userId, a.login_name AS loginName, a.login_password AS loginPassword, a.phone, a.is_test AS isTest, a.address,
  156. a.wallet_type AS walletType, a.status, a.totle_amont AS totleAmont, a.buff, a.app_parent_ids AS appParentIds, a.active_code AS activeCode, a.register_ip AS registerIp,
  157. a.host, a.admin_parent_ids AS adminParentIds, a.email, a.level, a.is_freeze AS isFreeze, a.create_by AS createBy, a.create_time AS createTime, a.update_by AS updateBy,
  158. a.update_time AS updateTime, a.remark, a.search_value AS searchValue, a.recharge_amont AS rechargeAmont,
  159. (
  160. SELECT
  161. GROUP_CONCAT( s.user_name )
  162. FROM
  163. sys_user s
  164. WHERE
  165. FIND_IN_SET(s.user_id,a.admin_parent_ids)
  166. ) AS adminParentNames,
  167. (
  168. SELECT
  169. GROUP_CONCAT(t.login_name)
  170. from
  171. t_app_user t
  172. where FIND_IN_SET(t.user_id,a.app_parent_ids)
  173. ) AS appParentNames
  174. from t_app_user a
  175. <where>
  176. not exists (
  177. SELECT user_id from t_ming_product_user pu
  178. LEFT JOIN t_ming_product p ON p.id = pu.product_id
  179. WHERE a.user_id =pu.app_user_id
  180. <if test="productId!=null"> and pu.product_id = #{productId}</if>
  181. )
  182. <if test="userId != null"> and a.user_id =#{userId}</if>
  183. <if test="loginName != null and loginName != ''"> and a.login_name like concat('%', #{loginName}, '%')</if>
  184. <if test="loginPassword != null and loginPassword != ''"> and a.login_password = #{loginPassword}</if>
  185. <if test="phone != null and phone != ''"> and a.phone = #{phone}</if>
  186. <if test="isTest != null "> and a.is_test = #{isTest}</if>
  187. <if test="address != null and address != ''"> and a.address = #{address}</if>
  188. <if test="walletType != null and walletType != ''"> and a.wallet_type = #{walletType}</if>
  189. <if test="status != null "> and a.status = #{status}</if>
  190. <if test="totleAmont != null "> and a.totle_amont = #{totleAmont}</if>
  191. <if test="buff != null "> and a.buff = #{buff}</if>
  192. <if test="appParentIds != null and appParentIds != ''"> and find_in_set(#{appParentIds},a.app_parent_ids)</if>
  193. <if test="activeCode != null and activeCode != ''"> and a.active_code = #{activeCode}</if>
  194. <if test="registerIp != null and registerIp != ''"> and a.register_ip = #{registerIp}</if>
  195. <if test="host != null and host != ''"> and a.host = #{host}</if>
  196. <if test="adminParentIds != null and adminParentIds!=''"> and find_in_set(#{adminParentIds},a.admin_parent_ids)</if>
  197. <if test="email != null and email != ''"> and a.email = #{email}</if>
  198. <if test="level != null "> and a.level = #{level}</if>
  199. <if test="isFreeze != null and isFreeze!=''"> and a.is_freeze = #{isFreeze}</if>
  200. <if test="searchValue != null and searchValue != ''"> and a.search_value = #{searchValue}</if>
  201. </where>
  202. </select>
  203. <insert id="insertTAppUser" parameterType="TAppUser" useGeneratedKeys="true" keyProperty="userId">
  204. insert into t_app_user
  205. <trim prefix="(" suffix=")" suffixOverrides=",">
  206. <if test="loginName != null">login_name,</if>
  207. <if test="loginPassword != null">login_password,</if>
  208. <if test="phone != null">phone,</if>
  209. <if test="isTest != null">is_test,</if>
  210. <if test="address != null">address,</if>
  211. <if test="walletType != null">wallet_type,</if>
  212. <if test="status != null">status,</if>
  213. <if test="totleAmont != null">totle_amont,</if>
  214. <if test="buff != null">buff,</if>
  215. <if test="appParentIds != null">app_parent_ids,</if>
  216. <if test="activeCode != null and activeCode != ''">active_code,</if>
  217. <if test="registerIp != null">register_ip,</if>
  218. <if test="host != null">host,</if>
  219. <if test="adminParentIds != null">admin_parent_ids,</if>
  220. <if test="email != null">email,</if>
  221. <if test="level != null">level,</if>
  222. <if test="isFreeze != null">is_freeze,</if>
  223. <if test="createBy != null">create_by,</if>
  224. <if test="createTime != null">create_time,</if>
  225. <if test="updateBy != null">update_by,</if>
  226. <if test="updateTime != null">update_time,</if>
  227. <if test="remark != null">remark,</if>
  228. <if test="searchValue != null">search_value,</if>
  229. <if test="isBlack != null">is_black,</if>
  230. <if test="rechargeAmont != null">recharge_amont,</if>
  231. </trim>
  232. <trim prefix="values (" suffix=")" suffixOverrides=",">
  233. <if test="loginName != null">#{loginName},</if>
  234. <if test="loginPassword != null">#{loginPassword},</if>
  235. <if test="phone != null">#{phone},</if>
  236. <if test="isTest != null">#{isTest},</if>
  237. <if test="address != null">#{address},</if>
  238. <if test="walletType != null">#{walletType},</if>
  239. <if test="status != null">#{status},</if>
  240. <if test="totleAmont != null">#{totleAmont},</if>
  241. <if test="buff != null">#{buff},</if>
  242. <if test="appParentIds != null">#{appParentIds},</if>
  243. <if test="activeCode != null and activeCode != ''">#{activeCode},</if>
  244. <if test="registerIp != null">#{registerIp},</if>
  245. <if test="host != null">#{host},</if>
  246. <if test="adminParentIds != null">#{adminParentIds},</if>
  247. <if test="email != null">#{email},</if>
  248. <if test="level != null">#{level},</if>
  249. <if test="isFreeze != null">#{isFreeze},</if>
  250. <if test="createBy != null">#{createBy},</if>
  251. <if test="createTime != null">#{createTime},</if>
  252. <if test="updateBy != null">#{updateBy},</if>
  253. <if test="updateTime != null">#{updateTime},</if>
  254. <if test="remark != null">#{remark},</if>
  255. <if test="searchValue != null">#{searchValue},</if>
  256. <if test="isBlack != null">#{isBlack},</if>
  257. <if test="rechargeAmont != null">#{rechargeAmont},</if>
  258. </trim>
  259. </insert>
  260. <update id="updateTAppUser" parameterType="TAppUser">
  261. update t_app_user
  262. <trim prefix="SET" suffixOverrides=",">
  263. <if test="loginName != null">login_name = #{loginName},</if>
  264. <if test="loginPassword != null">login_password = #{loginPassword},</if>
  265. <if test="phone != null">phone = #{phone},</if>
  266. <if test="isTest != null">is_test = #{isTest},</if>
  267. <if test="address != null">address = #{address},</if>
  268. <if test="walletType != null">wallet_type = #{walletType},</if>
  269. <if test="status != null">status = #{status},</if>
  270. <if test="totleAmont != null">totle_amont = #{totleAmont},</if>
  271. <if test="buff != null">buff = #{buff},</if>
  272. <if test="appParentIds != null">app_parent_ids = #{appParentIds},</if>
  273. <if test="activeCode != null and activeCode != ''">active_code = #{activeCode},</if>
  274. <if test="registerIp != null">register_ip = #{registerIp},</if>
  275. <if test="host != null">host = #{host},</if>
  276. <if test="adminParentIds != null">admin_parent_ids = #{adminParentIds},</if>
  277. <if test="email != null">email = #{email},</if>
  278. <if test="level != null">level = #{level},</if>
  279. <if test="isFreeze != null">is_freeze = #{isFreeze},</if>
  280. <if test="createBy != null">create_by = #{createBy},</if>
  281. <if test="createTime != null">create_time = #{createTime},</if>
  282. <if test="updateBy != null">update_by = #{updateBy},</if>
  283. <if test="updateTime != null">update_time = #{updateTime},</if>
  284. <if test="remark != null">remark = #{remark},</if>
  285. <if test="searchValue != null">search_value = #{searchValue},</if>
  286. <if test="isBlack != null">is_black = #{isBlack},</if>
  287. <if test="rechargeAmont != null">recharge_amont = #{rechargeAmont},</if>
  288. </trim>
  289. where user_id = #{userId}
  290. </update>
  291. <delete id="deleteTAppUserByUserId" parameterType="Long">
  292. delete from t_app_user where user_id = #{userId}
  293. </delete>
  294. <delete id="deleteTAppUserByUserIds" parameterType="String">
  295. delete from t_app_user where user_id in
  296. <foreach item="userId" collection="array" open="(" separator="," close=")">
  297. #{userId}
  298. </foreach>
  299. </delete>
  300. <update id="delUpdateByAdminUserId" parameterType="java.lang.Long">
  301. update t_app_user set admin_parent_ids = '' where find_in_set(#{adminUserId},admin_parent_ids)
  302. </update>
  303. <update id="updateUserAppIds">
  304. update t_app_user set admin_parent_ids = #{adminParentIds} where user_id = #{appUserId}
  305. </update>
  306. <update id="updateTotleAmont" parameterType="com.ruoyi.bussiness.domain.TAppUser">
  307. update t_app_user set totle_amont = #{totleAmont} where user_id = #{userId}
  308. </update>
  309. <update id="updateRechargeAmont" parameterType="com.ruoyi.bussiness.domain.TAppUser">
  310. update t_app_user set recharge_amont = #{rechargeAmont} where user_id = #{userId}
  311. </update>
  312. </mapper>