Transport2Mapper.xml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.delivery.comment.dao.Transport2Mapper">
  4. <resultMap id="BaseResultMap" type="com.yami.shop.bean.model.Transport2">
  5. <id column="transport_id" jdbcType="BIGINT" property="transportId"/>
  6. <result column="trans_name" jdbcType="VARCHAR" property="transName"/>
  7. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  8. <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
  9. <result column="piece" jdbcType="DOUBLE" property="piece"/>
  10. <result column="distance" jdbcType="DOUBLE" property="distance"/>
  11. <result column="amount" jdbcType="DOUBLE" property="amount"/>
  12. <result column="channel_id" jdbcType="BIGINT" property="channelId"/>
  13. </resultMap>
  14. <resultMap id="transportConutMap" type="com.yami.shop.delivery.comment.param.ShopTransport">
  15. <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
  16. <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
  17. <result column="transport_conut" jdbcType="BIGINT" property="transportConut"/>
  18. <result column="province" jdbcType="VARCHAR" property="province"/>
  19. <result column="city" jdbcType="VARCHAR" property="city"/>
  20. <result column="area" jdbcType="VARCHAR" property="area"/>
  21. <result column="shop_address" jdbcType="VARCHAR" property="shopAddress"/>
  22. </resultMap>
  23. <select id="getTransportShopPlatform" resultMap="BaseResultMap">
  24. SELECT *
  25. FROM tz_transport2 p
  26. WHERE p.shop_id = #{shopId}
  27. AND p.channel_id = #{platform}
  28. ORDER BY p.distance LIMIT 1
  29. </select>
  30. <select id="getTransport" resultMap="BaseResultMap">
  31. SELECT *
  32. FROM tz_transport2 p
  33. WHERE p.shop_id = #{shopId}
  34. AND p.distance &gt;= #{distance}
  35. ORDER BY p.distance LIMIT 1
  36. </select>
  37. <select id="getTransportWeight" resultMap="BaseResultMap">
  38. SELECT *
  39. FROM tz_transport2 p
  40. WHERE p.shop_id = #{shopId}
  41. AND p.distance &gt;= #{distance}
  42. AND p.weight &gt;= #{weight}
  43. ORDER BY p.distance LIMIT 1
  44. </select>
  45. <select id="findByTransportId" resultMap="BaseResultMap">
  46. select *
  47. from tz_transport2 p
  48. where p.transport_id = #{transportId}
  49. </select>
  50. <delete id="deleteTransports">
  51. delete from tz_transport2 where transport_id in
  52. <foreach collection="ids" item="id" open="(" close=")" separator=",">
  53. #{id}
  54. </foreach>
  55. </delete>
  56. <select id="findShopTransports" resultMap="transportConutMap">
  57. SELECT
  58. shop.shop_id,shop.shop_name,shop.province,shop.city,shop.area,shop.shop_address,
  59. COUNT( tr.transport_id ) AS transport_conut
  60. FROM
  61. tz_shop_detail shop
  62. LEFT JOIN tz_transport2 tr ON shop.shop_id = tr.shop_id
  63. <!-- <where>-->
  64. <!-- <if test="shopName != null and shopName != ''">-->
  65. <!-- AND shop.shop_name LIKE CONCAT('%', #{shopName}, '%')-->
  66. <!-- </if>-->
  67. <!-- </where>-->
  68. WHERE shop.shop_id = #{shopId}
  69. GROUP BY shop.shop_id
  70. </select>
  71. <select id="findByPlatform" resultMap="BaseResultMap">
  72. SELECT *
  73. FROM tz_transport2 p
  74. WHERE p.channel_id = #{platform}
  75. ORDER BY p.distance LIMIT 1
  76. </select>
  77. </mapper>