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

219 строки
8.7 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. </resultMap>
  28. <sql id="allColumns">
  29. `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`,
  30. `business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`
  31. </sql>
  32. <sql id="dynamicWhereConditions">
  33. where 1 = 1
  34. <if test=" null != id ">
  35. and `id` = #{id}
  36. </if>
  37. <if test=" null != tenantId ">
  38. and `tenant_id` = #{tenantId}
  39. </if>
  40. <if test=" null != imgUrl ">
  41. and `img_url` like concat('%', #{imgUrl},'%')
  42. </if>
  43. <if test=" null != name and ''!=name ">
  44. and `name` like concat('%', #{name},'%')
  45. </if>
  46. <if test=" null != linkPhone and ''!=linkPhone ">
  47. and `link_phone` like concat('%', #{linkPhone},'%')
  48. </if>
  49. <if test=" null != createDate ">
  50. and `create_date` = #{createDate}
  51. </if>
  52. <if test=" null != updateDate ">
  53. and `update_date` = #{updateDate}
  54. </if>
  55. <if test=" null != carVendorType ">
  56. and `car_vendor_type` = #{carVendorType}
  57. </if>
  58. <if test=" null != businessId ">
  59. and `business_id` = #{businessId}
  60. </if>
  61. <if test=" null != subBusinessId ">
  62. and `sub_business_id` = #{subBusinessId}
  63. </if>
  64. <if test=" null != carParams ">
  65. and `car_params` like concat('%', #{carParams},'%')
  66. </if>
  67. <if test=" null != status ">
  68. and `status` = #{status}
  69. </if>
  70. <if test=" null != linkPerson ">
  71. and `link_person` = #{linkPerson}
  72. </if>
  73. <if test=" null != type ">
  74. and `type` = #{type}
  75. </if>
  76. <if test=" null != isPublic ">
  77. and `is_public` = #{isPublic}
  78. </if>
  79. <if test=" null != email ">
  80. and `email` = #{email}
  81. </if>
  82. <if test=" null != isAdmin ">
  83. and `is_admin` = #{isAdmin}
  84. </if>
  85. <if test=" null != rentShopType ">
  86. and id not in(
  87. select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is
  88. not null and status in(1,2,3,4)
  89. )
  90. </if>
  91. <if test=" null != ids ">
  92. and id in
  93. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  94. #{idItem}
  95. </foreach>
  96. </if>
  97. <if test=" null != sortColumns">order by ${sortColumns}</if>
  98. </sql>
  99. <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
  100. select
  101. <include refid="allColumns"/>
  102. from wx_merchant
  103. <include refid="dynamicWhereConditions"/>
  104. </select>
  105. <sql id="allMerchantVoColumns">
  106. m.id,m.img_url,m.name,m.link_phone,m.status,m.business_id,m.sub_business_id,
  107. m.is_public,m.email,m.title,m.cover_picture,b.name as brand_name,b.logo as brand_img,
  108. m.shop_type,bu.title as business_name,b.summary
  109. </sql>
  110. <select id="getMerchantByCode" parameterType="java.util.Map" resultMap="MerchantVoResultMap">
  111. select
  112. <include refid="allMerchantVoColumns"/>
  113. FROM wx_merchant m
  114. left join wx_brand b on b.id = m.brand
  115. left join wx_business bu on bu.id = m.business_id
  116. <where>
  117. <if test=" null != tenantId ">
  118. and m.`tenant_id` = #{tenantId}
  119. </if>
  120. <if test=" null != status ">
  121. and m.`status` = #{status}
  122. </if>
  123. <if test=" null != merchantCode ">
  124. and md5(m.`id`) = #{merchantCode}
  125. </if>
  126. </where>
  127. </select>
  128. <resultMap id="MerchantVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
  129. <id column="id" jdbcType="BIGINT" property="id"/>
  130. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
  131. <result column="name" jdbcType="VARCHAR" property="merchantName"/>
  132. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
  133. <result column="status" jdbcType="VARCHAR" property="merchantStatus"/>
  134. <result column="business_id" jdbcType="INTEGER" property="businessId"/>
  135. <result column="sub_business_id" jdbcType="INTEGER" property="subBusinessId"/>
  136. <result column="is_public" jdbcType="INTEGER" property="isPublic"/>
  137. <result column="email" jdbcType="VARCHAR" property="email"/>
  138. <result column="title" jdbcType="VARCHAR" property="title"/>
  139. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  140. <result column="shop_type" jdbcType="VARCHAR" property="shopType"/>
  141. <result column="brand_name" jdbcType="VARCHAR" property="brandName"/>
  142. <result column="brand_img" jdbcType="VARCHAR" property="brandImg"/>
  143. <result column="summary" jdbcType="VARCHAR" property="summary"/>
  144. <result column="business_name" jdbcType="VARCHAR" property="businessName"/>
  145. <collection column="{merchantId=id}" property="shopVoList"
  146. ofType="com.iformall.domain.vo.WxShopVo"
  147. javaType="java.util.List"
  148. select="com.iformall.mapper.WxShopMapper.findShopVoList">
  149. </collection>
  150. </resultMap>
  151. <select id="findListCVo" parameterType="com.iformall.domain.vo.WxMerchantVo" resultMap="MerchantVoResultMap">
  152. select
  153. <include refid="allMerchantVoColumns"/>
  154. FROM wx_merchant m
  155. left join wx_brand b on b.id = m.brand
  156. left join wx_business bu on bu.id = m.business_id
  157. where 1=1
  158. <if test=" null != merchantName and ''!=merchantName ">
  159. and m.`name` like concat('%', #{merchantName},'%')
  160. </if>
  161. <if test=" null != merchantLinkPhone and ''!=merchantLinkPhone ">
  162. and m.`link_phone` like concat('%', #{merchantLinkPhone},'%')
  163. </if>
  164. <if test=" null != businessId ">
  165. and m.`business_id` = #{businessId}
  166. </if>
  167. <if test=" null != subBusinessId ">
  168. and m.`sub_business_id` = #{subBusinessId}
  169. </if>
  170. <if test=" null != merchantStatus ">
  171. and m.`status` = #{merchantStatus}
  172. </if>
  173. <if test=" null != isPublic">
  174. and m.`is_public` = #{isPublic}
  175. </if>
  176. <if test=" null != id">
  177. and m.`id` = #{id}
  178. </if>
  179. </select>
  180. <select id="queryMerchantByMerchantIdOfSharingReceiver" resultType="com.iformall.domain.po.WxMerchant"
  181. parameterType="com.iformall.domain.po.WxMerchant">
  182. select m.name,psr.id from wx_merchant m
  183. left join (select * from wx_profit_sharing_receiver where status=0) psr on m.id=psr.merchant_id
  184. where m.id=#{id}
  185. </select>
  186. </mapper>