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.
 
 
 
 
 

503 lines
17 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. </resultMap>
  29. <sql id="allColumns">
  30. `id`,`tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`,
  31. `floor`,`status`,`x`,`y`,`addr`,`baidu_poi`,`longitude`,`latitude`,`create_date`,
  32. `update_date`,`img_url`,`manager`,`manager_phone`,`type`,`point_type`,`comments`,`is_del`
  33. </sql>
  34. <sql id="dynamicWhereConditions">
  35. where is_del=0
  36. <if test=" null != id ">
  37. and `id` = #{id}
  38. </if>
  39. <if test=" null != tenantId ">
  40. and `tenant_id` = #{tenantId}
  41. </if>
  42. <if test=" null != shopNumber and ''!=shopNumber">
  43. and `shop_number` like concat('%', #{shopNumber},'%')
  44. </if>
  45. <if test=" null != buildArea ">
  46. and `build_area` like concat('%', #{buildArea},'%')
  47. </if>
  48. <if test=" null != operationArea ">
  49. and `operation_area` like concat('%', #{operationArea},'%')
  50. </if>
  51. <if test=" null != building ">
  52. and `building` like concat('%', #{building},'%')
  53. </if>
  54. <if test=" null != floor ">
  55. and `floor` = #{floor}
  56. </if>
  57. <if test=" null != status ">
  58. and `status` = #{status}
  59. </if>
  60. <if test=" null != x ">
  61. and `x` = #{x}
  62. </if>
  63. <if test=" null != y ">
  64. and `y` = #{y}
  65. </if>
  66. <if test=" null != addr ">
  67. and `addr` like concat('%', #{addr},'%')
  68. </if>
  69. <if test=" null != baiduPoi ">
  70. and `baidu_poi` like concat('%', #{baiduPoi},'%')
  71. </if>
  72. <if test=" null != longitude ">
  73. and `longitude` = #{longitude}
  74. </if>
  75. <if test=" null != latitude ">
  76. and `latitude` = #{latitude}
  77. </if>
  78. <if test=" null != createDate ">
  79. and `create_date` = #{createDate}
  80. </if>
  81. <if test=" null != updateDate ">
  82. and `update_date` = #{updateDate}
  83. </if>
  84. <if test=" null != manager ">
  85. and `manager` = #{manager}
  86. </if>
  87. <if test=" null != managerPhone ">
  88. and `manager_phone` = #{managerPhone}
  89. </if>
  90. <if test=" null != type ">
  91. and `type` = #{type}
  92. </if>
  93. <if test=" null != pointType ">
  94. and `point_type` = #{pointType}
  95. </if>
  96. <if test=" null != ids ">
  97. and id in
  98. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  99. #{idItem}
  100. </foreach>
  101. </if>
  102. <if test=" null != sortColumns">order by ${sortColumns}</if>
  103. </sql>
  104. <select id="findList" parameterType="com.iformall.domain.po.WxShop" resultMap="BaseResultMap">
  105. select
  106. <include refid="allColumns"/>
  107. from wx_shop
  108. <include refid="dynamicWhereConditions"/>
  109. </select>
  110. <select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  111. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  112. s.img_url imgUrl,s.operation_area operationArea,
  113. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  114. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  115. s.type,s.point_type pointType,s.addr
  116. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  117. left join wx_merchant m on ms.merchant_id=m.id
  118. left join wx_mall_building b on s.building=b.id
  119. left join wx_mall_floor f on s.floor=f.id
  120. where s.is_del=0
  121. <if test=" null != id ">
  122. and s.`id` = #{id}
  123. </if>
  124. <if test=" null != tenantId ">
  125. and s.`tenant_id`= #{tenantId}
  126. </if>
  127. <if test=" null != shopNumber and ''!=shopNumber">
  128. and s.`shop_number` like concat('%', #{shopNumber},'%')
  129. </if>
  130. <if test=" null != buildArea ">
  131. and s.`build_area` like concat('%', #{buildArea},'%')
  132. </if>
  133. <if test=" null != operationArea ">
  134. and s.`operation_area` like concat('%', #{operationArea},'%')
  135. </if>
  136. <if test=" null != building ">
  137. and s.`building`= #{building}
  138. </if>
  139. <if test=" null != floor ">
  140. and s.`floor` = #{floor}
  141. </if>
  142. <if test=" null != status">
  143. and s.`status` = #{status}
  144. </if>
  145. <if test=" null != x ">
  146. and s.`x` = #{x}
  147. </if>
  148. <if test=" null != y ">
  149. and s.`y` = #{y}
  150. </if>
  151. <if test=" null != addr ">
  152. and s.`addr` like concat('%', #{addr},'%')
  153. </if>
  154. <if test=" null != baiduPoi ">
  155. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  156. </if>
  157. <if test=" null != longitude ">
  158. and s.`longitude` = #{longitude}
  159. </if>
  160. <if test=" null != latitude ">
  161. and s.`latitude` = #{latitude}
  162. </if>
  163. <if test=" null != createDate ">
  164. and s.`create_date` = #{createDate}
  165. </if>
  166. <if test=" null != updateDate ">
  167. and s.`update_date` = #{updateDate}
  168. </if>
  169. <if test=" null != manager ">
  170. and s.`manager` = #{manager}
  171. </if>
  172. <if test=" null != managerPhone ">
  173. and s.`manager_phone` = #{managerPhone}
  174. </if>
  175. <if test=" null != type ">
  176. and s.`type` = #{type}
  177. </if>
  178. <if test=" null != pointType ">
  179. and s.`point_type` = #{pointType}
  180. </if>
  181. <if test=" null != ids ">
  182. and s.id in
  183. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  184. #{idItem}
  185. </foreach>
  186. </if>
  187. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  188. </select>
  189. <resultMap id="VoResultMap" type="com.iformall.domain.vo.WxShopVo">
  190. <id column="id" jdbcType="BIGINT" property="id"/>
  191. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  192. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  193. <result column="build_area" jdbcType="VARCHAR" property="buildArea"/>
  194. <result column="operation_area" jdbcType="VARCHAR" property="operationArea"/>
  195. <result column="building" jdbcType="BIGINT" property="building"/>
  196. <result column="floor" jdbcType="BIGINT" property="floor"/>
  197. <result column="status" jdbcType="INTEGER" property="status"/>
  198. <result column="x" jdbcType="DECIMAL" property="x"/>
  199. <result column="y" jdbcType="DECIMAL" property="y"/>
  200. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  201. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  202. <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
  203. <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
  204. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  205. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  206. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  207. <result column="manager" jdbcType="VARCHAR" property="manager"/>
  208. <result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
  209. <result column="type" jdbcType="INTEGER" property="type"/>
  210. <result column="point_type" jdbcType="INTEGER" property="pointType"/>
  211. <result column="comments" jdbcType="VARCHAR" property="comments"/>
  212. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  213. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  214. <result column="merchantId" jdbcType="VARCHAR" property="merchantId"/>
  215. <result column="merchantName" jdbcType="VARCHAR" property="merchantName"/>
  216. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  217. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  218. <result column="business" jdbcType="VARCHAR" property="business"/>
  219. <result column="brandName" jdbcType="VARCHAR" property="brandName"/>
  220. </resultMap>
  221. <select id="findListWithMerchantMap" parameterType="com.iformall.domain.vo.WxShopVo" resultMap="VoResultMap">
  222. select
  223. 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,
  224. b.building_name,f.floor_name,
  225. m.id merchantId,m.name merchantName,m.link_person,m.link_phone,
  226. brand.name brandName,
  227. bus.title business
  228. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  229. left join wx_merchant m on ms.merchant_id=m.id
  230. left join wx_mall_building b on s.building=b.id
  231. left join wx_mall_floor f on s.floor=f.id
  232. left join wx_business bus on m.business_id = bus.id
  233. left join wx_brand brand on m.brand = brand.id
  234. where s.is_del=0
  235. <if test=" null != id ">
  236. and s.`id` = #{id}
  237. </if>
  238. <if test=" null != tenantId ">
  239. and s.`tenant_id`= #{tenantId}
  240. </if>
  241. <if test=" null != shopNumber and ''!=shopNumber">
  242. and s.`shop_number` like concat('%', #{shopNumber},'%')
  243. </if>
  244. <if test=" null != buildArea ">
  245. and s.`build_area` like concat('%', #{buildArea},'%')
  246. </if>
  247. <if test=" null != operationArea ">
  248. and s.`operation_area` like concat('%', #{operationArea},'%')
  249. </if>
  250. <if test=" null != building ">
  251. and s.`building`= #{building}
  252. </if>
  253. <if test=" null != floor ">
  254. and s.`floor` = #{floor}
  255. </if>
  256. <if test=" null != status">
  257. and s.`status` = #{status}
  258. </if>
  259. <if test=" null != x ">
  260. and s.`x` = #{x}
  261. </if>
  262. <if test=" null != y ">
  263. and s.`y` = #{y}
  264. </if>
  265. <if test=" null != addr ">
  266. and s.`addr` like concat('%', #{addr},'%')
  267. </if>
  268. <if test=" null != baiduPoi ">
  269. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  270. </if>
  271. <if test=" null != longitude ">
  272. and s.`longitude` = #{longitude}
  273. </if>
  274. <if test=" null != latitude ">
  275. and s.`latitude` = #{latitude}
  276. </if>
  277. <if test=" null != createDate ">
  278. and s.`create_date` = #{createDate}
  279. </if>
  280. <if test=" null != updateDate ">
  281. and s.`update_date` = #{updateDate}
  282. </if>
  283. <if test=" null != manager ">
  284. and s.`manager` = #{manager}
  285. </if>
  286. <if test=" null != managerPhone ">
  287. and s.`manager_phone` = #{managerPhone}
  288. </if>
  289. <if test=" null != type ">
  290. and s.`type` = #{type}
  291. </if>
  292. <if test=" null != pointType ">
  293. and s.`point_type` = #{pointType}
  294. </if>
  295. <if test=" null != ids ">
  296. and s.id in
  297. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  298. #{idItem}
  299. </foreach>
  300. </if>
  301. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  302. </select>
  303. <select id="getbshoplist" resultType="hashmap" parameterType="hashmap">
  304. select id,shop_number shopNumber from wx_shop
  305. where tenant_id=#{tenantId} and shop_number = #{shopNumber} and is_del=0
  306. </select>
  307. <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
  308. select m.`name` merchantName,s.build_area buildArea,s.operation_area operationArea,
  309. c.price,c.receive_period receivePeriod,s.shop_number shopNumber,m.link_person linkPerson,
  310. m.link_phone linkPhone
  311. from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id
  312. inner join wx_shop s on ms.shop_id=s.id
  313. inner join wx_rent_contract c on ms.merchant_id=c.merchant_id
  314. where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0 and s.is_del=0
  315. </select>
  316. <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap">
  317. select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop
  318. where tenant_id=#{tenantId} and status=#{status} and is_del=0
  319. </select>
  320. <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  321. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  322. s.img_url imgUrl,s.operation_area operationArea,
  323. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  324. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  325. m.brand,m.business_id businessId,m.shop_type shopType
  326. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id
  327. left join wx_merchant m on ms.merchant_id=m.id
  328. left join wx_mall_building b on s.building=b.id
  329. left join wx_mall_floor f on s.floor=f.id
  330. where s.is_del=0 and ms.is_del=0
  331. and s.tenant_id=#{tenantId}
  332. <if test=" null != status">
  333. and s.`status` = #{status}
  334. </if>
  335. <if test="null!=status and status==1 and type!=null and type==2">
  336. and s.id not in(
  337. SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status not in(0,5,6,7)
  338. and merchant_id is not null and rent_shop_type=2
  339. )
  340. </if>
  341. <if test=" null != type ">
  342. and s.`type` = #{type}
  343. </if>
  344. <if test=" null != pointType ">
  345. and s.`point_type` = #{pointType}
  346. </if>
  347. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  348. </select>
  349. <select id="hasShopNumber" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
  350. select count(*) from wx_shop where tenant_id=#{tenantId} and shop_number=#{shopNumber} and `type`=#{type} and
  351. is_del=0
  352. <if test=" null != id">
  353. and id != #{id}
  354. </if>
  355. </select>
  356. <resultMap id="ShopVoResultMap" type="com.iformall.domain.vo.WxShopVo">
  357. <id column="id" jdbcType="BIGINT" property="id"/>
  358. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  359. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  360. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  361. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  362. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  363. </resultMap>
  364. <select id="findShopVoList" parameterType="java.util.Map" resultMap="ShopVoResultMap">
  365. select s.id,s.shop_number,b.building_name,f.floor_name,s.addr,s.baidu_poi
  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 m.id=#{merchantId}
  372. </select>
  373. </mapper>