SignForPackageMapper.xml 2.4 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.SignForPackageMapper">
    <resultMap id="BaseResultMap" type="com.yoho.order.model.SignForPackage">
      <result column="id" property="id" jdbcType="INTEGER" />
      <result column="date" property="date" jdbcType="INTEGER" />
      <result column="seller_waybillCode" property="sellerWaybillCode" jdbcType="VARCHAR" />
      <result column="depot_no" property="depotNo" jdbcType="INTEGER" />
      <result column="sign_time" property="signTime" jdbcType="INTEGER" />
    </resultMap>

    <sql id="Base_Column_List">
        id, date, seller_waybillCode, depot_no, sign_time
    </sql>
    
    <insert id="insert" parameterType="com.yoho.order.model.SignForPackage">
        insert into sign_for_package (date, seller_waybillCode, depot_no, sign_time) values (#{date}, #{sellerWaybillCode}, #{depotNo}, 
        #{signTime})
    </insert>
    
    <select id="selectCountByDate" resultType="java.lang.Integer">
        select count(*)
        from sign_for_package 
        where date=#{date} 
        <if test="depotNo != null">
          and depot_no = #{depotNo}
        </if>
    </select>
    
    <sql id="Query_Sql" >
      <if test="buyerOrderReq.depotNo != null">
           and depot_no=#{buyerOrderReq.depotNo}
      </if>
      <if test="buyerOrderReq.sellerWaybillCode != null and buyerOrderReq.sellerWaybillCode != ''">
           and seller_waybillCode = #{buyerOrderReq.sellerWaybillCode}
      </if>
      <if test="buyerOrderReq.date != null">
           and date=#{buyerOrderReq.date}
      </if>
    </sql>

    <select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.BuyerOrderReq">
        select count(1)   
        from sign_for_package  
        where 1=1  
        <include refid="Query_Sql"></include>
    </select>
    
    <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.BuyerOrderReq">
      select <include refid="Base_Column_List"></include> 
      from sign_for_package  
      where 1=1 
      <include refid="Query_Sql"></include>
      order by sign_time desc 
      <if test="buyerOrderReq.start!=null and buyerOrderReq.size != null">
        limit #{buyerOrderReq.start},#{buyerOrderReq.size}
      </if>
    </select>
    
</mapper>