You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

199 lines
7.6 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="shop_type" jdbcType="INTEGER" property="shopType"/>
  18. <result column="brand" jdbcType="VARCHAR" property="brand"/>
  19. <result column="type" jdbcType="SMALLINT" property="type"/>
  20. <result column="is_public" jdbcType="SMALLINT" property="isPublic"/>
  21. <result column="email" property="email"/>
  22. </resultMap>
  23. <sql id="allColumns">
  24. `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`,
  25. `business_id`,`shop_type`,`brand`,`type`,`is_public`,email
  26. </sql>
  27. <sql id="dynamicWhereConditions">
  28. where 1 = 1
  29. <if test=" null != id ">
  30. and `id` = #{id}
  31. </if>
  32. <if test=" null != tenantId ">
  33. and `tenant_id` = #{tenantId}
  34. </if>
  35. <if test=" null != imgUrl ">
  36. and `img_url` like concat('%', #{imgUrl},'%')
  37. </if>
  38. <if test=" null != name and ''!=name ">
  39. and `name` like concat('%', #{name},'%')
  40. </if>
  41. <if test=" null != linkPhone and ''!=linkPhone ">
  42. and `link_phone` like concat('%', #{linkPhone},'%')
  43. </if>
  44. <if test=" null != createDate ">
  45. and `create_date` = #{createDate}
  46. </if>
  47. <if test=" null != updateDate ">
  48. and `update_date` = #{updateDate}
  49. </if>
  50. <if test=" null != carVendorType ">
  51. and `car_vendor_type` = #{carVendorType}
  52. </if>
  53. <if test=" null != businessId ">
  54. and `business_id` = #{businessId}
  55. </if>
  56. <if test=" null != carParams ">
  57. and `car_params` like concat('%', #{carParams},'%')
  58. </if>
  59. <if test=" null != status ">
  60. and `status` = #{status}
  61. </if>
  62. <if test=" null != linkPerson ">
  63. and `link_person` = #{linkPerson}
  64. </if>
  65. <if test=" null != type ">
  66. and `type` = #{type}
  67. </if>
  68. <if test=" null != isPublic ">
  69. and `is_public` = #{isPublic}
  70. </if>
  71. <if test=" null != email ">
  72. and `email` = #{email}
  73. </if>
  74. <if test=" null != rentShopType ">
  75. and id not in(
  76. select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is
  77. not null and status in(1,2,3,4)
  78. )
  79. </if>
  80. <if test=" null != ids ">
  81. and id in
  82. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  83. #{idItem}
  84. </foreach>
  85. </if>
  86. <if test=" null != sortColumns">order by ${sortColumns}</if>
  87. </sql>
  88. <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
  89. select
  90. <include refid="allColumns"/>
  91. from wx_merchant
  92. <include refid="dynamicWhereConditions"/>
  93. </select>
  94. <sql id="allMerchantVoColumns">
  95. m.id,
  96. m.img_url,m.name,m.link_phone,m.status,m.business_id,
  97. s.addr,s.shop_number,s.baidu_poi,
  98. mb.building_name,mf.floor_name,m.is_public,m.email
  99. </sql>
  100. <resultMap id="MerchantVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
  101. <id column="id" jdbcType="BIGINT" property="id"/>
  102. <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
  103. <result column="name" jdbcType="VARCHAR" property="merchantName"/>
  104. <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
  105. <result column="status" jdbcType="VARCHAR" property="merchantStatus"/>
  106. <result column="business_id" jdbcType="INTEGER" property="businessId"/>
  107. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  108. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  109. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  110. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  111. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  112. <result column="is_public" jdbcType="SMALLINT" property="isPublic"/>
  113. <result column="email" property="email"/>
  114. </resultMap>
  115. <select id="getMerchantByCode" parameterType="java.util.Map" resultMap="MerchantVoResultMap">
  116. select
  117. <include refid="allMerchantVoColumns"/>
  118. FROM wx_merchant m
  119. left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
  120. left join wx_shop s on ms.shop_id = s.id
  121. left join wx_mall_building mb on s.building = mb.id
  122. left join wx_mall_floor mf on s.floor = mf.id
  123. <where>
  124. <if test=" null != tenantId ">
  125. and m.`tenant_id` = #{tenantId}
  126. </if>
  127. <if test=" null != status ">
  128. and m.`status` = #{status}
  129. </if>
  130. <if test=" null != merchantCode ">
  131. and md5(m.`id`) = #{merchantCode}
  132. </if>
  133. </where>
  134. </select>
  135. <select id="findListCVo" parameterType="com.iformall.domain.vo.WxMerchantVo" resultMap="MerchantVoResultMap">
  136. select
  137. <include refid="allMerchantVoColumns"/>
  138. FROM wx_merchant m
  139. left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
  140. left join wx_shop s on ms.shop_id = s.id
  141. left join wx_mall_building mb on s.building = mb.id
  142. left join wx_mall_floor mf on s.floor = mf.id
  143. where 1 = 1
  144. <if test=" null != merchantName and ''!=merchantName ">
  145. and m.`name` like concat('%', #{merchantName},'%')
  146. </if>
  147. <if test=" null != merchantLinkPhone and ''!=merchantLinkPhone ">
  148. and m.`link_phone` like concat('%', #{merchantLinkPhone},'%')
  149. </if>
  150. <if test=" null != businessId ">
  151. and m.`business_id` = #{businessId}
  152. </if>
  153. <if test=" null != merchantStatus ">
  154. and m.`status` = #{merchantStatus}
  155. </if>
  156. <if test=" null != shopNumber and ''!=shopNumber ">
  157. and s.`shop_number` like concat('%', #{shopNumber},'%')
  158. </if>
  159. <if test=" null != buildingName and ''!=buildingName ">
  160. and mb.`building_name` like concat('%', #{buildingName},'%')
  161. </if>
  162. <if test=" null != floorName and ''!=floorName ">
  163. and mf.`floor_name` like concat('%', #{floorName},'%')
  164. </if>
  165. <if test=" null != isPublic">
  166. and m.`is_public` = #{isPublic}
  167. </if>
  168. </select>
  169. </mapper>