ShopDetailMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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.yami.shop.dao.ShopDetailMapper">
  4. <resultMap id="BaseResultMap" type="com.yami.shop.bean.model.ShopDetail">
  5. <!--
  6. WARNING - @mbg.generated
  7. -->
  8. <id column="shop_id" jdbcType="BIGINT" property="shopId"/>
  9. <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
  10. <result column="out_station_no" jdbcType="VARCHAR" property="outStationNo"/>
  11. <result column="user_id" jdbcType="VARCHAR" property="userId"/>
  12. <result column="intro" jdbcType="VARCHAR" property="intro"/>
  13. <result column="shop_owner" jdbcType="VARCHAR" property="shopOwner"/>
  14. <result column="mobile" jdbcType="VARCHAR" property="mobile"/>
  15. <result column="tel" jdbcType="VARCHAR" property="tel"/>
  16. <result column="shop_lat" jdbcType="VARCHAR" property="shopLat"/>
  17. <result column="shop_lng" jdbcType="VARCHAR" property="shopLng"/>
  18. <result column="shop_address" jdbcType="VARCHAR" property="shopAddress"/>
  19. <result column="province" jdbcType="VARCHAR" property="province"/>
  20. <result column="province_id" jdbcType="BIGINT" property="provinceId"/>
  21. <result column="city" jdbcType="VARCHAR" property="city"/>
  22. <result column="city_id" jdbcType="BIGINT" property="cityId"/>
  23. <result column="area" jdbcType="VARCHAR" property="area"/>
  24. <result column="area_id" jdbcType="BIGINT" property="areaId"/>
  25. <result column="shop_logo" jdbcType="VARCHAR" property="shopLogo"/>
  26. <result column="shop_status" jdbcType="TINYINT" property="shopStatus"/>
  27. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  28. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  29. <result column="is_distribution" jdbcType="TINYINT" property="isDistribution"/>
  30. <result column="business_license" jdbcType="VARCHAR" property="businessLicense"/>
  31. <result column="identity_card_front" jdbcType="VARCHAR" property="identityCardFront"/>
  32. <result column="identity_card_later" jdbcType="VARCHAR" property="identityCardLater"/>
  33. <result column="shop_code" jdbcType="VARCHAR" property="shopCode"/>
  34. <result column="map_type" jdbcType="VARCHAR" property="mapType"/>
  35. <result column="category" jdbcType="VARCHAR" property="category"/>
  36. <result column="sync" jdbcType="TINYINT" property="sync"/>
  37. </resultMap>
  38. <select id="getShopByMobile" resultMap="BaseResultMap">
  39. select *
  40. from tz_shop_detail
  41. where mobile = #{mobile}
  42. </select>
  43. <update id="updatePasswordByUserName">
  44. update tz_shop_detail
  45. set `password` = #{newPassword}
  46. where mobile = #{username}
  47. </update>
  48. <select id="getShopDetailByUserId" resultMap="BaseResultMap">
  49. select *
  50. from tz_shop_detail
  51. where user_id = #{userId}
  52. </select>
  53. <update id="updateStatus">
  54. UPDATE tz_shop_detail sd
  55. SET sd.`update_time` = NOW(),
  56. sd.`shop_status` = #{status}
  57. WHERE sd.`shop_id` = #{shopId}
  58. </update>
  59. <select id="listHotShopsHead" resultType="com.yami.shop.bean.app.dto.ShopHeadInfoDto">
  60. SELECT sd.`shop_id`,
  61. sd.`out_station_no`,
  62. sd.`shop_name`,
  63. sd.`shop_logo`,
  64. sd.shop_status,
  65. COUNT(ucs.`shop_id`) fansCount,
  66. sd.`tel`
  67. FROM tz_shop_detail sd
  68. LEFT JOIN `tz_user_collection_shop` ucs
  69. ON ucs.`shop_id` = sd.`shop_id`
  70. GROUP BY sd.`shop_id`
  71. HAVING sd.shop_status = 1
  72. ORDER BY fansCount DESC LIMIT 8
  73. </select>
  74. <select id="searchShops" resultType="com.yami.shop.bean.app.dto.ShopHeadInfoDto">
  75. SELECT
  76. sd.`shop_id`,
  77. sd.`out_station_no`,
  78. sd.`shop_name`,
  79. sd.`shop_logo`,
  80. sd.shop_status,
  81. COUNT(ucs.`shop_id`) fansCount,
  82. sd.`tel`
  83. FROM
  84. tz_shop_detail sd
  85. LEFT JOIN `tz_user_collection_shop` ucs
  86. ON ucs.`shop_id` = sd.`shop_id`
  87. GROUP BY sd.`shop_id`
  88. HAVING sd.shop_status = 1
  89. <if test="shopHeadInfoDto.shopName != null and shopHeadInfoDto.shopName != ''">
  90. and sd.`shop_name` like concat('%', #{shopHeadInfoDto.shopName}, '%')
  91. </if>
  92. ORDER BY fansCount DESC
  93. </select>
  94. <select id="selectShopDetailById" resultType="com.yami.shop.bean.model.ShopDetail">
  95. select shop_id,
  96. out_station_no,
  97. shop_name,
  98. user_id,
  99. intro,
  100. shop_owner,
  101. mobile,
  102. tel,
  103. shop_lat,
  104. shop_lng,
  105. shop_address,
  106. province,
  107. province_id,
  108. city,
  109. city_id,
  110. area,
  111. area_id,
  112. shop_logo,
  113. shop_status,
  114. create_time,
  115. update_time,
  116. is_distribution,
  117. business_license,
  118. identity_card_front,
  119. identity_card_later,
  120. sync,
  121. category,
  122. third_party_code
  123. from tz_shop_detail
  124. where shop_id = #{shopId}
  125. </select>
  126. <select id="neighborShop" resultType="com.yami.shop.bean.model.ShopDetail">
  127. select
  128. sd.shop_id,
  129. shop_name,
  130. ( 6371 * acos( cos( radians(#{lat}) ) * cos( radians( shop_lat ) ) * cos( radians( shop_lng ) - radians(#{lon})
  131. ) + sin( radians(#{lat}) ) * sin( radians( shop_lat ) ) ) ) distance
  132. from
  133. tz_shop_detail sd
  134. right join tz_transport2 tp on tp.shop_id = sd.shop_id
  135. right join tz_channel_shop tcs on tcs.shop_id = sd.shop_id
  136. where shop_status = 1
  137. <if test="null != platform">
  138. tcs.`channel_id`= #{platform} and tcs.`is_delete`=0
  139. </if>
  140. order by
  141. distance
  142. </select>
  143. <select id="selectByOutStationNo" resultType="com.yami.shop.bean.model.ShopDetail">
  144. select shop_id,
  145. out_station_no,
  146. shop_name,
  147. user_id,
  148. intro,
  149. shop_owner,
  150. mobile,
  151. tel,
  152. shop_lat,
  153. shop_lng,
  154. shop_address,
  155. province,
  156. province_id,
  157. city,
  158. city_id,
  159. area,
  160. area_id,
  161. shop_logo,
  162. shop_status,
  163. create_time,
  164. update_time,
  165. is_distribution,
  166. business_license,
  167. identity_card_front,
  168. identity_card_later,
  169. sync,
  170. category,
  171. third_party_code
  172. from tz_shop_detail
  173. where out_station_no = #{outStationNo}
  174. </select>
  175. <select id="selectByHbStationId" resultType="com.yami.shop.bean.model.ShopDetail">
  176. select shop_id,
  177. hb_station_id,
  178. out_station_no,
  179. shop_name,
  180. user_id,
  181. intro,
  182. shop_owner,
  183. mobile,
  184. tel,
  185. shop_lat,
  186. shop_lng,
  187. shop_address,
  188. province,
  189. province_id,
  190. city,
  191. city_id,
  192. area,
  193. area_id,
  194. shop_logo,
  195. shop_status,
  196. create_time,
  197. update_time,
  198. is_distribution,
  199. business_license,
  200. identity_card_front,
  201. identity_card_later,
  202. sync,
  203. category,
  204. third_party_code
  205. from tz_shop_detail
  206. where hb_station_id = #{hbStationId}
  207. </select>
  208. </mapper>