ReceiptContainerHeaderMapper.xml 2.47 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.receiptContainerHeader.mapper.ReceiptContainerHeaderMapper">
    <select id="selectUnCompletedReceiptContainer" resultType="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader">
        SELECT id, receiptContainerCode, warehouseId, warehouseCode, taskType, status, created, createdBy
        FROM receipt_container_header
        WHERE status &lt; 40
        <if test="id != null ">
            AND id = #{id}
        </if>
        <if test="receiptContainerCode != null and receiptContainerCode != ''">
            <bind name="receiptContainerCodePattern" value="'%' + receiptContainerCode + '%'" />
            AND receiptContainerCode like #{receiptContainerCodePattern}
        </if>
        <if test="warehouseId != null ">
            AND warehouseId = #{warehouseId}
        </if>
        <if test="warehouseCode != null and warehouseCode != ''">
            <bind name="warehouseCodePattern" value="'%' + warehouseCode + '%'" />
            AND warehouseCode like #{warehouseCodePattern}
        </if>
        <if test="taskType != null ">
            AND taskType = #{taskType}
        </if>
        <if test="params != null and params.createdBegin != null and params.createdBegin != ''">
            AND created &gt;= #{params.createdBegin}
        </if>
        <if test="params != null and params.createdEnd != null and params.createdEnd != ''">
            AND created &lt;= #{params.createdEnd}
        </if>
        <if test="createdBy != null and createdBy != ''">
            <bind name="createdByPattern" value="'%' + createdBy + '%'" />
            AND createdBy like #{createdByPattern}
        </if>
    </select>

    <select id="getDetail" resultType="java.util.Map">
        SELECT d.id, d.receiptId, d.receiptCode, d.materialCode, d.qtyCompleted, d.qty, m.name, s.dictLabel inventoryStatus, '个' unit
        FROM receipt_detail d
        INNER JOIN material m ON d.materialCode = m.code and m.deleted = FALSE AND d.receiptCode = #{code}
        INNER JOIN sys_dict_data s ON s.dictType = 'inventoryStatus' AND d.inventoryStatus = s.dictValue AND s.enable = TRUE AND s.deleted = FALSE
    </select>

    <select id="CheckContainer" resultType="java.lang.Integer">
        SELECT COUNT(*) AS count FROM task WHERE lastStatus &lt; 40 AND containerCode = #{containerCode}
    </select>


</mapper>