25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

255 satır
10 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.WxMerchantMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchant">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  8. <result column="name" jdbcType="VARCHAR" property="name"/>
  9. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  10. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  11. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  12. <result column="car_vendor_type" jdbcType="INTEGER" property="carVendorType"/>
  13. <result column="car_params" jdbcType="VARCHAR" property="carParams"/>
  14. <result column="status" jdbcType="INTEGER" property="status"/>
  15. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  16. <result column="business_id" jdbcType="INTEGER" property="businessId"/>
  17. <result column="sub_business_id" jdbcType="INTEGER" property="subBusinessId"/>
  18. <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
  19. <result column="brand" jdbcType="VARCHAR" property="brand"/>
  20. <result column="type" jdbcType="SMALLINT" property="type"/>
  21. <result column="is_public" jdbcType="SMALLINT" property="isPublic"/>
  22. <result column="email" jdbcType="VARCHAR" property="email"/>
  23. <result column="title" jdbcType="VARCHAR" property="title"/>
  24. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  25. <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/>
  26. <result column="bill_setting" jdbcType="INTEGER" property="billSetting"/>
  27. <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
  28. <result column="introduction" jdbcType="VARCHAR" property="introduction"/>
  29. <result column="action_desc" jdbcType="VARCHAR" property="actionDesc"/>
  30. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  31. <result column="talk_user_main" jdbcType="VARCHAR" property="talkUserMain"/>
  32. <result column="talk_user_aux" jdbcType="VARCHAR" property="talkUserAux"/>
  33. </resultMap>
  34. <sql id="allColumns">
  35. `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`,
  36. `business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`,
  37. `introduction`,`action_desc`,`is_del`,
  38. `talk_user_main`,`talk_user_aux`
  39. </sql>
  40. <sql id="dynamicWhereConditions">
  41. where is_del = 0
  42. <if test=" null != id ">
  43. and `id` = #{id}
  44. </if>
  45. <if test=" null != tenantId ">
  46. and `tenant_id` = #{tenantId}
  47. </if>
  48. <if test=" null != imgUrl ">
  49. and `img_url` like concat('%', #{imgUrl},'%')
  50. </if>
  51. <if test=" null != name and ''!=name ">
  52. and `name` like concat('%', #{name},'%')
  53. </if>
  54. <if test=" null != linkPhone and ''!=linkPhone ">
  55. and `link_phone` like concat('%', #{linkPhone},'%')
  56. </if>
  57. <if test=" null != createDate ">
  58. and `create_date` = #{createDate}
  59. </if>
  60. <if test=" null != updateDate ">
  61. and `update_date` = #{updateDate}
  62. </if>
  63. <if test=" null != carVendorType ">
  64. and `car_vendor_type` = #{carVendorType}
  65. </if>
  66. <if test=" null != businessId ">
  67. and `business_id` = #{businessId}
  68. </if>
  69. <if test=" null != subBusinessId ">
  70. and `sub_business_id` = #{subBusinessId}
  71. </if>
  72. <if test=" null != carParams ">
  73. and `car_params` like concat('%', #{carParams},'%')
  74. </if>
  75. <if test=" null != status ">
  76. and `status` = #{status}
  77. </if>
  78. <if test=" null != linkPerson ">
  79. and `link_person` = #{linkPerson}
  80. </if>
  81. <if test=" null != type ">
  82. and `type` = #{type}
  83. </if>
  84. <if test=" null != isPublic ">
  85. and `is_public` = #{isPublic}
  86. </if>
  87. <if test=" null != email ">
  88. and `email` = #{email}
  89. </if>
  90. <if test=" null != isAdmin ">
  91. and `is_admin` = #{isAdmin}
  92. </if>
  93. <if test=" null != isDel ">
  94. and `is_del` = #{isDel}
  95. </if>
  96. <if test=" null != brand ">
  97. and `brand` = #{brand}
  98. </if>
  99. <if test=" null != rentShopType ">
  100. and id not in(
  101. select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is
  102. not null and status in(1,2,3,4)
  103. )
  104. </if>
  105. <if test=" null != ids ">
  106. and id in
  107. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  108. #{idItem}
  109. </foreach>
  110. </if>
  111. <if test=" null != sortColumns">order by ${sortColumns}</if>
  112. </sql>
  113. <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
  114. select
  115. <include refid="allColumns"/>
  116. from wx_merchant
  117. <include refid="dynamicWhereConditions"/>
  118. </select>
  119. <sql id="allMerchantVoColumns">
  120. m.id,m.img_url,m.name,m.link_phone,m.status,m.business_id,
  121. m.is_public,m.email,m.title,m.cover_picture,m.sub_business_id,
  122. m.shop_type,m.introduction,m.action_desc,bu.title as business_name
  123. </sql>
  124. <select id="getMerchantByCode" parameterType="java.util.Map" resultMap="MerchantVoResultMap">
  125. select
  126. <include refid="allMerchantVoColumns"/>
  127. FROM wx_merchant m
  128. left join wx_business bu on bu.id = m.business_id
  129. <where>
  130. <if test=" null != tenantId ">
  131. and m.`tenant_id` = #{tenantId}
  132. </if>
  133. <if test=" null != status ">
  134. and m.`status` = #{status}
  135. </if>
  136. <if test=" null != merchantCode ">
  137. and md5(m.`id`) = #{merchantCode}
  138. </if>
  139. </where>
  140. </select>
  141. <resultMap id="MerchantVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
  142. <id column="id" jdbcType="BIGINT" property="id"/>
  143. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
  144. <result column="name" jdbcType="VARCHAR" property="merchantName"/>
  145. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
  146. <result column="status" jdbcType="VARCHAR" property="merchantStatus"/>
  147. <result column="business_id" jdbcType="INTEGER" property="businessId"/>
  148. <result column="sub_business_id" jdbcType="INTEGER" property="subBusinessId"/>
  149. <result column="is_public" jdbcType="INTEGER" property="isPublic"/>
  150. <result column="email" jdbcType="VARCHAR" property="email"/>
  151. <result column="title" jdbcType="VARCHAR" property="title"/>
  152. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  153. <result column="shop_type" jdbcType="VARCHAR" property="shopType"/>
  154. <result column="brand_name" jdbcType="VARCHAR" property="brandName"/>
  155. <result column="brand_img" jdbcType="VARCHAR" property="brandImg"/>
  156. <result column="summary" jdbcType="VARCHAR" property="summary"/>
  157. <result column="business_name" jdbcType="VARCHAR" property="businessName"/>
  158. <result column="introduction" jdbcType="VARCHAR" property="introduction"/>
  159. <result column="action_desc" jdbcType="VARCHAR" property="actionDesc"/>
  160. <collection column="{merchantId=id}" property="shopVoList"
  161. ofType="com.iformall.domain.vo.WxShopVo"
  162. javaType="java.util.List"
  163. select="com.iformall.mapper.WxShopMapper.findShopVoList">
  164. </collection>
  165. </resultMap>
  166. <select id="findListCVo" parameterType="com.iformall.domain.vo.WxMerchantVo" resultMap="MerchantVoResultMap">
  167. select
  168. <include refid="allMerchantVoColumns"/>
  169. FROM wx_merchant m
  170. left join wx_business bu on bu.id = m.business_id
  171. where 1=1
  172. <if test=" null != merchantName and ''!=merchantName ">
  173. and m.`name` like concat('%', #{merchantName},'%')
  174. </if>
  175. <if test=" null != merchantLinkPhone and ''!=merchantLinkPhone ">
  176. and m.`link_phone` like concat('%', #{merchantLinkPhone},'%')
  177. </if>
  178. <if test=" null != businessId ">
  179. and m.`business_id` = #{businessId}
  180. </if>
  181. <if test=" null != subBusinessId ">
  182. and m.`sub_business_id` = #{subBusinessId}
  183. </if>
  184. <if test=" null != merchantStatus ">
  185. and m.`status` = #{merchantStatus}
  186. </if>
  187. <if test=" null != isPublic">
  188. and m.`is_public` = #{isPublic}
  189. </if>
  190. <if test=" null != id">
  191. and m.`id` = #{id}
  192. </if>
  193. order by m.top_time desc
  194. </select>
  195. <select id="queryMerchantByMerchantIdOfSharingReceiver" resultType="com.iformall.domain.po.WxMerchant"
  196. parameterType="com.iformall.domain.po.WxMerchant">
  197. select m.name,psr.id from wx_merchant m
  198. left join (select * from wx_profit_sharing_receiver where status=0) psr on m.id=psr.merchant_id
  199. where m.id=#{id}
  200. </select>
  201. <select id="findQrcodeEmptyList" resultMap="BaseResultMap">
  202. select * from wx_merchant where qr_code is null;
  203. </select>
  204. <select id="findBusByFloorId" resultType="hashmap" parameterType="hashmap">
  205. select count(distinct m.id) count,b.id bid,b.`title` btitle from wx_merchant m left join wx_merchant_shop ms on(m.id = ms.merchant_id)
  206. left join wx_shop s on(ms.shop_id = s.id)
  207. left join wx_mall_floor f on(s.floor = f.id)
  208. left join wx_business b on(m.business_id = b.id)
  209. where f.id = #{id}
  210. and m.tenant_id = #{tenantId}
  211. group by m.business_id
  212. </select>
  213. <select id="hasMerchant" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
  214. select count(*) from wx_merchant where tenant_id = #{tenantId} and `name`=#{name} and status=#{status}
  215. <if test=" null != id">
  216. and `id` != #{id}
  217. </if>
  218. </select>
  219. </mapper>