ReceiptHeaderMapper.xml 5.2 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.huaheng.pc.receipt.receiptHeader.mapper.ReceiptHeaderMapper">
  <resultMap id="BaseResultMap" type="com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader">
    <!--@mbg.generated-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
    <result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="receiptType" jdbcType="VARCHAR" property="receiptType" />
    <result column="firstStatus" jdbcType="INTEGER" property="firstStatus" />
    <result column="lastStatus" jdbcType="INTEGER" property="lastStatus" />
    <result column="referCode" jdbcType="VARCHAR" property="referCode" />
    <result column="referId" jdbcType="INTEGER" property="referId" />
    <result column="referType" jdbcType="VARCHAR" property="referType" />
    <result column="scheduledArriveDate" jdbcType="DATE" property="scheduledArriveDate" />
    <result column="actualArriveDate" jdbcType="DATE" property="actualArriveDate" />
    <result column="recvDock" jdbcType="VARCHAR" property="recvDock" />
    <result column="closedAt" jdbcType="DATE" property="closedAt" />
    <result column="closedBy" jdbcType="VARCHAR" property="closedBy" />
    <result column="startCheckinDatetime" jdbcType="TIMESTAMP" property="startCheckinDatetime" />
    <result column="endCheckinDatetime" jdbcType="TIMESTAMP" property="endCheckinDatetime" />
    <result column="totalQty" jdbcType="INTEGER" property="totalQty" />
    <result column="totalLines" jdbcType="INTEGER" property="totalLines" />
    <result column="toalCases" jdbcType="INTEGER" property="toalCases" />
    <result column="totalWeight" jdbcType="DECIMAL" property="totalWeight" />
    <result column="totalVolume" jdbcType="DECIMAL" property="totalVolume" />
    <result column="receiptNote" jdbcType="VARCHAR" property="receiptNote" />
    <result column="locked" jdbcType="INTEGER" property="locked" />
    <result column="lockedBy" jdbcType="VARCHAR" property="lockedBy" />
    <result column="created" jdbcType="TIMESTAMP" property="created" />
    <result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
    <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
    <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" />
    <result column="version" jdbcType="INTEGER" property="version" />
    <result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
    <result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
    <result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
    <result column="userDef4" jdbcType="VARCHAR" property="userDef4" />
    <result column="userDef5" jdbcType="VARCHAR" property="userDef5" />
    <result column="userDef6" jdbcType="VARCHAR" property="userDef6" />
    <result column="userDef7" jdbcType="VARCHAR" property="userDef7" />
    <result column="userDef8" jdbcType="VARCHAR" property="userDef8" />
    <result column="processStamp" jdbcType="VARCHAR" property="processStamp" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
    <result column="uWarehouseCode"  property="uWarehouseCode" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, warehouseCode, companyCode, code, receiptType, firstStatus, lastStatus, referCode, 
    referId, referType, scheduledArriveDate, actualArriveDate, recvDock, closedAt, closedBy, 
    startCheckinDatetime, endCheckinDatetime, totalQty, totalLines, toalCases, totalWeight, 
    totalVolume, receiptNote, locked, lockedBy, created, createdBy, lastUpdated, lastUpdatedBy, 
    version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, 
    processStamp, deleted,uWarehouseCode
  </sql>

  <select id="selectListByCreated" resultType="com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader">
      SELECT r.*  from receipt_header r
      inner join task_detail t on t.billCode=r.code and
      t.status>700 and DATEDIFF(NOW(), t.lastUpdated)=0 GROUP BY r.code
    </select>

  <select id="createCode" resultType="java.lang.String">
        SELECT code FROM receipt_header WHERE receiptType = #{receiptType,jdbcType=VARCHAR} ORDER BY id DESC LIMIT 1
  </select>

  <select id="getLatestReceipt" resultType="com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader">
     select * from receipt_header where warehouseCode = #{warehouseCode, jdbcType=VARCHAR}
     and companyCode = #{companyCode, jdbcType= VARCHAR} order by id desc  limit 10
  </select>

  <select id="getExpiredBill" resultType="com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader">
    select * from receipt_header where created &lt; date_sub(curdate(), INTERVAL 30 DAY)
  </select>

  <select id="selectSIComplete" resultType="com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader">
    SELECT *
    FROM `receipt_header`
    WHERE receiptType = "SI"
      and (lastStatus = 800 or lastStatus = 900)
      and userDef3 is null
      and created > date_sub(curdate(), INTERVAL 30 DAY)
  </select>
</mapper>