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

497 строки
16 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="email" property="email"/>
  28. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  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`,email,`is_del`
  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 != email ">
  98. and `email` = #{email}
  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,s.shop_number shopNumber,s.build_area buildArea,
  116. s.img_url imgUrl,s.operation_area 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,s.email
  120. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  121. left join wx_merchant m on ms.merchant_id=m.id
  122. left join wx_mall_building b on s.building=b.id
  123. left join wx_mall_floor f on s.floor=f.id
  124. where is_del=0
  125. <if test=" null != id ">
  126. and s.`id` = #{id}
  127. </if>
  128. <if test=" null != tenantId ">
  129. and s.`tenant_id`= #{tenantId}
  130. </if>
  131. <if test=" null != shopNumber and ''!=shopNumber">
  132. and s.`shop_number` like concat('%', #{shopNumber},'%')
  133. </if>
  134. <if test=" null != buildArea ">
  135. and s.`build_area` like concat('%', #{buildArea},'%')
  136. </if>
  137. <if test=" null != operationArea ">
  138. and s.`operation_area` like concat('%', #{operationArea},'%')
  139. </if>
  140. <if test=" null != building ">
  141. and s.`building`= #{building}
  142. </if>
  143. <if test=" null != floor ">
  144. and s.`floor` = #{floor}
  145. </if>
  146. <if test=" null != status">
  147. and s.`status` = #{status}
  148. </if>
  149. <if test=" null != x ">
  150. and s.`x` = #{x}
  151. </if>
  152. <if test=" null != y ">
  153. and s.`y` = #{y}
  154. </if>
  155. <if test=" null != addr ">
  156. and s.`addr` like concat('%', #{addr},'%')
  157. </if>
  158. <if test=" null != baiduPoi ">
  159. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  160. </if>
  161. <if test=" null != longitude ">
  162. and s.`longitude` = #{longitude}
  163. </if>
  164. <if test=" null != latitude ">
  165. and s.`latitude` = #{latitude}
  166. </if>
  167. <if test=" null != createDate ">
  168. and s.`create_date` = #{createDate}
  169. </if>
  170. <if test=" null != updateDate ">
  171. and s.`update_date` = #{updateDate}
  172. </if>
  173. <if test=" null != manager ">
  174. and s.`manager` = #{manager}
  175. </if>
  176. <if test=" null != managerPhone ">
  177. and s.`manager_phone` = #{managerPhone}
  178. </if>
  179. <if test=" null != type ">
  180. and s.`type` = #{type}
  181. </if>
  182. <if test=" null != pointType ">
  183. and s.`point_type` = #{pointType}
  184. </if>
  185. <if test=" null != email ">
  186. and s.`email`= #{email}
  187. </if>
  188. <if test=" null != ids ">
  189. and s.id in
  190. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  191. #{idItem}
  192. </foreach>
  193. </if>
  194. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  195. </select>
  196. <resultMap id="VoResultMap" type="com.iformall.domain.vo.WxShopVo">
  197. <id column="id" jdbcType="BIGINT" property="id"/>
  198. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  199. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  200. <result column="build_area" jdbcType="VARCHAR" property="buildArea"/>
  201. <result column="operation_area" jdbcType="VARCHAR" property="operationArea"/>
  202. <result column="building" jdbcType="BIGINT" property="building"/>
  203. <result column="floor" jdbcType="BIGINT" property="floor"/>
  204. <result column="status" jdbcType="INTEGER" property="status"/>
  205. <result column="x" jdbcType="DECIMAL" property="x"/>
  206. <result column="y" jdbcType="DECIMAL" property="y"/>
  207. <result column="addr" jdbcType="VARCHAR" property="addr"/>
  208. <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
  209. <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
  210. <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
  211. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  212. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  213. <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
  214. <result column="manager" jdbcType="VARCHAR" property="manager"/>
  215. <result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
  216. <result column="type" jdbcType="INTEGER" property="type"/>
  217. <result column="point_type" jdbcType="INTEGER" property="pointType"/>
  218. <result column="comments" jdbcType="VARCHAR" property="comments"/>
  219. <result column="email" property="email"/>
  220. <result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
  221. <result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
  222. <result column="merchantId" jdbcType="VARCHAR" property="merchantId"/>
  223. <result column="merchantName" jdbcType="VARCHAR" property="merchantName"/>
  224. <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
  225. <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
  226. <result column="business" jdbcType="VARCHAR" property="business"/>
  227. <result column="brandName" jdbcType="VARCHAR" property="brandName"/>
  228. </resultMap>
  229. <select id="findListWithMerchantMap" parameterType="com.iformall.domain.vo.WxShopVo" resultMap="VoResultMap">
  230. select
  231. s.id,s.shop_number,s.build_area,s.img_url,s.operation_area,s.status,s.manager,s.manager_phone,s.addr,s.email,s.type,s.point_type,
  232. b.building_name,f.floor_name,
  233. m.id merchantId,m.name merchantName,m.link_person,m.link_phone,
  234. brand.name brandName,
  235. bus.title business
  236. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
  237. left join wx_merchant m on ms.merchant_id=m.id
  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. left join wx_business bus on m.business_id = bus.id
  241. left join wx_brand brand on m.brand = brand.id
  242. where s.is_del=0
  243. <if test=" null != id ">
  244. and s.`id` = #{id}
  245. </if>
  246. <if test=" null != tenantId ">
  247. and s.`tenant_id`= #{tenantId}
  248. </if>
  249. <if test=" null != shopNumber and ''!=shopNumber">
  250. and s.`shop_number` like concat('%', #{shopNumber},'%')
  251. </if>
  252. <if test=" null != buildArea ">
  253. and s.`build_area` like concat('%', #{buildArea},'%')
  254. </if>
  255. <if test=" null != operationArea ">
  256. and s.`operation_area` like concat('%', #{operationArea},'%')
  257. </if>
  258. <if test=" null != building ">
  259. and s.`building`= #{building}
  260. </if>
  261. <if test=" null != floor ">
  262. and s.`floor` = #{floor}
  263. </if>
  264. <if test=" null != status">
  265. and s.`status` = #{status}
  266. </if>
  267. <if test=" null != x ">
  268. and s.`x` = #{x}
  269. </if>
  270. <if test=" null != y ">
  271. and s.`y` = #{y}
  272. </if>
  273. <if test=" null != addr ">
  274. and s.`addr` like concat('%', #{addr},'%')
  275. </if>
  276. <if test=" null != baiduPoi ">
  277. and s.`baidu_poi` like concat('%', #{baiduPoi},'%')
  278. </if>
  279. <if test=" null != longitude ">
  280. and s.`longitude` = #{longitude}
  281. </if>
  282. <if test=" null != latitude ">
  283. and s.`latitude` = #{latitude}
  284. </if>
  285. <if test=" null != createDate ">
  286. and s.`create_date` = #{createDate}
  287. </if>
  288. <if test=" null != updateDate ">
  289. and s.`update_date` = #{updateDate}
  290. </if>
  291. <if test=" null != manager ">
  292. and s.`manager` = #{manager}
  293. </if>
  294. <if test=" null != managerPhone ">
  295. and s.`manager_phone` = #{managerPhone}
  296. </if>
  297. <if test=" null != type ">
  298. and s.`type` = #{type}
  299. </if>
  300. <if test=" null != email ">
  301. and s.`email` = #{email}
  302. </if>
  303. <if test=" null != pointType ">
  304. and s.`point_type` = #{pointType}
  305. </if>
  306. <if test=" null != ids ">
  307. and s.id in
  308. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  309. #{idItem}
  310. </foreach>
  311. </if>
  312. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  313. </select>
  314. <select id="getbshoplist" resultType="hashmap" parameterType="hashmap">
  315. select id,shop_number shopNumber from wx_shop
  316. where tenant_id=#{tenantId} and shop_number = #{shopNumber} and is_del=0
  317. </select>
  318. <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
  319. select m.`name` merchantName,s.build_area buildArea,s.operation_area operationArea,
  320. c.price,c.receive_period receivePeriod,s.shop_number shopNumber,m.link_person linkPerson,
  321. m.link_phone linkPhone,s.email
  322. from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id
  323. inner join wx_shop s on ms.shop_id=s.id
  324. inner join wx_rent_contract c on ms.merchant_id=c.merchant_id
  325. where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0 and s.is_del=0
  326. </select>
  327. <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap">
  328. select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop
  329. where tenant_id=#{tenantId} and status=#{status} and is_del=0
  330. </select>
  331. <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
  332. select s.id,s.shop_number shopNumber,s.build_area buildArea,
  333. s.img_url imgUrl,s.operation_area operationArea,
  334. s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
  335. m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
  336. m.brand,m.business_id businessId,m.shop_type shopType,s.email
  337. from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id
  338. left join wx_merchant m on ms.merchant_id=m.id
  339. left join wx_mall_building b on s.building=b.id
  340. left join wx_mall_floor f on s.floor=f.id
  341. where s.is_del=0 and ms.is_del=0
  342. and s.tenant_id=#{tenantId}
  343. <if test=" null != status">
  344. and s.`status` = #{status}
  345. </if>
  346. <if test="null!=status and status==1">
  347. and s.id not in(
  348. SELECT shop_id FROM wx_rent_contract WHERE tenant_id = #{tenantId} and status not in(0,5,6,7) and
  349. merchant_id is not null
  350. )
  351. </if>
  352. <if test=" null != type ">
  353. and s.`type` = #{type}
  354. </if>
  355. <if test=" null != pointType ">
  356. and s.`point_type` = #{pointType}
  357. </if>
  358. <if test=" null != sortColumns">order by s.${sortColumns}</if>
  359. </select>
  360. <select id="hasShopNumber" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
  361. select count(*) from wx_shop where tenant_id=#{tenantId} and shop_number=#{shopNumber} and `type`=#{type} and
  362. is_del=0
  363. <if test=" null != id">
  364. and id != #{id}
  365. </if>
  366. </select>
  367. </mapper>