ExpressInfoMapper.xml 2.33 KB
<?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.yoho.order.dal.ExpressInfoMapper">
    <resultMap id="BaseResultMap" type="com.yoho.order.model.ExpressInfo">
      <result column="id" property="id" jdbcType="INTEGER" />
      <result column="uid" property="uid" jdbcType="INTEGER" />
      <result column="order_code" property="orderCode" jdbcType="BIGINT" />
      <result column="waybill_code" property="waybillCode" jdbcType="VARCHAR" />
      <result column="accept_address" property="acceptAddress" jdbcType="VARCHAR" />
      <result column="accept_remark" property="acceptRemark" jdbcType="VARCHAR" />
      <result column="logistics_type" property="logisticsType" jdbcType="INTEGER" />
      <result column="create_time" property="createTime" jdbcType="INTEGER" />
      <result column="express_type" property="expressType" jdbcType="TINYINT" />
      <result column="state" property="state" jdbcType="INTEGER" />
    </resultMap>

    <sql id="Base_Column_List">
        id, uid, order_code, waybill_code, accept_address, accept_remark, logistics_type,
        create_time, express_type, state
    </sql>

    <select id="selectByOrderCodeAndType" resultMap="BaseResultMap">
        select <include refid="Base_Column_List" />
        from express_info where 1=1
        <if test="orderCode != null">
            and order_code = #{orderCode}
        </if>
        <if test="expressTypeList != null and expressTypeList.size()>0">
            and express_type in 
            <foreach collection="expressTypeList" item="expressType" open="(" close=")" separator=",">
              #{expressType}
            </foreach>
        </if>
        ORDER BY data_type DESC , create_time
    </select>

    <select id="selectExpressInfoListByWaybillCodeAndLogisticsType" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM express_info
        where waybill_code = #{waybillCode} and logistics_type = #{logisticsType}
        ORDER BY create_time
    </select>

    <select id="selectExpressInfoListByWaybillCode" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM express_info
        where waybill_code = #{waybillCode}
        ORDER BY create_time
    </select>
    
</mapper>