Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

565 linhas
19 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,s.build_area buildArea,
  113. s.img_url imgUrl,s.operation_area 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 != sortColumn">
  189. order by s.${sortColumn} ${sortOrder}
  190. </if>
  191. <if test="null == sortColumn">
  192. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  193. </if>
  194. </select>
  195. <select id="notRentListMapAsPage" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  196. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  197. s.img_url imgUrl,s.operation_area operationArea,
  198. s.status,b.building_name building,f.floor_name floor,s.manager,s.manager_phone managerPhone,
  199. s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay
  200. from wx_shop s
  201. left join wx_mall_building b on s.building=b.id
  202. left join wx_mall_floor f on s.floor=f.id
  203. where s.is_del=0
  204. <if test=" null != id ">
  205. and s.`id` = #{id}
  206. </if>
  207. <if test=" null != tenantId ">
  208. and s.`tenant_id`= #{tenantId}
  209. </if>
  210. <if test=" null != shopNumber and ''!=shopNumber">
  211. and s.`shop_number` like concat('%', #{shopNumber},'%')
  212. </if>
  213. <if test=" null != status">
  214. and s.`status` = #{status}
  215. </if>
  216. <if test=" null != type ">
  217. and s.`type` = #{type}
  218. </if>
  219. <if test=" null != pointType ">
  220. and s.`point_type` = #{pointType}
  221. </if>
  222. <if test="null != sortColumn">
  223. order by s.${sortColumn} ${sortOrder}
  224. </if>
  225. <if test="null == sortColumn">
  226. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  227. </if>
  228. </select>
  229. <resultMap id="VoResultMap" type="com.iformall.domain.vo.WxShopVo">
  230. <id column="id" jdbcType="BIGINT" property="id"/>
  231. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  232. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  233. <result column="build_area" jdbcType="VARCHAR" property="buildArea"/>
  234. <result column="operation_area" jdbcType="VARCHAR" property="operationArea"/>
  235. <result column="building" jdbcType="BIGINT" property="building"/>
  236. <result column="floor" jdbcType="BIGINT" property="floor"/>
  237. <result column="status" jdbcType="INTEGER" property="status"/>
  238. <result column="x" jdbcType="DECIMAL" property="x"/>
  239. <result column="y" jdbcType="DECIMAL" property="y"/>
  240. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  241. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  242. <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
  243. <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
  244. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  245. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  246. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  247. <result column="manager" jdbcType="VARCHAR" property="manager"/>
  248. <result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
  249. <result column="type" jdbcType="INTEGER" property="type"/>
  250. <result column="point_type" jdbcType="INTEGER" property="pointType"/>
  251. <result column="comments" jdbcType="VARCHAR" property="comments"/>
  252. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  253. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  254. <result column="merchantId" jdbcType="VARCHAR" property="merchantId"/>
  255. <result column="merchantName" jdbcType="VARCHAR" property="merchantName"/>
  256. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  257. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  258. <result column="business" jdbcType="VARCHAR" property="business"/>
  259. <result column="brandName" jdbcType="VARCHAR" property="brandName"/>
  260. </resultMap>
  261. <select id="findListWithMerchantMap" parameterType="com.iformall.domain.vo.WxShopVo" resultMap="VoResultMap">
  262. select
  263. 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,
  264. b.building_name,f.floor_name,
  265. m.id merchantId,m.name merchantName,m.link_person,m.link_phone,
  266. brand.name brandName,
  267. bus.title business
  268. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  269. left join wx_merchant m on ms.merchant_id=m.id
  270. left join wx_mall_building b on s.building=b.id
  271. left join wx_mall_floor f on s.floor=f.id
  272. left join wx_business bus on m.business_id = bus.id
  273. left join wx_brand brand on m.brand = brand.id
  274. where s.is_del=0
  275. <if test=" null != id ">
  276. and s.`id` = #{id}
  277. </if>
  278. <if test=" null != tenantId ">
  279. and s.`tenant_id`= #{tenantId}
  280. </if>
  281. <if test=" null != shopNumber and ''!=shopNumber">
  282. and s.`shop_number` like concat('%', #{shopNumber},'%')
  283. </if>
  284. <if test=" null != buildArea ">
  285. and s.`build_area` like concat('%', #{buildArea},'%')
  286. </if>
  287. <if test=" null != operationArea ">
  288. and s.`operation_area` like concat('%', #{operationArea},'%')
  289. </if>
  290. <if test=" null != building ">
  291. and s.`building`= #{building}
  292. </if>
  293. <if test=" null != floor ">
  294. and s.`floor` = #{floor}
  295. </if>
  296. <if test=" null != status">
  297. and s.`status` = #{status}
  298. </if>
  299. <if test=" null != x ">
  300. and s.`x` = #{x}
  301. </if>
  302. <if test=" null != y ">
  303. and s.`y` = #{y}
  304. </if>
  305. <if test=" null != addr ">
  306. and s.`addr` like concat('%', #{addr},'%')
  307. </if>
  308. <if test=" null != baiduPoi ">
  309. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  310. </if>
  311. <if test=" null != longitude ">
  312. and s.`longitude` = #{longitude}
  313. </if>
  314. <if test=" null != latitude ">
  315. and s.`latitude` = #{latitude}
  316. </if>
  317. <if test=" null != createDate ">
  318. and s.`create_date` = #{createDate}
  319. </if>
  320. <if test=" null != updateDate ">
  321. and s.`update_date` = #{updateDate}
  322. </if>
  323. <if test=" null != manager ">
  324. and s.`manager` = #{manager}
  325. </if>
  326. <if test=" null != managerPhone ">
  327. and s.`manager_phone` = #{managerPhone}
  328. </if>
  329. <if test=" null != type ">
  330. and s.`type` = #{type}
  331. </if>
  332. <if test=" null != pointType ">
  333. and s.`point_type` = #{pointType}
  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 s.${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,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
  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 s.${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. </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
  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 != startdate">
  419. and ms.`create_date` >= #{startdate}
  420. </if>
  421. <if test="null != enddate">
  422. and ms.`create_date` &lt;= #{enddate}
  423. </if>
  424. <if test="null != type">
  425. and `type`=#{type}
  426. </if>
  427. <if test="null != status">
  428. and status = #{status}
  429. </if>
  430. </select>
  431. </mapper>