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.
 
 
 
 
 

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