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

289 строки
9.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.WxShopMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxShop">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  8. <result column="build_area" jdbcType="VARCHAR" property="buildArea"/>
  9. <result column="operation_area" jdbcType="VARCHAR" property="operationArea"/>
  10. <result column="building" jdbcType="BIGINT" property="building"/>
  11. <result column="floor" jdbcType="BIGINT" property="floor"/>
  12. <result column="status" jdbcType="INTEGER" property="status"/>
  13. <result column="x" jdbcType="DECIMAL" property="x"/>
  14. <result column="y" jdbcType="DECIMAL" property="y"/>
  15. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  16. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  17. <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
  18. <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
  19. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  20. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  21. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  22. <result column="manager" jdbcType="VARCHAR" property="manager"/>
  23. <result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
  24. </resultMap>
  25. <sql id="allColumns">
  26. `id`,`tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`,
  27. `floor`,`status`,`x`,`y`,`addr`,`baidu_poi`,`longitude`,`latitude`,`create_date`,
  28. `update_date`,`img_url`,`manager`,`manager_phone`
  29. </sql>
  30. <sql id="dynamicWhereConditions">
  31. where 1 = 1
  32. <if test=" null != id ">
  33. and `id` = #{id}
  34. </if>
  35. <if test=" null != tenantId ">
  36. and `tenant_id` = #{tenantId}
  37. </if>
  38. <if test=" null != shopNumber and ''!=shopNumber">
  39. and `shop_number` like concat('%', #{shopNumber},'%')
  40. </if>
  41. <if test=" null != buildArea ">
  42. and `build_area` like concat('%', #{buildArea},'%')
  43. </if>
  44. <if test=" null != operationArea ">
  45. and `operation_area` like concat('%', #{operationArea},'%')
  46. </if>
  47. <if test=" null != building ">
  48. and `building` like concat('%', #{building},'%')
  49. </if>
  50. <if test=" null != floor ">
  51. and `floor` = #{floor}
  52. </if>
  53. <if test=" null != status ">
  54. and `status` = #{status}
  55. </if>
  56. <if test=" null != x ">
  57. and `x` = #{x}
  58. </if>
  59. <if test=" null != y ">
  60. and `y` = #{y}
  61. </if>
  62. <if test=" null != addr ">
  63. and `addr` like concat('%', #{addr},'%')
  64. </if>
  65. <if test=" null != baiduPoi ">
  66. and `baidu_poi` like concat('%', #{baiduPoi},'%')
  67. </if>
  68. <if test=" null != longitude ">
  69. and `longitude` = #{longitude}
  70. </if>
  71. <if test=" null != latitude ">
  72. and `latitude` = #{latitude}
  73. </if>
  74. <if test=" null != createDate ">
  75. and `create_date` = #{createDate}
  76. </if>
  77. <if test=" null != updateDate ">
  78. and `update_date` = #{updateDate}
  79. </if>
  80. <if test=" null != manager ">
  81. and `manager` = #{manager}
  82. </if>
  83. <if test=" null != managerPhone ">
  84. and `manager_phone` = #{managerPhone}
  85. </if>
  86. <if test=" null != ids ">
  87. and id in
  88. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  89. #{idItem}
  90. </foreach>
  91. </if>
  92. <if test=" null != sortColumns">order by ${sortColumns}</if>
  93. </sql>
  94. <select id="findList" parameterType="com.iformall.domain.po.WxShop" resultMap="BaseResultMap">
  95. select
  96. <include refid="allColumns"/>
  97. from wx_shop
  98. <include refid="dynamicWhereConditions"/>
  99. </select>
  100. <select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  101. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  102. s.img_url imgUrl,s.operation_area operationArea,
  103. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  104. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone
  105. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  106. left join wx_merchant m on ms.merchant_id=m.id
  107. left join wx_mall_building b on s.building=b.id
  108. left join wx_mall_floor f on s.floor=f.id
  109. where 1 = 1
  110. <if test=" null != id ">
  111. and s.`id` = #{id}
  112. </if>
  113. <if test=" null != tenantId ">
  114. and s.`tenant_id`= #{tenantId}
  115. </if>
  116. <if test=" null != shopNumber and ''!=shopNumber">
  117. and s.`shop_number` like concat('%', #{shopNumber},'%')
  118. </if>
  119. <if test=" null != buildArea ">
  120. and s.`build_area` like concat('%', #{buildArea},'%')
  121. </if>
  122. <if test=" null != operationArea ">
  123. and s.`operation_area` like concat('%', #{operationArea},'%')
  124. </if>
  125. <if test=" null != building ">
  126. and s.`building`= #{building}
  127. </if>
  128. <if test=" null != floor ">
  129. and s.`floor` = #{floor}
  130. </if>
  131. <if test=" null != status">
  132. and s.`status` = #{status}
  133. </if>
  134. <if test=" null != x ">
  135. and s.`x` = #{x}
  136. </if>
  137. <if test=" null != y ">
  138. and s.`y` = #{y}
  139. </if>
  140. <if test=" null != addr ">
  141. and s.`addr` like concat('%', #{addr},'%')
  142. </if>
  143. <if test=" null != baiduPoi ">
  144. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  145. </if>
  146. <if test=" null != longitude ">
  147. and s.`longitude` = #{longitude}
  148. </if>
  149. <if test=" null != latitude ">
  150. and s.`latitude` = #{latitude}
  151. </if>
  152. <if test=" null != createDate ">
  153. and s.`create_date` = #{createDate}
  154. </if>
  155. <if test=" null != updateDate ">
  156. and s.`update_date` = #{updateDate}
  157. </if>
  158. <if test=" null != manager ">
  159. and s.`manager` = #{manager}
  160. </if>
  161. <if test=" null != managerPhone ">
  162. and s.`manager_phone` = #{managerPhone}
  163. </if>
  164. <if test=" null != ids ">
  165. and s.id in
  166. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  167. #{idItem}
  168. </foreach>
  169. </if>
  170. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  171. </select>
  172. <select id="getbshoplist" resultType="hashmap" parameterType="hashmap">
  173. select id,shop_number shopNumber from wx_shop
  174. where tenant_id=#{tenantId} and shop_number = #{shopNumber}
  175. </select>
  176. <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
  177. select m.`name` merchantName,s.build_area buildArea,s.operation_area operationArea,
  178. c.price,c.receive_period receivePeriod,s.shop_number shopNumber,m.link_person linkPerson,
  179. m.link_phone linkPhone
  180. from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id
  181. inner join wx_shop s on ms.shop_id=s.id
  182. inner join wx_rent_contract c on ms.merchant_id=c.merchant_id
  183. where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0
  184. </select>
  185. <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap">
  186. select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop
  187. where tenant_id=#{tenantId} and status=#{status}
  188. </select>
  189. <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  190. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  191. s.img_url imgUrl,s.operation_area operationArea,
  192. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  193. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone
  194. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  195. left join wx_merchant m on ms.merchant_id=m.id
  196. left join wx_mall_building b on s.building=b.id
  197. left join wx_mall_floor f on s.floor=f.id
  198. where 1=1
  199. and s.tenant_id=#{tenantId}
  200. <if test=" null != status">
  201. and s.`status` = #{status}
  202. </if>
  203. <if test="null!=status and status==1">
  204. and s.id not in(
  205. SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status!=1 and status!=5 and status!=6 and status!=7 and merchant_id is not null
  206. )
  207. </if>
  208. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  209. </select>
  210. </mapper>