Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

172 строки
6.2 KiB

  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.iformall.mapper.WxMerchantBUserMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchantBUser">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  9. <result column="user_pwd" jdbcType="VARCHAR" property="userPwd"/>
  10. <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
  11. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  12. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  13. <result column="app_id" jdbcType="VARCHAR" property="appId"/>
  14. <result column="token" jdbcType="VARCHAR" property="token"/>
  15. <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
  16. <result column="name" jdbcType="VARCHAR" property="name"/>
  17. <result column="status" jdbcType="INTEGER" property="status"/>
  18. </resultMap>
  19. <sql id="allColumns">
  20. `id`,`tenant_id`,`parent_tenant_id`,`phone`,`user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time`,`name`,`status`
  21. </sql>
  22. <sql id="dynamicWhereConditions">
  23. where 1 = 1
  24. <if test=" null != id ">
  25. and `id` = #{id}
  26. </if>
  27. <if test=" null != tenantId and '' != tenantId">
  28. and `tenant_id` = #{tenantId}
  29. </if>
  30. <if test=" null != parentTenantId and '' != parentTenantId">
  31. and `parent_tenant_id` = #{parentTenantId}
  32. </if>
  33. <if test=" null != phone ">
  34. and `phone` = #{phone}
  35. </if>
  36. <if test=" null != phoneLike ">
  37. and `phone` like concat('%', #{phoneLike},'%')
  38. </if>
  39. <if test=" null != userPwd ">
  40. and `user_pwd` like concat('%', #{userPwd},'%')
  41. </if>
  42. <if test=" null != merchantId ">
  43. and `merchant_id` = #{merchantId}
  44. </if>
  45. <if test=" null != createDate ">
  46. and `create_date` = #{createDate}
  47. </if>
  48. <if test=" null != updateDate ">
  49. and `update_date` = #{updateDate}
  50. </if>
  51. <if test=" null != appId ">
  52. and `app_id` like concat('%', #{appId},'%')
  53. </if>
  54. <if test=" null != token ">
  55. and `token` like concat('%', #{token},'%')
  56. </if>
  57. <if test=" null != expireTime ">
  58. and `expire_time` = #{expireTime}
  59. </if>
  60. <if test=" null != name ">
  61. and `name` = #{name}
  62. </if>
  63. <if test=" null != status ">
  64. and `status` = #{status}
  65. </if>
  66. <if test=" null != ids ">
  67. and id in
  68. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  69. #{idItem}
  70. </foreach>
  71. </if>
  72. <if test=" null != merchantIds ">
  73. and merchant_id in
  74. <foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
  75. #{merchantIdItem}
  76. </foreach>
  77. </if>
  78. <if test=" null != sortColumns">order by ${sortColumns}</if>
  79. </sql>
  80. <select id="findList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultMap="BaseResultMap">
  81. select
  82. <include refid="allColumns"/>
  83. from wx_merchant_b_user
  84. <include refid="dynamicWhereConditions"/>
  85. </select>
  86. <select id="findMerchantIdListByIds" parameterType="com.iformall.domain.po.WxMerchantBUser" resultMap="BaseResultMap">
  87. select id, merchant_id
  88. from wx_merchant_b_user
  89. where `tenant_id` = #{tenantId}
  90. <if test=" null != ids ">
  91. and id in
  92. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  93. #{idItem}
  94. </foreach>
  95. </if>
  96. </select>
  97. <select id="findMerchantIdList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultType="Long">
  98. select distinct merchant_id
  99. from wx_merchant_b_user
  100. <include refid="dynamicWhereConditions"/>
  101. </select>
  102. <select id="findIdList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultType="Long">
  103. select id
  104. from wx_merchant_b_user
  105. <include refid="dynamicWhereConditions"/>
  106. </select>
  107. <select id="findSimpleList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultMap="BaseResultMap">
  108. select id,name,phone,merchant_id
  109. from wx_merchant_b_user
  110. where 1 = 1
  111. <if test=" null != tenantId and '' != tenantId">
  112. and `tenant_id` = #{tenantId}
  113. </if>
  114. <if test=" null != parentTenantId and '' != parentTenantId">
  115. and `parent_tenant_id` = #{parentTenantId}
  116. </if>
  117. <if test=" null != ids ">
  118. and id in
  119. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  120. #{idItem}
  121. </foreach>
  122. </if>
  123. </select>
  124. <select id="findSelMerchantList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultType="com.iformall.domain.vo.WxMerchantBuInfoVo">
  125. select
  126. mbu.tenant_id, mbu.parent_tenant_id, m.name tenant_name,
  127. mc.name merchant_name, mbu.id bu_user_id, mbu.merchant_id, mc.img_url
  128. from wx_merchant_b_user mbu, wx_merchant mc, wx_mall m
  129. <where> m.tenant_id = mbu.parent_tenant_id
  130. and mbu.merchant_id = mc.id and mc.status = 1
  131. <if test=" null != appId ">
  132. and mbu.`app_id` = #{appId}
  133. </if>
  134. <if test=" null != phone ">
  135. and mbu.`phone` = #{phone}
  136. </if>
  137. <if test=" null != status ">
  138. and mbu.`status` = #{status}
  139. </if>
  140. </where>
  141. </select>
  142. <select id="findByToken" resultMap="BaseResultMap">
  143. select * from wx_merchant_b_user
  144. where `token` = #{token}
  145. </select>
  146. </mapper>