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

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