Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

594 wiersze
20 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. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  28. <result column="freeDay" property="freeDay"/>
  29. </resultMap>
  30. <sql id="allColumns">
  31. `id`,`tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`,
  32. `floor`,`status`,`x`,`y`,`addr`,`baidu_poi`,`longitude`,`latitude`,`create_date`,
  33. `update_date`,`img_url`,`manager`,`manager_phone`,`type`,`point_type`,`comments`,`is_del`,DATEDIFF(now(),create_date) freeDay
  34. </sql>
  35. <sql id="dynamicWhereConditions">
  36. where is_del=0
  37. <if test=" null != id ">
  38. and `id` = #{id}
  39. </if>
  40. <if test=" null != tenantId ">
  41. and `tenant_id` = #{tenantId}
  42. </if>
  43. <if test=" null != shopNumber and ''!=shopNumber">
  44. and `shop_number` like concat('%', #{shopNumber},'%')
  45. </if>
  46. <if test=" null != buildArea ">
  47. and `build_area` like concat('%', #{buildArea},'%')
  48. </if>
  49. <if test=" null != operationArea ">
  50. and `operation_area` like concat('%', #{operationArea},'%')
  51. </if>
  52. <if test=" null != building ">
  53. and `building` like concat('%', #{building},'%')
  54. </if>
  55. <if test=" null != floor ">
  56. and `floor` = #{floor}
  57. </if>
  58. <if test=" null != status ">
  59. and `status` = #{status}
  60. </if>
  61. <if test=" null != x ">
  62. and `x` = #{x}
  63. </if>
  64. <if test=" null != y ">
  65. and `y` = #{y}
  66. </if>
  67. <if test=" null != addr ">
  68. and `addr` like concat('%', #{addr},'%')
  69. </if>
  70. <if test=" null != baiduPoi ">
  71. and `baidu_poi` like concat('%', #{baiduPoi},'%')
  72. </if>
  73. <if test=" null != longitude ">
  74. and `longitude` = #{longitude}
  75. </if>
  76. <if test=" null != latitude ">
  77. and `latitude` = #{latitude}
  78. </if>
  79. <if test=" null != createDate ">
  80. and `create_date` = #{createDate}
  81. </if>
  82. <if test=" null != updateDate ">
  83. and `update_date` = #{updateDate}
  84. </if>
  85. <if test=" null != manager ">
  86. and `manager` = #{manager}
  87. </if>
  88. <if test=" null != managerPhone ">
  89. and `manager_phone` = #{managerPhone}
  90. </if>
  91. <if test=" null != type ">
  92. and `type` = #{type}
  93. </if>
  94. <if test=" null != pointType ">
  95. and `point_type` = #{pointType}
  96. </if>
  97. <if test=" null != ids ">
  98. and id in
  99. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  100. #{idItem}
  101. </foreach>
  102. </if>
  103. <if test=" null != sortColumns">order by ${sortColumns}</if>
  104. </sql>
  105. <select id="findList" parameterType="com.iformall.domain.po.WxShop" resultMap="BaseResultMap">
  106. select
  107. <include refid="allColumns"/>
  108. from wx_shop
  109. <include refid="dynamicWhereConditions"/>
  110. </select>
  111. <select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  112. select s.id,s.shop_number shopNumber,CONVERT(s.build_area,DECIMAL(10,2)) buildArea,
  113. s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,
  114. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  115. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  116. s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay
  117. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  118. left join wx_merchant m on ms.merchant_id=m.id
  119. left join wx_mall_building b on s.building=b.id
  120. left join wx_mall_floor f on s.floor=f.id
  121. where s.is_del=0
  122. <if test=" null != id ">
  123. and s.`id` = #{id}
  124. </if>
  125. <if test=" null != tenantId ">
  126. and s.`tenant_id`= #{tenantId}
  127. </if>
  128. <if test=" null != shopNumber and ''!=shopNumber">
  129. and s.`shop_number` like concat('%', #{shopNumber},'%')
  130. </if>
  131. <if test=" null != buildArea ">
  132. and s.`build_area` like concat('%', #{buildArea},'%')
  133. </if>
  134. <if test=" null != operationArea ">
  135. and s.`operation_area` like concat('%', #{operationArea},'%')
  136. </if>
  137. <if test=" null != building ">
  138. and s.`building`= #{building}
  139. </if>
  140. <if test=" null != floor ">
  141. and s.`floor` = #{floor}
  142. </if>
  143. <if test=" null != status">
  144. and s.`status` = #{status}
  145. </if>
  146. <if test=" null != x ">
  147. and s.`x` = #{x}
  148. </if>
  149. <if test=" null != y ">
  150. and s.`y` = #{y}
  151. </if>
  152. <if test=" null != addr ">
  153. and s.`addr` like concat('%', #{addr},'%')
  154. </if>
  155. <if test=" null != baiduPoi ">
  156. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  157. </if>
  158. <if test=" null != longitude ">
  159. and s.`longitude` = #{longitude}
  160. </if>
  161. <if test=" null != latitude ">
  162. and s.`latitude` = #{latitude}
  163. </if>
  164. <if test=" null != createDate ">
  165. and s.`create_date` = #{createDate}
  166. </if>
  167. <if test=" null != updateDate ">
  168. and s.`update_date` = #{updateDate}
  169. </if>
  170. <if test=" null != manager ">
  171. and s.`manager` = #{manager}
  172. </if>
  173. <if test=" null != managerPhone ">
  174. and s.`manager_phone` = #{managerPhone}
  175. </if>
  176. <if test=" null != type ">
  177. and s.`type` = #{type}
  178. </if>
  179. <if test=" null != pointType ">
  180. and s.`point_type` = #{pointType}
  181. </if>
  182. <if test=" null != ids ">
  183. and s.id in
  184. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  185. #{idItem}
  186. </foreach>
  187. </if>
  188. <if test=" null != sortColumns">order by ${sortColumns}</if>
  189. </select>
  190. <select id="notRentListMapAsPage" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  191. select s.id,s.shop_number shopNumber,CONVERT(s.build_area,SIGNED)buildArea,
  192. s.img_url imgUrl,CONVERT(s.operation_area,SIGNED) operationArea,
  193. s.status,b.building_name building,f.floor_name floor,s.manager,s.manager_phone managerPhone,
  194. s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay
  195. from wx_shop s
  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 s.is_del=0
  199. <if test=" null != id ">
  200. and s.`id` = #{id}
  201. </if>
  202. <if test=" null != tenantId ">
  203. and s.`tenant_id`= #{tenantId}
  204. </if>
  205. <if test=" null != shopNumber and ''!=shopNumber">
  206. and s.`shop_number` like concat('%', #{shopNumber},'%')
  207. </if>
  208. <if test=" null != status">
  209. and s.`status` = #{status}
  210. </if>
  211. <if test=" null != type ">
  212. and s.`type` = #{type}
  213. </if>
  214. <if test=" null != pointType ">
  215. and s.`point_type` = #{pointType}
  216. </if>
  217. <if test="null != sortColumn">
  218. order by ${sortColumn} ${sortOrder}
  219. </if>
  220. <if test="null == sortColumn">
  221. <if test=" null != sortColumns">order by ${sortColumns}</if>
  222. </if>
  223. </select>
  224. <resultMap id="VoResultMap" type="com.iformall.domain.vo.WxShopVo">
  225. <id column="id" jdbcType="BIGINT" property="id"/>
  226. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  227. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  228. <result column="build_area" jdbcType="VARCHAR" property="buildArea"/>
  229. <result column="operation_area" jdbcType="VARCHAR" property="operationArea"/>
  230. <result column="building" jdbcType="BIGINT" property="building"/>
  231. <result column="floor" jdbcType="BIGINT" property="floor"/>
  232. <result column="status" jdbcType="INTEGER" property="status"/>
  233. <result column="x" jdbcType="DECIMAL" property="x"/>
  234. <result column="y" jdbcType="DECIMAL" property="y"/>
  235. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  236. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  237. <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
  238. <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
  239. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  240. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  241. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  242. <result column="manager" jdbcType="VARCHAR" property="manager"/>
  243. <result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
  244. <result column="type" jdbcType="INTEGER" property="type"/>
  245. <result column="point_type" jdbcType="INTEGER" property="pointType"/>
  246. <result column="comments" jdbcType="VARCHAR" property="comments"/>
  247. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  248. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  249. <result column="merchantId" jdbcType="VARCHAR" property="merchantId"/>
  250. <result column="merchantName" jdbcType="VARCHAR" property="merchantName"/>
  251. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  252. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  253. <result column="business" jdbcType="VARCHAR" property="business"/>
  254. <result column="brandName" jdbcType="VARCHAR" property="brandName"/>
  255. </resultMap>
  256. <select id="findListWithMerchantMap" parameterType="com.iformall.domain.vo.WxShopVo" resultMap="VoResultMap">
  257. select
  258. s.id,s.shop_number,s.build_area,s.img_url,s.operation_area,s.status,s.manager,s.manager_phone,s.addr,s.type,s.point_type,
  259. b.building_name,f.floor_name,
  260. m.id merchantId,m.name merchantName,m.link_person,m.link_phone,
  261. brand.name brandName,
  262. bus.title business
  263. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  264. left join wx_merchant m on ms.merchant_id=m.id
  265. left join wx_mall_building b on s.building=b.id
  266. left join wx_mall_floor f on s.floor=f.id
  267. left join wx_business bus on m.business_id = bus.id
  268. left join wx_brand brand on m.brand = brand.id
  269. where s.is_del=0
  270. <if test=" null != id ">
  271. and s.`id` = #{id}
  272. </if>
  273. <if test=" null != tenantId ">
  274. and s.`tenant_id`= #{tenantId}
  275. </if>
  276. <if test=" null != shopNumber and ''!=shopNumber">
  277. and s.`shop_number` like concat('%', #{shopNumber},'%')
  278. </if>
  279. <if test=" null != buildArea ">
  280. and s.`build_area` like concat('%', #{buildArea},'%')
  281. </if>
  282. <if test=" null != operationArea ">
  283. and s.`operation_area` like concat('%', #{operationArea},'%')
  284. </if>
  285. <if test=" null != building ">
  286. and s.`building`= #{building}
  287. </if>
  288. <if test=" null != floor ">
  289. and s.`floor` = #{floor}
  290. </if>
  291. <if test=" null != status">
  292. and s.`status` = #{status}
  293. </if>
  294. <if test=" null != x ">
  295. and s.`x` = #{x}
  296. </if>
  297. <if test=" null != y ">
  298. and s.`y` = #{y}
  299. </if>
  300. <if test=" null != addr ">
  301. and s.`addr` like concat('%', #{addr},'%')
  302. </if>
  303. <if test=" null != baiduPoi ">
  304. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  305. </if>
  306. <if test=" null != longitude ">
  307. and s.`longitude` = #{longitude}
  308. </if>
  309. <if test=" null != latitude ">
  310. and s.`latitude` = #{latitude}
  311. </if>
  312. <if test=" null != createDate ">
  313. and s.`create_date` = #{createDate}
  314. </if>
  315. <if test=" null != updateDate ">
  316. and s.`update_date` = #{updateDate}
  317. </if>
  318. <if test=" null != manager ">
  319. and s.`manager` = #{manager}
  320. </if>
  321. <if test=" null != managerPhone ">
  322. and s.`manager_phone` = #{managerPhone}
  323. </if>
  324. <if test=" null != type ">
  325. and s.`type` = #{type}
  326. </if>
  327. <if test=" null != pointType ">
  328. and s.`point_type` = #{pointType}
  329. </if>
  330. <if test=" null != ids ">
  331. and s.id in
  332. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  333. #{idItem}
  334. </foreach>
  335. </if>
  336. <if test=" null != sortColumns">order by ${sortColumns}</if>
  337. </select>
  338. <select id="getbshoplist" resultType="hashmap" parameterType="hashmap">
  339. select id,shop_number shopNumber from wx_shop
  340. where tenant_id=#{tenantId} and shop_number = #{shopNumber} and is_del=0
  341. </select>
  342. <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
  343. select m.`name` merchantName,s.build_area buildArea,s.operation_area operationArea,
  344. c.price,c.receive_period receivePeriod,s.shop_number shopNumber,m.link_person linkPerson,
  345. m.link_phone linkPhone
  346. from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id
  347. inner join wx_shop s on ms.shop_id=s.id
  348. inner join wx_rent_contract c on ms.merchant_id=c.merchant_id
  349. where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0 and s.is_del=0
  350. </select>
  351. <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap">
  352. select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop
  353. where tenant_id=#{tenantId} and status=#{status} and is_del=0
  354. </select>
  355. <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  356. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  357. s.img_url imgUrl,s.operation_area operationArea,
  358. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  359. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  360. m.brand,m.business_id businessId,m.shop_type shopType
  361. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id
  362. left join wx_merchant m on ms.merchant_id=m.id
  363. left join wx_mall_building b on s.building=b.id
  364. left join wx_mall_floor f on s.floor=f.id
  365. where s.is_del=0 and ms.is_del=0
  366. and s.tenant_id=#{tenantId}
  367. <if test=" null != status">
  368. and s.`status` = #{status}
  369. </if>
  370. <if test="null!=status and status==1 and type!=null and type==2">
  371. and s.id not in(
  372. SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status in(1,2,3,4)
  373. and rent_shop_type=2
  374. )
  375. </if>
  376. <if test=" null != type ">
  377. and s.`type` = #{type}
  378. </if>
  379. <if test=" null != pointType ">
  380. and s.`point_type` = #{pointType}
  381. </if>
  382. <if test=" null != sortColumns">order by ${sortColumns}</if>
  383. </select>
  384. <select id="hasShopNumber" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
  385. select count(*) from wx_shop where tenant_id=#{tenantId} and shop_number=#{shopNumber} and `type`=#{type} and
  386. is_del=0
  387. <if test=" null != id">
  388. and id != #{id}
  389. </if>
  390. </select>
  391. <resultMap id="ShopVoResultMap" type="com.iformall.domain.vo.WxShopVo">
  392. <id column="id" jdbcType="BIGINT" property="id"/>
  393. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  394. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  395. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  396. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  397. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  398. <result column="manager_phone" jdbcType="VARCHAR" property="linkPhone"/>
  399. </resultMap>
  400. <resultMap id="rentRate" type="com.iformall.domain.vo.WxShopRentRateVo">
  401. <result column="xTime" property="xTime"/>
  402. <result column="rate" property="rate"/>
  403. </resultMap>
  404. <select id="findShopVoList" parameterType="java.util.Map" resultMap="ShopVoResultMap">
  405. select s.id,s.shop_number,b.building_name,f.floor_name,s.addr,s.baidu_poi,s.manager_phone
  406. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id
  407. left join wx_merchant m on ms.merchant_id=m.id
  408. left join wx_mall_building b on s.building=b.id
  409. left join wx_mall_floor f on s.floor=f.id
  410. where s.is_del=0 and ms.is_del=0
  411. and m.id=#{merchantId}
  412. </select>
  413. <select id="getCountByWxShop" parameterType="com.iformall.domain.po.WxShop" resultType="Long">
  414. select count(*) from wx_shop w where w.is_del=0
  415. <if test=" null != tenantId ">
  416. and w.`tenant_id`= #{tenantId}
  417. </if>
  418. <if test="null != type">
  419. and `type`=#{type}
  420. </if>
  421. <if test="null != status">
  422. and status = #{status}
  423. </if>
  424. <if test="null != building">
  425. and building = #{building}
  426. </if>
  427. <if test="null != floor">
  428. and floor = #{floor}
  429. </if>
  430. <if test="null != startdate">
  431. and ms.`create_date` >= #{startdate}
  432. </if>
  433. <if test="null != enddate">
  434. and ms.`create_date` &lt;= #{enddate}
  435. </if>
  436. </select>
  437. <select id="rentRateHistory" resultType="hashmap" parameterType="hashmap">
  438. select
  439. <if test="1 == dateType">
  440. DATE_FORMAT(w.create_date,'%Y/%m/%d') xTime
  441. </if>
  442. <if test="2 == dateType">
  443. DATE_FORMAT(w.create_date,'%Y/%m') xTime
  444. </if>
  445. ,count(distinct w.shop_id) xCount
  446. from wx_merchant_shop w left join wx_shop s on w.shop_id=s.id
  447. where w.is_del=0
  448. and w.tenant_id = #{tenantId}
  449. <if test="building!=null">
  450. and s.building=#{building}
  451. </if>
  452. <if test="floor!=null">
  453. and s.floor=#{floor}
  454. </if>
  455. group by xTime
  456. order by xTime
  457. </select>
  458. </mapper>