后台服务
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.

617 lines
22 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 != floorForRule and '' != floorForRule ">
  111. and `floor` in (${floorForRule})
  112. </if>
  113. <if test=" null != ids ">
  114. and id in
  115. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  116. #{idItem}
  117. </foreach>
  118. </if>
  119. <if test=" null != sortColumns">order by ${sortColumns}</if>
  120. </sql>
  121. <select id="findList" parameterType="com.iformall.domain.po.WxShop" resultMap="BaseResultMap">
  122. select
  123. <include refid="allColumns"/>
  124. from wx_shop
  125. <include refid="dynamicWhereConditions"/>
  126. </select>
  127. <select id="findCount" parameterType="com.iformall.domain.po.WxShop" resultType="java.lang.Long">
  128. select count(id)
  129. from wx_shop
  130. <include refid="dynamicWhereConditions"/>
  131. </select>
  132. <select id="findIdList" parameterType="com.iformall.domain.po.WxShop" resultType="Long">
  133. select id
  134. from wx_shop
  135. <include refid="dynamicWhereConditions"/>
  136. </select>
  137. <select id="selectBatchByIds" resultMap="BaseResultMap">
  138. select
  139. s.`id`,s.`tenant_id`,s.`parent_tenant_id`,s.`shop_number`,s.`build_area`,s.`operation_area`,s.building,s.floor,s.`status`,s.`x`,s.`y`,s.`sid`,s.`addr`,
  140. s.`baidu_poi`,s.`longitude`,s.`latitude`,s.`create_date`,s.`update_date`,s.`img_url`,s.`manager`,s.`manager_phone`,
  141. s.`type`,s.`point_type`,s.`comments`,s.`is_del`,DATEDIFF(now(),s.create_date) freeDay,s.rent,s.rent_unit,s.business_id
  142. from wx_shop s
  143. where s.is_del=0
  144. <if test=" null != ids ">
  145. and s.id in
  146. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  147. #{idItem}
  148. </foreach>
  149. </if>
  150. </select>
  151. <select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  152. 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,
  153. s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,s.status,s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,
  154. s.business_id as businessId,s.create_date create_date,s.rent,s.rent_unit,s.building as buildingId,s.floor as floorId,s.manager,s.manager_phone managerPhone
  155. from wx_shop s
  156. where s.is_del=0
  157. <if test=" null != type ">
  158. and s.`type` = #{type}
  159. </if>
  160. <if test=" null != tenantId and '' != tenantId">
  161. and s.`tenant_id` = #{tenantId}
  162. </if>
  163. <if test=" null != parentTenantId and '' != parentTenantId">
  164. and s.`parent_tenant_id` = #{parentTenantId}
  165. </if>
  166. <if test=" null != status">
  167. and s.`status` = #{status}
  168. </if>
  169. <if test=" null != building ">
  170. and s.`building`= #{building}
  171. </if>
  172. <if test=" null != floor ">
  173. and s.`floor` = #{floor}
  174. </if>
  175. <if test=" null != id ">
  176. and s.`id` = #{id}
  177. </if>
  178. <if test=" null != shopNumber and ''!=shopNumber">
  179. and s.`shop_number` like concat('%', #{shopNumber},'%')
  180. </if>
  181. <if test=" null != buildArea ">
  182. and s.`build_area` like concat('%', #{buildArea},'%')
  183. </if>
  184. <if test=" null != operationArea ">
  185. and s.`operation_area` like concat('%', #{operationArea},'%')
  186. </if>
  187. <if test=" null != x ">
  188. and s.`x` = #{x}
  189. </if>
  190. <if test=" null != y ">
  191. and s.`y` = #{y}
  192. </if>
  193. <if test=" null != sid ">
  194. and s.`sid` = #{sid}
  195. </if>
  196. <if test=" null != addr ">
  197. and s.`addr` like concat('%', #{addr},'%')
  198. </if>
  199. <if test=" null != baiduPoi ">
  200. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  201. </if>
  202. <if test=" null != longitude ">
  203. and s.`longitude` = #{longitude}
  204. </if>
  205. <if test=" null != latitude ">
  206. and s.`latitude` = #{latitude}
  207. </if>
  208. <if test=" null != createDate ">
  209. and s.`create_date` = #{createDate}
  210. </if>
  211. <if test=" null != updateDate ">
  212. and s.`update_date` = #{updateDate}
  213. </if>
  214. <if test=" null != manager ">
  215. and s.`manager` = #{manager}
  216. </if>
  217. <if test=" null != managerPhone ">
  218. and s.`manager_phone` = #{managerPhone}
  219. </if>
  220. <if test=" null != pointType ">
  221. and s.`point_type` = #{pointType}
  222. </if>
  223. <if test=" null != ids ">
  224. and s.id in
  225. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  226. #{idItem}
  227. </foreach>
  228. </if>
  229. <if test=" null != sortColumns">order by ${sortColumns}</if>
  230. </select>
  231. <select id="notRentListMapAsPage" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  232. select s.id as id, s.tenant_id tenantId, s.parent_tenant_id parentTenantId, s.shop_number shopNumber,s.build_area buildArea,
  233. s.img_url imgUrl,s.operation_area operationArea,s.status,s.manager,s.manager_phone managerPhone,s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,
  234. s.create_date as createDate,s.building as buildingId,s.floor as floorId
  235. from wx_shop s
  236. where s.is_del=0
  237. <if test=" null != id ">
  238. and s.`id` = #{id}
  239. </if>
  240. <if test=" null != tenantId and '' != tenantId">
  241. and s.`tenant_id` = #{tenantId}
  242. </if>
  243. <if test=" null != parentTenantId and '' != parentTenantId">
  244. and s.`parent_tenant_id` = #{parentTenantId}
  245. </if>
  246. <if test=" null != shopNumber and ''!=shopNumber">
  247. and s.`shop_number` like concat('%', #{shopNumber},'%')
  248. </if>
  249. <if test=" null != status">
  250. and s.`status` = #{status}
  251. </if>
  252. <if test=" null != type ">
  253. and s.`type` = #{type}
  254. </if>
  255. <if test=" null != pointType ">
  256. and s.`point_type` = #{pointType}
  257. </if>
  258. <if test="null != sortColumn">
  259. order by ${sortColumn} ${sortOrder}
  260. </if>
  261. <if test="null == sortColumn">
  262. <if test=" null != sortColumns">order by ${sortColumns}</if>
  263. </if>
  264. </select>
  265. <select id="findListWithMerchantMap" parameterType="com.iformall.domain.vo.WxShopVo" resultMap="BaseResultMap">
  266. select
  267. s.id as 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,
  268. s.create_date,s.building,s.floor
  269. from wx_shop s
  270. where s.is_del=0
  271. <if test=" null != id ">
  272. and s.`id` = #{id}
  273. </if>
  274. <if test=" null != tenantId and '' != tenantId">
  275. and s.`tenant_id` = #{tenantId}
  276. </if>
  277. <if test=" null != parentTenantId and '' != parentTenantId">
  278. and s.`parent_tenant_id` = #{parentTenantId}
  279. </if>
  280. <if test=" null != shopNumber and ''!=shopNumber">
  281. and s.`shop_number` like concat('%', #{shopNumber},'%')
  282. </if>
  283. <if test=" null != buildArea ">
  284. and s.`build_area` like concat('%', #{buildArea},'%')
  285. </if>
  286. <if test=" null != operationArea ">
  287. and s.`operation_area` like concat('%', #{operationArea},'%')
  288. </if>
  289. <if test=" null != building ">
  290. and s.`building`= #{building}
  291. </if>
  292. <if test=" null != floor ">
  293. and s.`floor` = #{floor}
  294. </if>
  295. <if test=" null != status">
  296. and s.`status` = #{status}
  297. </if>
  298. <if test=" null != x ">
  299. and s.`x` = #{x}
  300. </if>
  301. <if test=" null != y ">
  302. and s.`y` = #{y}
  303. </if>
  304. <if test=" null != sid ">
  305. and s.`sid` = #{sid}
  306. </if>
  307. <if test=" null != addr ">
  308. and s.`addr` like concat('%', #{addr},'%')
  309. </if>
  310. <if test=" null != baiduPoi ">
  311. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  312. </if>
  313. <if test=" null != longitude ">
  314. and s.`longitude` = #{longitude}
  315. </if>
  316. <if test=" null != latitude ">
  317. and s.`latitude` = #{latitude}
  318. </if>
  319. <if test=" null != createDate ">
  320. and s.`create_date` = #{createDate}
  321. </if>
  322. <if test=" null != updateDate ">
  323. and s.`update_date` = #{updateDate}
  324. </if>
  325. <if test=" null != manager ">
  326. and s.`manager` = #{manager}
  327. </if>
  328. <if test=" null != managerPhone ">
  329. and s.`manager_phone` = #{managerPhone}
  330. </if>
  331. <if test=" null != type ">
  332. and s.`type` = #{type}
  333. </if>
  334. <if test=" null != pointType ">
  335. and s.`point_type` = #{pointType}
  336. </if>
  337. <if test="null != businessId">
  338. and s.business_id = #{businessId}
  339. </if>
  340. <if test=" null != ids ">
  341. and s.id in
  342. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  343. #{idItem}
  344. </foreach>
  345. </if>
  346. <if test=" null != sortColumns">order by ${sortColumns}</if>
  347. </select>
  348. <select id="getShopList" resultType="hashmap" parameterType="hashmap">
  349. select id,shop_number shopNumber from wx_shop
  350. where shop_number = #{shopNumber} and is_del=0
  351. <if test=" null != tenantId and '' != tenantId">
  352. and `tenant_id` = #{tenantId}
  353. </if>
  354. <if test=" null != parentTenantId and '' != parentTenantId">
  355. and `parent_tenant_id` = #{parentTenantId}
  356. </if>
  357. </select>
  358. <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
  359. select
  360. s.id,s.build_area buildArea,s.operation_area operationArea,s.shop_number shopNumber, s.manager, s.manager_phone managerPhone
  361. from wx_shop s
  362. where s.id = #{id} and s.is_del=0
  363. </select>
  364. <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap">
  365. select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop
  366. where status=#{status} and is_del=0
  367. <if test=" null != tenantId and '' != tenantId">
  368. and `tenant_id` = #{tenantId}
  369. </if>
  370. <if test=" null != parentTenantId and '' != parentTenantId">
  371. and `parent_tenant_id` = #{parentTenantId}
  372. </if>
  373. </select>
  374. <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  375. select s.id id,s.shop_number shopNumber,s.build_area buildArea,s.building as buildingId,s.floor as floorId,
  376. s.img_url imgUrl,s.operation_area operationArea,s.manager,s.manager_phone managerPhone,s.status,s.create_date
  377. from wx_shop s
  378. where s.is_del=0
  379. <if test=" null != tenantId and '' != tenantId">
  380. and s.`tenant_id` = #{tenantId}
  381. </if>
  382. <if test=" null != parentTenantId and '' != parentTenantId">
  383. and s.`parent_tenant_id` = #{parentTenantId}
  384. </if>
  385. <if test=" null != status">
  386. and s.`status` = #{status}
  387. </if>
  388. <if test="null != notInIdList and null!=status and status==1 and type!=null and type==2">
  389. and s.id not in(
  390. <foreach collection="notInIdList" index="index" item="notInIdItem" open="(" separator="," close=")">
  391. #{notInIdItem}
  392. </foreach>
  393. )
  394. </if>
  395. <if test=" null != type ">
  396. and s.`type` = #{type}
  397. </if>
  398. <if test=" null != pointType ">
  399. and s.`point_type` = #{pointType}
  400. </if>
  401. <if test=" null != shopNumber and '' != shopNumber ">
  402. and s.shop_number = #{shopNumber}
  403. </if>
  404. <if test=" null != building and '' != building ">
  405. and b.building_name like concat('%', #{building},'%')
  406. </if>
  407. <if test=" null != merchantName and ''!=merchantName ">
  408. and m.`name` like concat('%', #{merchantName},'%')
  409. </if>
  410. <if test=" null != sortColumns">order by ${sortColumns}</if>
  411. </select>
  412. <select id="hasShopNumber" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
  413. select count(1) from wx_shop where shop_number=#{shopNumber} and `type`=#{type}
  414. and is_del=0
  415. <if test=" null != tenantId and '' != tenantId">
  416. and `tenant_id` = #{tenantId}
  417. </if>
  418. <if test=" null != parentTenantId and '' != parentTenantId">
  419. and `parent_tenant_id` = #{parentTenantId}
  420. </if>
  421. <if test=" null != id">
  422. and id != #{id}
  423. </if>
  424. </select>
  425. <select id="hasShopSid" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
  426. select count(1) from wx_shop where sid=#{sid}
  427. and is_del=0
  428. <if test=" null != tenantId and '' != tenantId">
  429. and `tenant_id` = #{tenantId}
  430. </if>
  431. <if test=" null != parentTenantId and '' != parentTenantId">
  432. and `parent_tenant_id` = #{parentTenantId}
  433. </if>
  434. <if test=" null != id">
  435. and id != #{id}
  436. </if>
  437. </select>
  438. <resultMap id="rentRate" type="com.iformall.domain.vo.WxShopRentRateVo">
  439. <result column="xTime" property="xTime"/>
  440. <result column="rate" property="rate"/>
  441. </resultMap>
  442. <select id="getCountByWxShop" parameterType="com.iformall.domain.po.WxShop" resultType="Long">
  443. select count(1) from wx_shop w where w.is_del=0
  444. <if test=" null != tenantId and '' != tenantId">
  445. and `tenant_id` = #{tenantId}
  446. </if>
  447. <if test=" null != parentTenantId and '' != parentTenantId">
  448. and `parent_tenant_id` = #{parentTenantId}
  449. </if>
  450. <if test="null != type">
  451. and `type`=#{type}
  452. </if>
  453. <if test="null != status">
  454. and status = #{status}
  455. </if>
  456. <if test="null != building">
  457. and building = #{building}
  458. </if>
  459. <if test="null != floor">
  460. and floor = #{floor}
  461. </if>
  462. <if test="null != startdate">
  463. and `create_date` >= #{startdate}
  464. </if>
  465. <if test="null != enddate">
  466. and `create_date` &lt;= #{enddate}
  467. </if>
  468. <if test="null != businessId and businessId!=0">
  469. and business_id = #{businessId}
  470. </if>
  471. </select>
  472. <update id="updateUnRentByIds" parameterType="Long">
  473. update wx_shop set status = 0
  474. where id in
  475. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  476. #{idItem}
  477. </foreach>
  478. </update>
  479. <select id="detailById" parameterType="Long" resultType="hashmap">
  480. 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,
  481. s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,
  482. s.status,s.manager,s.manager_phone managerPhone,
  483. s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,s.rent,s.rent_unit,s.business_id as businessId,s.create_date,
  484. s.building as buildingId,s.floor as floorId
  485. from wx_shop s where s.`id` = #{id}
  486. </select>
  487. <select id="detailBySid" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  488. select
  489. s.id id, s.tenant_id tenantId, s.parent_tenant_id parentTenantId, s.shop_number shopNumber,
  490. CONVERT(s.build_area,DECIMAL(10,2)) buildArea,
  491. s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea,
  492. s.status,s.manager,s.manager_phone managerPhone,s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,s.rent,s.rent_unit,
  493. s.business_id as businessId,s.create_date,s.building as buildingId,s.floor as floorId
  494. from wx_shop s where s.`is_del` = 0 and s.`sid` = #{sid}
  495. <if test=" null != tenantId and '' != tenantId">
  496. and s.`tenant_id` = #{tenantId}
  497. </if>
  498. <if test=" null != parentTenantId and '' != parentTenantId">
  499. and s.`parent_tenant_id` = #{parentTenantId}
  500. </if>
  501. </select>
  502. <select id="newFindShopVoList" parameterType="java.util.Map" resultType="com.iformall.domain.vo.WxShopVo">
  503. select id,shop_number shopNumber,img_url imgUrl,addr,building,floor,baidu_poi baiduPoi,manager_phone linkPhone,manager linkPerson
  504. from wx_shop
  505. where is_del=0
  506. <if test=" null != tenantId and '' != tenantId">
  507. and `tenant_id` = #{tenantId}
  508. </if>
  509. <if test=" null != shopIds ">
  510. and id in
  511. <foreach collection="shopIds" index="index" item="idItem" open="(" separator="," close=")">
  512. #{idItem}
  513. </foreach>
  514. </if>
  515. </select>
  516. </mapper>