ShopDetailMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 * from tz_shop_detail where mobile = #{mobile}
  40. </select>
  41. <update id="updatePasswordByUserName">
  42. update tz_shop_detail set `password` = #{newPassword} where mobile = #{username}
  43. </update>
  44. <select id="getShopDetailByUserId" resultMap="BaseResultMap">
  45. select * from tz_shop_detail where user_id = #{userId}
  46. </select>
  47. <update id="updateStatus">
  48. UPDATE tz_shop_detail sd SET sd.`update_time` = NOW(),sd.`shop_status` = #{status}
  49. WHERE sd.`shop_id` = #{shopId}
  50. </update>
  51. <select id="listHotShopsHead" resultType="com.yami.shop.bean.app.dto.ShopHeadInfoDto">
  52. SELECT
  53. sd.`shop_id`,
  54. sd.`out_station_no`,
  55. sd.`shop_name`,
  56. sd.`shop_logo`,
  57. sd.shop_status,
  58. COUNT(ucs.`shop_id`) fansCount,
  59. sd.`tel`
  60. FROM
  61. tz_shop_detail sd
  62. LEFT JOIN `tz_user_collection_shop` ucs
  63. ON ucs.`shop_id` = sd.`shop_id`
  64. GROUP BY sd.`shop_id`
  65. HAVING sd.shop_status = 1
  66. ORDER BY fansCount DESC
  67. LIMIT 8
  68. </select>
  69. <select id="searchShops" resultType="com.yami.shop.bean.app.dto.ShopHeadInfoDto">
  70. SELECT
  71. sd.`shop_id`,
  72. sd.`out_station_no`,
  73. sd.`shop_name`,
  74. sd.`shop_logo`,
  75. sd.shop_status,
  76. COUNT(ucs.`shop_id`) fansCount,
  77. sd.`tel`
  78. FROM
  79. tz_shop_detail sd
  80. LEFT JOIN `tz_user_collection_shop` ucs
  81. ON ucs.`shop_id` = sd.`shop_id`
  82. GROUP BY sd.`shop_id`
  83. HAVING sd.shop_status = 1
  84. <if test="shopHeadInfoDto.shopName != null and shopHeadInfoDto.shopName != ''">
  85. and sd.`shop_name` like concat('%', #{shopHeadInfoDto.shopName}, '%')
  86. </if>
  87. ORDER BY fansCount DESC
  88. </select>
  89. <select id="selectShopDetailById" resultType="com.yami.shop.bean.model.ShopDetail">
  90. select shop_id,out_station_no,shop_name,user_id,intro,shop_owner,mobile,tel,shop_lat,shop_lng,shop_address,province,province_id,city,city_id,area,area_id,
  91. shop_logo,shop_status,create_time,update_time,is_distribution,business_license,identity_card_front,identity_card_later,sync,category,third_party_code
  92. from tz_shop_detail
  93. where shop_id = #{shopId}
  94. </select>
  95. <select id="neighborShop" resultType="com.yami.shop.bean.model.ShopDetail">
  96. select
  97. sd.shop_id,
  98. shop_name,
  99. ( 6371 * acos( cos( radians(#{lat}) ) * cos( radians( shop_lat ) ) * cos( radians( shop_lng ) - radians(#{lon}) ) + sin( radians(#{lat}) ) * sin( radians( shop_lat ) ) ) ) distance
  100. from
  101. tz_shop_detail sd
  102. right join tz_transport2 tp on tp.shop_id = sd.shop_id
  103. where shop_status = 1
  104. order by
  105. distance
  106. </select>
  107. <select id="selectByOutStationNo" resultType="com.yami.shop.bean.model.ShopDetail">
  108. select shop_id,out_station_no,shop_name,user_id,intro,shop_owner,mobile,tel,shop_lat,shop_lng,shop_address,province,province_id,city,city_id,area,area_id,
  109. shop_logo,shop_status,create_time,update_time,is_distribution,business_license,identity_card_front,identity_card_later,sync,category,third_party_code
  110. from tz_shop_detail
  111. where out_station_no = #{outStationNo}
  112. </select>
  113. <select id="selectByHbStationId" resultType="com.yami.shop.bean.model.ShopDetail">
  114. select shop_id,hb_station_id, out_station_no,shop_name,user_id,intro,shop_owner,mobile,tel,shop_lat,shop_lng,shop_address,province,province_id,city,city_id,area,area_id,
  115. shop_logo,shop_status,create_time,update_time,is_distribution,business_license,identity_card_front,identity_card_later,sync,category,third_party_code
  116. from tz_shop_detail
  117. where hb_station_id = #{hbStationId}
  118. </select>
  119. </mapper>