12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.yami.shop.delivery.comment.dao.Transport2Mapper">
- <resultMap id="BaseResultMap" type="com.yami.shop.delivery.comment.model.Transport2">
- <id column="transport_id" jdbcType="BIGINT" property="transportId"/>
- <result column="trans_name" jdbcType="VARCHAR" property="transName"/>
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
- <result column="piece" jdbcType="DOUBLE" property="piece"/>
- <result column="distance" jdbcType="DOUBLE" property="distance"/>
- <result column="amount" jdbcType="DOUBLE" property="amount"/>
- </resultMap>
- <resultMap id="transportConutMap" type="com.yami.shop.delivery.comment.param.ShopTransport">
- <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
- <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
- <result column="transport_conut" jdbcType="BIGINT" property="transportConut"/>
- <result column="province" jdbcType="VARCHAR" property="province"/>
- <result column="city" jdbcType="VARCHAR" property="city"/>
- <result column="area" jdbcType="VARCHAR" property="area"/>
- <result column="shop_address" jdbcType="VARCHAR" property="shopAddress"/>
- </resultMap>
- <select id="getTransport" resultMap="BaseResultMap">
- SELECT *
- FROM tz_transport2 p
- WHERE p.shop_id = #{shopId}
- AND p.distance >= #{distance}
- ORDER BY p.distance LIMIT 1
- </select>
- <select id="findByTransportId" resultMap="BaseResultMap">
- select *
- from tz_transport2 p
- where p.transport_id = #{transportId}
- </select>
- <delete id="deleteTransports">
- delete from tz_transport2 where transport_id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </delete>
- <select id="findShopTransports" resultMap="transportConutMap">
- SELECT
- shop.shop_id,shop.shop_name,shop.province,shop.city,shop.area,shop.shop_address,
- COUNT( tr.transport_id ) AS transport_conut
- FROM
- tz_shop_detail shop
- LEFT JOIN tz_transport2 tr ON shop.shop_id = tr.shop_id
- <!-- <where>-->
- <!-- <if test="shopName != null and shopName != ''">-->
- <!-- AND shop.shop_name LIKE CONCAT('%', #{shopName}, '%')-->
- <!-- </if>-->
- <!-- </where>-->
- WHERE shop.shop_id = #{shopId}
- GROUP BY shop.shop_id
- </select>
- </mapper>
|