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

443 строки
14 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,s.addr
  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="findListWithMerchantMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  189. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  190. s.img_url imgUrl,s.operation_area operationArea,
  191. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  192. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  193. s.type,s.point_type pointType,s.addr,
  194. brand.name brand,m.link_person,m.link_phone,bus.title
  195. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  196. left join wx_merchant m on ms.merchant_id=m.id
  197. left join wx_mall_building b on s.building=b.id
  198. left join wx_mall_floor f on s.floor=f.id
  199. left join wx_business bus on m.business_id = bus.id
  200. left join wx_brand brand on m.brand = brand.id
  201. where 1 = 1
  202. <if test=" null != id ">
  203. and s.`id` = #{id}
  204. </if>
  205. <if test=" null != tenantId ">
  206. and s.`tenant_id`= #{tenantId}
  207. </if>
  208. <if test=" null != shopNumber and ''!=shopNumber">
  209. and s.`shop_number` like concat('%', #{shopNumber},'%')
  210. </if>
  211. <if test=" null != buildArea ">
  212. and s.`build_area` like concat('%', #{buildArea},'%')
  213. </if>
  214. <if test=" null != operationArea ">
  215. and s.`operation_area` like concat('%', #{operationArea},'%')
  216. </if>
  217. <if test=" null != building ">
  218. and s.`building`= #{building}
  219. </if>
  220. <if test=" null != floor ">
  221. and s.`floor` = #{floor}
  222. </if>
  223. <if test=" null != status">
  224. and s.`status` = #{status}
  225. </if>
  226. <if test=" null != x ">
  227. and s.`x` = #{x}
  228. </if>
  229. <if test=" null != y ">
  230. and s.`y` = #{y}
  231. </if>
  232. <if test=" null != addr ">
  233. and s.`addr` like concat('%', #{addr},'%')
  234. </if>
  235. <if test=" null != baiduPoi ">
  236. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  237. </if>
  238. <if test=" null != longitude ">
  239. and s.`longitude` = #{longitude}
  240. </if>
  241. <if test=" null != latitude ">
  242. and s.`latitude` = #{latitude}
  243. </if>
  244. <if test=" null != createDate ">
  245. and s.`create_date` = #{createDate}
  246. </if>
  247. <if test=" null != updateDate ">
  248. and s.`update_date` = #{updateDate}
  249. </if>
  250. <if test=" null != manager ">
  251. and s.`manager` = #{manager}
  252. </if>
  253. <if test=" null != managerPhone ">
  254. and s.`manager_phone` = #{managerPhone}
  255. </if>
  256. <if test=" null != type ">
  257. and s.`type` = #{type}
  258. </if>
  259. <if test=" null != pointType ">
  260. and s.`point_type` = #{pointType}
  261. </if>
  262. <if test=" null != ids ">
  263. and s.id in
  264. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  265. #{idItem}
  266. </foreach>
  267. </if>
  268. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  269. </select>
  270. <select id="getbshoplist" resultType="hashmap" parameterType="hashmap">
  271. select id,shop_number shopNumber from wx_shop
  272. where tenant_id=#{tenantId} and shop_number = #{shopNumber}
  273. </select>
  274. <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
  275. select m.`name` merchantName,s.build_area buildArea,s.operation_area operationArea,
  276. c.price,c.receive_period receivePeriod,s.shop_number shopNumber,m.link_person linkPerson,
  277. m.link_phone linkPhone
  278. from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id
  279. inner join wx_shop s on ms.shop_id=s.id
  280. inner join wx_rent_contract c on ms.merchant_id=c.merchant_id
  281. where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0
  282. </select>
  283. <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap">
  284. select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop
  285. where tenant_id=#{tenantId} and status=#{status}
  286. </select>
  287. <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  288. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  289. s.img_url imgUrl,s.operation_area operationArea,
  290. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  291. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  292. m.brand,m.business_id businessId,m.shop_type shopType
  293. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id
  294. left join wx_merchant m on ms.merchant_id=m.id
  295. left join wx_mall_building b on s.building=b.id
  296. left join wx_mall_floor f on s.floor=f.id
  297. where 1=1 and ms.is_del=0
  298. and s.tenant_id=#{tenantId}
  299. <if test=" null != status">
  300. and s.`status` = #{status}
  301. </if>
  302. <if test="null!=status and status==1">
  303. and s.id not in(
  304. SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status not in(0,1,5,6,7) and
  305. merchant_id is not null
  306. )
  307. </if>
  308. <if test=" null != type ">
  309. and s.`type` = #{type}
  310. </if>
  311. <if test=" null != pointType ">
  312. and s.`point_type` = #{pointType}
  313. </if>
  314. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  315. </select>
  316. <select id="hasShopNumber" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
  317. select count(*) from wx_shop where tenant_id=#{tenantId} and shop_number=#{shopNumber} and `type`=#{type}
  318. <if test=" null != id">
  319. and id != #{id}
  320. </if>
  321. </select>
  322. </mapper>