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.
 
 
 
 
 

734 wiersze
28 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="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  9. <result column="build_area" jdbcType="VARCHAR" property="buildArea"/>
  10. <result column="operation_area" jdbcType="VARCHAR" property="operationArea"/>
  11. <result column="building" jdbcType="BIGINT" property="building"/>
  12. <result column="floor" jdbcType="BIGINT" property="floor"/>
  13. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  14. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  15. <result column="status" jdbcType="INTEGER" property="status"/>
  16. <result column="x" jdbcType="DECIMAL" property="x"/>
  17. <result column="y" jdbcType="DECIMAL" property="y"/>
  18. <result column="sid" jdbcType="VARCHAR" property="sid"/>
  19. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  20. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  21. <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
  22. <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
  23. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  24. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  25. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  26. <result column="manager" jdbcType="VARCHAR" property="manager"/>
  27. <result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
  28. <result column="type" jdbcType="INTEGER" property="type"/>
  29. <result column="point_type" jdbcType="INTEGER" property="pointType"/>
  30. <result column="comments" jdbcType="VARCHAR" property="comments"/>
  31. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  32. <result column="freeDay" property="freeDay"/>
  33. <result column="rent" property="rent"/>
  34. <result column="rent_unit" property="rentUnit"/>
  35. <result column="business_id" property="businessId"/>
  36. </resultMap>
  37. <sql id="allColumns">
  38. `id`,`tenant_id`,`parent_tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`,`floor`,`status`,`x`,`y`,`sid`,`addr`,
  39. `baidu_poi`,`longitude`,`latitude`,`create_date`,`update_date`,`img_url`,`manager`,`manager_phone`,
  40. `type`,`point_type`,`comments`,`is_del`,DATEDIFF(now(),create_date) freeDay,rent,rent_unit,business_id
  41. </sql>
  42. <sql id="dynamicWhereConditions">
  43. where is_del=0
  44. <if test=" null != id ">
  45. and `id` = #{id}
  46. </if>
  47. <if test=" null != tenantId and '' != tenantId">
  48. and `tenant_id` = #{tenantId}
  49. </if>
  50. <if test=" null != parentTenantId and '' != parentTenantId">
  51. and `parent_tenant_id` = #{parentTenantId}
  52. </if>
  53. <if test=" null != shopNumber and ''!=shopNumber">
  54. and `shop_number` like concat('%', #{shopNumber},'%')
  55. </if>
  56. <if test=" null != buildArea ">
  57. and `build_area` like concat('%', #{buildArea},'%')
  58. </if>
  59. <if test=" null != operationArea ">
  60. and `operation_area` like concat('%', #{operationArea},'%')
  61. </if>
  62. <if test=" null != building ">
  63. and `building` like concat('%', #{building},'%')
  64. </if>
  65. <if test=" null != floor ">
  66. and `floor` = #{floor}
  67. </if>
  68. <if test=" null != status ">
  69. and `status` = #{status}
  70. </if>
  71. <if test=" null != x ">
  72. and `x` = #{x}
  73. </if>
  74. <if test=" null != y ">
  75. and `y` = #{y}
  76. </if>
  77. <if test=" null != sid ">
  78. and `sid` = #{sid}
  79. </if>
  80. <if test=" null != addr ">
  81. and `addr` like concat('%', #{addr},'%')
  82. </if>
  83. <if test=" null != baiduPoi ">
  84. and `baidu_poi` like concat('%', #{baiduPoi},'%')
  85. </if>
  86. <if test=" null != longitude ">
  87. and `longitude` = #{longitude}
  88. </if>
  89. <if test=" null != latitude ">
  90. and `latitude` = #{latitude}
  91. </if>
  92. <if test=" null != createDate ">
  93. and `create_date` = #{createDate}
  94. </if>
  95. <if test=" null != updateDate ">
  96. and `update_date` = #{updateDate}
  97. </if>
  98. <if test=" null != manager ">
  99. and `manager` = #{manager}
  100. </if>
  101. <if test=" null != managerPhone ">
  102. and `manager_phone` = #{managerPhone}
  103. </if>
  104. <if test=" null != type ">
  105. and `type` = #{type}
  106. </if>
  107. <if test=" null != pointType ">
  108. and `point_type` = #{pointType}
  109. </if>
  110. <if test=" null != ids ">
  111. and id in
  112. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  113. #{idItem}
  114. </foreach>
  115. </if>
  116. <if test=" null != sortColumns">order by ${sortColumns}</if>
  117. </sql>
  118. <select id="findList" parameterType="com.iformall.domain.po.WxShop" resultMap="BaseResultMap">
  119. select
  120. <include refid="allColumns"/>
  121. from wx_shop
  122. <include refid="dynamicWhereConditions"/>
  123. </select>
  124. <select id="findIdList" parameterType="com.iformall.domain.po.WxShop" resultType="Long">
  125. select id
  126. from wx_shop
  127. <include refid="dynamicWhereConditions"/>
  128. </select>
  129. <select id="selectBatchByIds" resultMap="BaseResultMap">
  130. select
  131. s.`id`,s.`tenant_id`,s.`parent_tenant_id`,s.`shop_number`,s.`build_area`,s.`operation_area`,s.building,b.building_name building_name,s.floor,f.floor_name floor_name,s.`status`,s.`x`,s.`y`,s.`sid`,s.`addr`,
  132. s.`baidu_poi`,s.`longitude`,s.`latitude`,s.`create_date`,s.`update_date`,s.`img_url`,s.`manager`,s.`manager_phone`,
  133. s.`type`,s.`point_type`,s.`comments`,s.`is_del`,DATEDIFF(now(),s.create_date) freeDay,s.rent,s.rent_unit,s.business_id
  134. from wx_shop s
  135. left join wx_mall_building b on s.building=b.id
  136. left join wx_mall_floor f on s.floor=f.id
  137. where s.is_del=0
  138. <if test=" null != ids ">
  139. and s.id in
  140. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  141. #{idItem}
  142. </foreach>
  143. </if>
  144. </select>
  145. <select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  146. select s.id id, s.tenant_id tenantId, s.parent_tenant_id parentTenantId, s.shop_number shopNumber,CONVERT(s.build_area,DECIMAL(10,2)) buildArea,
  147. s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,
  148. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  149. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  150. s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,rent,rent_unit,s.business_id as
  151. businessId,s.create_date create_date
  152. from wx_shop s
  153. left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  154. left join wx_merchant m on ms.merchant_id=m.id
  155. left join wx_mall_building b on s.building=b.id
  156. left join wx_mall_floor f on s.floor=f.id
  157. where s.is_del=0
  158. <if test=" null != type ">
  159. and s.`type` = #{type}
  160. </if>
  161. <if test=" null != tenantId and '' != tenantId">
  162. and s.`tenant_id` = #{tenantId}
  163. </if>
  164. <if test=" null != parentTenantId and '' != parentTenantId">
  165. and s.`parent_tenant_id` = #{parentTenantId}
  166. </if>
  167. <if test=" null != status">
  168. and s.`status` = #{status}
  169. </if>
  170. <if test=" null != building ">
  171. and s.`building`= #{building}
  172. </if>
  173. <if test=" null != floor ">
  174. and s.`floor` = #{floor}
  175. </if>
  176. <if test=" null != id ">
  177. and s.`id` = #{id}
  178. </if>
  179. <if test=" null != shopNumber and ''!=shopNumber">
  180. and s.`shop_number` like concat('%', #{shopNumber},'%')
  181. </if>
  182. <if test=" null != buildArea ">
  183. and s.`build_area` like concat('%', #{buildArea},'%')
  184. </if>
  185. <if test=" null != operationArea ">
  186. and s.`operation_area` like concat('%', #{operationArea},'%')
  187. </if>
  188. <if test=" null != x ">
  189. and s.`x` = #{x}
  190. </if>
  191. <if test=" null != y ">
  192. and s.`y` = #{y}
  193. </if>
  194. <if test=" null != sid ">
  195. and s.`sid` = #{sid}
  196. </if>
  197. <if test=" null != addr ">
  198. and s.`addr` like concat('%', #{addr},'%')
  199. </if>
  200. <if test=" null != baiduPoi ">
  201. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  202. </if>
  203. <if test=" null != longitude ">
  204. and s.`longitude` = #{longitude}
  205. </if>
  206. <if test=" null != latitude ">
  207. and s.`latitude` = #{latitude}
  208. </if>
  209. <if test=" null != createDate ">
  210. and s.`create_date` = #{createDate}
  211. </if>
  212. <if test=" null != updateDate ">
  213. and s.`update_date` = #{updateDate}
  214. </if>
  215. <if test=" null != manager ">
  216. and s.`manager` = #{manager}
  217. </if>
  218. <if test=" null != managerPhone ">
  219. and s.`manager_phone` = #{managerPhone}
  220. </if>
  221. <if test=" null != pointType ">
  222. and s.`point_type` = #{pointType}
  223. </if>
  224. <if test=" null != ids ">
  225. and s.id in
  226. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  227. #{idItem}
  228. </foreach>
  229. </if>
  230. <if test=" null != sortColumns">order by ${sortColumns}</if>
  231. </select>
  232. <select id="notRentListMapAsPage" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  233. select s.id as id, s.tenant_id tenantId, s.parent_tenant_id parentTenantId, s.shop_number shopNumber,s.build_area buildArea,
  234. s.img_url imgUrl,s.operation_area operationArea,
  235. s.status,b.building_name building,f.floor_name floor,s.manager,s.manager_phone managerPhone,
  236. s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,s.create_date as createDate
  237. from wx_shop s
  238. left join wx_mall_building b on s.building=b.id
  239. left join wx_mall_floor f on s.floor=f.id
  240. where s.is_del=0
  241. <if test=" null != id ">
  242. and s.`id` = #{id}
  243. </if>
  244. <if test=" null != tenantId and '' != tenantId">
  245. and s.`tenant_id` = #{tenantId}
  246. </if>
  247. <if test=" null != parentTenantId and '' != parentTenantId">
  248. and s.`parent_tenant_id` = #{parentTenantId}
  249. </if>
  250. <if test=" null != shopNumber and ''!=shopNumber">
  251. and s.`shop_number` like concat('%', #{shopNumber},'%')
  252. </if>
  253. <if test=" null != status">
  254. and s.`status` = #{status}
  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 != sortColumn">
  263. order by ${sortColumn} ${sortOrder}
  264. </if>
  265. <if test="null == sortColumn">
  266. <if test=" null != sortColumns">order by ${sortColumns}</if>
  267. </if>
  268. </select>
  269. <resultMap id="VoResultMap" type="com.iformall.domain.vo.WxShopVo">
  270. <id column="id" jdbcType="BIGINT" property="id"/>
  271. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  272. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  273. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  274. <result column="build_area" jdbcType="VARCHAR" property="buildArea"/>
  275. <result column="operation_area" jdbcType="VARCHAR" property="operationArea"/>
  276. <result column="building" jdbcType="BIGINT" property="building"/>
  277. <result column="floor" jdbcType="BIGINT" property="floor"/>
  278. <result column="status" jdbcType="INTEGER" property="status"/>
  279. <result column="x" jdbcType="DECIMAL" property="x"/>
  280. <result column="y" jdbcType="DECIMAL" property="y"/>
  281. <result column="sid" jdbcType="VARCHAR" property="sid"/>
  282. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  283. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  284. <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
  285. <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
  286. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  287. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  288. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  289. <result column="manager" jdbcType="VARCHAR" property="manager"/>
  290. <result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
  291. <result column="type" jdbcType="INTEGER" property="type"/>
  292. <result column="point_type" jdbcType="INTEGER" property="pointType"/>
  293. <result column="comments" jdbcType="VARCHAR" property="comments"/>
  294. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  295. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  296. <result column="merchantId" jdbcType="VARCHAR" property="merchantId"/>
  297. <result column="merchantName" jdbcType="VARCHAR" property="merchantName"/>
  298. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  299. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  300. <result column="business" jdbcType="VARCHAR" property="business"/>
  301. <result column="brandName" jdbcType="VARCHAR" property="brandName"/>
  302. </resultMap>
  303. <select id="findListWithMerchantMap" parameterType="com.iformall.domain.vo.WxShopVo" resultMap="VoResultMap">
  304. select
  305. s.id as
  306. 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,
  307. b.building_name,f.floor_name,
  308. m.id merchantId,m.name merchantName,m.link_person,m.link_phone,
  309. brand.name brandName,
  310. bus.title business,s.create_date as create_date
  311. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  312. left join wx_merchant m on ms.merchant_id=m.id
  313. left join wx_mall_building b on s.building=b.id
  314. left join wx_mall_floor f on s.floor=f.id
  315. left join wx_business bus on m.business_id = bus.id
  316. left join wx_brand brand on m.brand = brand.id
  317. where s.is_del=0
  318. <if test=" null != id ">
  319. and s.`id` = #{id}
  320. </if>
  321. <if test=" null != tenantId and '' != tenantId">
  322. and s.`tenant_id` = #{tenantId}
  323. </if>
  324. <if test=" null != parentTenantId and '' != parentTenantId">
  325. and s.`parent_tenant_id` = #{parentTenantId}
  326. </if>
  327. <if test=" null != shopNumber and ''!=shopNumber">
  328. and s.`shop_number` like concat('%', #{shopNumber},'%')
  329. </if>
  330. <if test=" null != buildArea ">
  331. and s.`build_area` like concat('%', #{buildArea},'%')
  332. </if>
  333. <if test=" null != operationArea ">
  334. and s.`operation_area` like concat('%', #{operationArea},'%')
  335. </if>
  336. <if test=" null != building ">
  337. and s.`building`= #{building}
  338. </if>
  339. <if test=" null != floor ">
  340. and s.`floor` = #{floor}
  341. </if>
  342. <if test=" null != status">
  343. and s.`status` = #{status}
  344. </if>
  345. <if test=" null != x ">
  346. and s.`x` = #{x}
  347. </if>
  348. <if test=" null != y ">
  349. and s.`y` = #{y}
  350. </if>
  351. <if test=" null != sid ">
  352. and s.`sid` = #{sid}
  353. </if>
  354. <if test=" null != addr ">
  355. and s.`addr` like concat('%', #{addr},'%')
  356. </if>
  357. <if test=" null != baiduPoi ">
  358. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  359. </if>
  360. <if test=" null != longitude ">
  361. and s.`longitude` = #{longitude}
  362. </if>
  363. <if test=" null != latitude ">
  364. and s.`latitude` = #{latitude}
  365. </if>
  366. <if test=" null != createDate ">
  367. and s.`create_date` = #{createDate}
  368. </if>
  369. <if test=" null != updateDate ">
  370. and s.`update_date` = #{updateDate}
  371. </if>
  372. <if test=" null != manager ">
  373. and s.`manager` = #{manager}
  374. </if>
  375. <if test=" null != managerPhone ">
  376. and s.`manager_phone` = #{managerPhone}
  377. </if>
  378. <if test=" null != type ">
  379. and s.`type` = #{type}
  380. </if>
  381. <if test=" null != pointType ">
  382. and s.`point_type` = #{pointType}
  383. </if>
  384. <if test="null != businessId">
  385. and s.business_id = #{businessId}
  386. </if>
  387. <if test=" null != ids ">
  388. and s.id in
  389. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  390. #{idItem}
  391. </foreach>
  392. </if>
  393. <if test=" null != sortColumns">order by ${sortColumns}</if>
  394. </select>
  395. <select id="getShopList" resultType="hashmap" parameterType="hashmap">
  396. select id,shop_number shopNumber from wx_shop
  397. where shop_number = #{shopNumber} and is_del=0
  398. <if test=" null != tenantId and '' != tenantId">
  399. and `tenant_id` = #{tenantId}
  400. </if>
  401. <if test=" null != parentTenantId and '' != parentTenantId">
  402. and `parent_tenant_id` = #{parentTenantId}
  403. </if>
  404. </select>
  405. <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
  406. select m.`name` merchantName,s.build_area buildArea,s.operation_area operationArea,
  407. c.price,c.receive_period receivePeriod,s.shop_number shopNumber,m.link_person linkPerson,
  408. m.link_phone linkPhone
  409. from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id
  410. inner join wx_shop s on ms.shop_id=s.id
  411. inner join wx_rent_contract c on ms.merchant_id=c.merchant_id
  412. where ms.shop_id=#{shopId} and ms.is_del=0 and s.is_del=0
  413. <if test=" null != tenantId and '' != tenantId">
  414. and ms.`tenant_id` = #{tenantId}
  415. </if>
  416. <if test=" null != parentTenantId and '' != parentTenantId">
  417. and ms.`parent_tenant_id` = #{parentTenantId}
  418. </if>
  419. </select>
  420. <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap">
  421. select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop
  422. where status=#{status} and is_del=0
  423. <if test=" null != tenantId and '' != tenantId">
  424. and `tenant_id` = #{tenantId}
  425. </if>
  426. <if test=" null != parentTenantId and '' != parentTenantId">
  427. and `parent_tenant_id` = #{parentTenantId}
  428. </if>
  429. </select>
  430. <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  431. select s.id id,s.shop_number shopNumber,s.build_area buildArea,
  432. s.img_url imgUrl,s.operation_area operationArea,
  433. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  434. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  435. m.brand,m.business_id businessId,m.shop_type shopType,s.create_date create_date
  436. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id
  437. left join wx_merchant m on ms.merchant_id=m.id
  438. left join wx_mall_building b on s.building=b.id
  439. left join wx_mall_floor f on s.floor=f.id
  440. where s.is_del=0 and ms.is_del=0
  441. <if test=" null != tenantId and '' != tenantId">
  442. and s.`tenant_id` = #{tenantId}
  443. </if>
  444. <if test=" null != parentTenantId and '' != parentTenantId">
  445. and s.`parent_tenant_id` = #{parentTenantId}
  446. </if>
  447. <if test=" null != status">
  448. and s.`status` = #{status}
  449. </if>
  450. <if test="null!=status and status==1 and type!=null and type==2">
  451. and s.id not in(
  452. SELECT shop_id FROM wx_rent_contract WHERE status in(1,2,3,4,8)
  453. and rent_shop_type=2
  454. <if test=" null != tenantId and '' != tenantId">
  455. and `tenant_id` = #{tenantId}
  456. </if>
  457. <if test=" null != parentTenantId and '' != parentTenantId">
  458. and `parent_tenant_id` = #{parentTenantId}
  459. </if>
  460. )
  461. </if>
  462. <if test=" null != type ">
  463. and s.`type` = #{type}
  464. </if>
  465. <if test=" null != pointType ">
  466. and s.`point_type` = #{pointType}
  467. </if>
  468. <if test=" null != shopNumber and '' != shopNumber ">
  469. and s.shop_number = #{shopNumber}
  470. </if>
  471. <if test=" null != building and '' != building ">
  472. and b.building_name like concat('%', #{building},'%')
  473. </if>
  474. <if test=" null != merchantName and ''!=merchantName ">
  475. and m.`name` like concat('%', #{merchantName},'%')
  476. </if>
  477. <if test=" null != sortColumns">order by ${sortColumns}</if>
  478. </select>
  479. <select id="hasShopNumber" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
  480. select count(*) from wx_shop where shop_number=#{shopNumber} and `type`=#{type}
  481. and is_del=0
  482. <if test=" null != tenantId and '' != tenantId">
  483. and `tenant_id` = #{tenantId}
  484. </if>
  485. <if test=" null != parentTenantId and '' != parentTenantId">
  486. and `parent_tenant_id` = #{parentTenantId}
  487. </if>
  488. <if test=" null != id">
  489. and id != #{id}
  490. </if>
  491. </select>
  492. <select id="hasShopSid" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
  493. select count(*) from wx_shop where sid=#{sid}
  494. and is_del=0
  495. <if test=" null != tenantId and '' != tenantId">
  496. and `tenant_id` = #{tenantId}
  497. </if>
  498. <if test=" null != parentTenantId and '' != parentTenantId">
  499. and `parent_tenant_id` = #{parentTenantId}
  500. </if>
  501. <if test=" null != id">
  502. and id != #{id}
  503. </if>
  504. </select>
  505. <resultMap id="ShopVoResultMap" type="com.iformall.domain.vo.WxShopVo">
  506. <id column="id" jdbcType="BIGINT" property="id"/>
  507. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  508. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  509. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  510. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  511. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  512. <result column="manager_phone" jdbcType="VARCHAR" property="linkPhone"/>
  513. <result column="manager" jdbcType="VARCHAR" property="linkPerson"/>
  514. </resultMap>
  515. <resultMap id="rentRate" type="com.iformall.domain.vo.WxShopRentRateVo">
  516. <result column="xTime" property="xTime"/>
  517. <result column="rate" property="rate"/>
  518. </resultMap>
  519. <select id="findShopVoList" parameterType="java.util.Map" resultMap="ShopVoResultMap">
  520. select s.id,s.shop_number,b.building_name,f.floor_name,s.addr,s.baidu_poi,s.manager_phone,s.manager
  521. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id
  522. left join wx_merchant m on ms.merchant_id=m.id
  523. left join wx_mall_building b on s.building=b.id
  524. left join wx_mall_floor f on s.floor=f.id
  525. where s.is_del=0 and ms.is_del=0
  526. and m.id=#{merchantId}
  527. </select>
  528. <select id="getCountByWxShop" parameterType="com.iformall.domain.po.WxShop" resultType="Long">
  529. select count(*) from wx_shop w where w.is_del=0
  530. <if test=" null != tenantId and '' != tenantId">
  531. and `tenant_id` = #{tenantId}
  532. </if>
  533. <if test=" null != parentTenantId and '' != parentTenantId">
  534. and `parent_tenant_id` = #{parentTenantId}
  535. </if>
  536. <if test="null != type">
  537. and `type`=#{type}
  538. </if>
  539. <if test="null != status">
  540. and status = #{status}
  541. </if>
  542. <if test="null != building">
  543. and building = #{building}
  544. </if>
  545. <if test="null != floor">
  546. and floor = #{floor}
  547. </if>
  548. <if test="null != startdate">
  549. and `create_date` >= #{startdate}
  550. </if>
  551. <if test="null != enddate">
  552. and `create_date` &lt;= #{enddate}
  553. </if>
  554. <if test="null != businessId and businessId!=0">
  555. and business_id = #{businessId}
  556. </if>
  557. </select>
  558. <select id="rentRateHistory" resultType="hashmap" parameterType="hashmap">
  559. select
  560. <if test="1 == dateType">
  561. DATE_FORMAT(w.create_date,'%Y/%m/%d') xTime
  562. </if>
  563. <if test="2 == dateType">
  564. DATE_FORMAT(w.create_date,'%Y/%m') xTime
  565. </if>
  566. ,count(distinct w.shop_id) xCount
  567. from wx_merchant_shop w left join wx_shop s on w.shop_id=s.id
  568. where w.is_del=0 and s.is_del=0
  569. <if test=" null != tenantId and '' != tenantId">
  570. and w.`tenant_id` = #{tenantId}
  571. </if>
  572. <if test=" null != parentTenantId and '' != parentTenantId">
  573. and w.`parent_tenant_id` = #{parentTenantId}
  574. </if>
  575. <if test="building!=null">
  576. and s.building=#{building}
  577. </if>
  578. <if test="floor!=null">
  579. and s.floor=#{floor}
  580. </if>
  581. <if test="businessId!=null and businessId!=0">
  582. and s.business_id=#{businessId}
  583. </if>
  584. group by xTime
  585. order by xTime
  586. </select>
  587. <update id="updateUnRentByIds" parameterType="Long">
  588. update wx_shop set status = 0
  589. where id in
  590. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  591. #{idItem}
  592. </foreach>
  593. </update>
  594. <select id="detailById" parameterType="Long" resultType="hashmap">
  595. select s.id id, s.tenant_id tenantId, s.parent_tenant_id parentTenantId, s.shop_number shopNumber,CONVERT(s.build_area,DECIMAL(10,2)) buildArea,
  596. s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,
  597. s.status,b.building_name building,f.floor_name floor,s.manager,s.manager_phone managerPhone,
  598. s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,rent,rent_unit,s.business_id as
  599. businessId,bu.title businessName,s.create_date create_date
  600. from wx_shop s
  601. left join wx_mall_building b on s.building=b.id
  602. left join wx_mall_floor f on s.floor=f.id
  603. left join wx_business bu on s.business_id = bu.id
  604. where s.`id` = #{id}
  605. </select>
  606. <select id="detailBySid" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  607. select
  608. s.id id, s.tenant_id tenantId, s.parent_tenant_id parentTenantId, s.shop_number shopNumber,
  609. CONVERT(s.build_area,DECIMAL(10,2)) buildArea,
  610. s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,
  611. s.status,b.building_name building,f.floor_name floor,s.manager,s.manager_phone managerPhone,
  612. s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,rent,rent_unit,
  613. s.business_id as businessId,bu.title businessName,s.create_date create_date
  614. from wx_shop s
  615. left join wx_mall_building b on s.building=b.id
  616. left join wx_mall_floor f on s.floor=f.id
  617. left join wx_business bu on s.business_id = bu.id
  618. where s.`is_del` = 0 and s.`sid` = #{sid}
  619. <if test=" null != tenantId and '' != tenantId">
  620. and s.`tenant_id` = #{tenantId}
  621. </if>
  622. <if test=" null != parentTenantId and '' != parentTenantId">
  623. and s.`parent_tenant_id` = #{parentTenantId}
  624. </if>
  625. </select>
  626. </mapper>