Transport2Mapper.xml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.delivery.comment.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. </resultMap>
  13. <resultMap id="transportConutMap" type="com.yami.shop.delivery.comment.param.ShopTransport">
  14. <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
  15. <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
  16. <result column="transport_conut" jdbcType="BIGINT" property="transportConut"/>
  17. <result column="province" jdbcType="VARCHAR" property="province"/>
  18. <result column="city" jdbcType="VARCHAR" property="city"/>
  19. <result column="area" jdbcType="VARCHAR" property="area"/>
  20. <result column="shop_address" jdbcType="VARCHAR" property="shopAddress"/>
  21. </resultMap>
  22. <select id="getTransport" resultMap="BaseResultMap">
  23. SELECT *
  24. FROM tz_transport2 p
  25. WHERE p.shop_id = #{shopId}
  26. AND p.distance &gt;= #{distance}
  27. ORDER BY p.distance LIMIT 1
  28. </select>
  29. <select id="findByTransportId" resultMap="BaseResultMap">
  30. select *
  31. from tz_transport2 p
  32. where p.transport_id = #{transportId}
  33. </select>
  34. <delete id="deleteTransports">
  35. delete from tz_transport2 where transport_id in
  36. <foreach collection="ids" item="id" open="(" close=")" separator=",">
  37. #{id}
  38. </foreach>
  39. </delete>
  40. <select id="findShopTransports" resultMap="transportConutMap">
  41. SELECT
  42. shop.shop_id,shop.shop_name,shop.province,shop.city,shop.area,shop.shop_address,
  43. COUNT( tr.transport_id ) AS transport_conut
  44. FROM
  45. tz_shop_detail shop
  46. LEFT JOIN tz_transport2 tr ON shop.shop_id = tr.shop_id
  47. <!-- <where>-->
  48. <!-- <if test="shopName != null and shopName != ''">-->
  49. <!-- AND shop.shop_name LIKE CONCAT('%', #{shopName}, '%')-->
  50. <!-- </if>-->
  51. <!-- </where>-->
  52. WHERE shop.shop_id = #{shopId}
  53. GROUP BY shop.shop_id
  54. </select>
  55. </mapper>