InventoryTransactionMapper.xml 7.21 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.inventory.inventoryTransaction.mapper.InventoryTransactionMapper">
    <select id="selectListEntityByLike" resultType="com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction">
        SELECT i.id, i.warehouseId, i.warehouseCode, i.locationId, i.locationCode, i.sourceCode, i.sourceLine, i.type, i.companyId,
        i.companyCode, i.billId, i.billCode, i.billDetailId, i.batch, i.lot, i.project, i.manufactureDate, i.expirationDate, i.status,
        i.qty, i.taskQty, i.costPrice, i.listPrice, i.netPrice, i.created, i.createdBy, i.lastUpdated, i.lastUpdatedBy, i.userDef1,
        i.userDef2, i.userDef3, i.materialId, i.materialCode, m.name AS 'materialName',m.specification as 'materialSpec'
        FROM inventory_transaction i
        INNER JOIN material m ON i.materialCode = m.code
        <if test="id != null ">
            AND i.id = #{id}
        </if>
        <if test="warehouseId != null ">
            AND i.warehouseId = #{warehouseId}
        </if>
        <if test="warehouseCode != null and warehouseCode != ''">
            <bind name="warehouseCodePattern" value="'%' + warehouseCode + '%'" />
            AND i.warehouseCode like #{warehouseCodePattern}
        </if>
        <if test="locationId != null ">
            AND i.locationId = #{locationId}
        </if>
        <if test="locationCode != null and locationCode != ''">
            <bind name="locationCodePattern" value="'%' + locationCode + '%'" />
            AND i.locationCode like #{locationCodePattern}
        </if>
        <if test="sourceCode != null and sourceCode != ''">
            <bind name="sourceCodePattern" value="'%' + sourceCode + '%'" />
            AND i.sourceCode like #{sourceCodePattern}
        </if>
        <if test="sourceLine != null and sourceLine != ''">
            <bind name="sourceLinePattern" value="'%' + sourceLine + '%'" />
            AND i.sourceLine like #{sourceLinePattern}
        </if>
        <if test="type != null and type != ''">
            <bind name="typePattern" value="'%' + type + '%'" />
            AND i.type like #{typePattern}
        </if>
        <if test="companyId != null ">
            AND i.companyId = #{companyId}
        </if>
        <if test="companyCode != null and companyCode != ''">
            <bind name="companyCodePattern" value="'%' + companyCode + '%'" />
            AND i.companyCode like #{companyCodePattern}
        </if>
        <if test="materialId != null ">
            AND i.materialId = #{materialId}
        </if>
        <if test="materialCode != null and materialCode != ''">
            <bind name="materialCodePattern" value="'%' + materialCode + '%'" />
            AND i.materialCode like #{materialCodePattern}
        </if>
        <if test="billId != null ">
            AND i.billId = #{billId}
        </if>
        <if test="billCode != null and billCode != ''">
            <bind name="billCodePattern" value="'%' + billCode + '%'" />
            AND i.billCode like #{billCodePattern}
        </if>
        <if test="billDetailId != null ">
            AND i.billDetailId = #{billDetailId}
        </if>
        <if test="batch != null and batch != ''">
            <bind name="batchPattern" value="'%' + batch + '%'" />
            AND i.batch like #{batchPattern}
        </if>
        <if test="lot != null and lot != ''">
            <bind name="lotPattern" value="'%' + lot + '%'" />
            AND i.lot like #{lotPattern}
        </if>
        <if test="project != null and project != ''">
            <bind name="projectPattern" value="'%' + project + '%'" />
            AND i.project like #{projectPattern}
        </if>
        <if test="params != null and params.manufactureDateBegin != null and params.manufactureDateBegin != ''">
            AND i.manufactureDate &gt;= #{params.manufactureDateBegin}
        </if>
        <if test="params != null and params.manufactureDateEnd != null and params.manufactureDateEnd != ''">
            AND i.manufactureDate &lt;= #{params.manufactureDateEnd}
        </if>
        <if test="params != null and params.expirationDateBegin != null and params.expirationDateBegin != ''">
            AND i.expirationDate &gt;= #{params.expirationDateBegin}
        </if>
        <if test="params != null and params.expirationDateEnd != null and params.expirationDateEnd != ''">
            AND i.expirationDate &lt;= #{params.expirationDateEnd}
        </if>
        <if test="status != null and status != ''">
            <bind name="statusPattern" value="'%' + status + '%'" />
            AND i.status like #{statusPattern}
        </if>
        <if test="qty != null ">
            AND i.qty = #{qty}
        </if>
        <if test="taskQty != null ">
            AND i.taskQty = #{taskQty}
        </if>
        <if test="costPrice != null ">
            AND i.costPrice = #{costPrice}
        </if>
        <if test="listPrice != null ">
            AND i.listPrice = #{listPrice}
        </if>
        <if test="netPrice != null ">
            AND i.netPrice = #{netPrice}
        </if>
        <if test="params != null and params.createdBegin != null and params.createdBegin != ''">
            AND i.created &gt;= #{params.createdBegin}
        </if>
        <if test="params != null and params.createdEnd != null and params.createdEnd != ''">
            AND i.created &lt;= #{params.createdEnd}
        </if>
        <if test="createdBy != null and createdBy != ''">
            <bind name="createdByPattern" value="'%' + createdBy + '%'" />
            AND i.createdBy like #{createdByPattern}
        </if>
        <if test="params != null and params.lastUpdatedBegin != null and params.lastUpdatedBegin != ''">
            AND i.lastUpdated &gt;= #{params.lastUpdatedBegin}
        </if>
        <if test="params != null and params.lastUpdatedEnd != null and params.lastUpdatedEnd != ''">
            AND i.lastUpdated &lt;= #{params.lastUpdatedEnd}
        </if>
        <if test="lastUpdatedBy != null and lastUpdatedBy != ''">
            <bind name="lastUpdatedByPattern" value="'%' + lastUpdatedBy + '%'" />
            AND i.lastUpdatedBy like #{lastUpdatedByPattern}
        </if>
        <if test="userDef1 != null and userDef1 != ''">
            <bind name="userDef1Pattern" value="'%' + userDef1 + '%'" />
            AND i.userDef1 like #{userDef1Pattern}
        </if>
        <if test="userDef2 != null and userDef2 != ''">
            <bind name="userDef2Pattern" value="'%' + userDef2 + '%'" />
            AND i.userDef2 like #{userDef2Pattern}
        </if>
        <if test="userDef3 != null and userDef3 != ''">
            <bind name="userDef3Pattern" value="'%' + userDef3 + '%'" />
            AND i.userDef3 like #{userDef3Pattern}
        </if>
        <if test="materialName != null and materialName != ''">
            <bind name="materialNamePattern" value="'%' + materialName + '%'" />
            AND m.name like #{materialNamePattern}
        </if>
        <if test="materialSpec != null and materialSpec != ''">
            <bind name="materialSpecPattern" value="'%' + materialSpec + '%'" />
            AND m.specification like #{materialSpecPattern}
        </if>
    </select>
</mapper>