CyclecountAdjustMapper.xml 11.6 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.cyclecountAdjust.mapper.CyclecountAdjustMapper">
    <select id="selectListEntity" resultType="com.huaheng.pc.inventory.cyclecountAdjust.domain.CyclecountAdjust">
        SELECT ca.id, ca.warehouseId, ca.warehouseCode, ca.companyId, ca.companyCode, ca.code, ca.cyclecountHeadId, ca.created, ca.createdBy, ca.lastUpdated, ca.lastUpdatedBy, ca.status, ca.remark,
        ca.uploadTime, ca.uploadType, ca.enable, ch.code sourceCode
        FROM cyclecount_adjust ca
        INNER JOIN cyclecount_header ch ON ca.cyclecountHeadId = ch.id
        <where>
            <if test="sourceCode != null and sourceCode != '' ">
                AND ch.code = #{sourceCode}
            </if>
            <if test="id != null ">
                AND ca.id = #{id}
            </if>
            <if test="warehouseId != null and warehouseId != '' ">
                AND ca.warehouseId = #{warehouseId}
            </if>
            <if test="warehouseCode != null and warehouseCode != '' ">
                AND ca.warehouseCode = #{warehouseCode}
            </if>
            <if test="companyId != null and companyId != '' ">
                AND ca.companyId = #{companyId}
            </if>
            <if test="companyCode != null and companyCode != '' ">
                AND ca.companyCode = #{companyCode}
            </if>
            <if test="code != null and code != '' ">
                AND ca.code = #{code}
            </if>
            <if test="cyclecountHeadId != null and cyclecountHeadId != '' ">
                AND ca.cyclecountHeadId = #{cyclecountHeadId}
            </if>
            <if test="status != null ">
                AND ca.status = #{status}
            </if>
            <if test="params != null and params.uploadTimeBegin != null and params.uploadTimeBegin != ''">
                AND ca.uploadTime &gt;= #{params.uploadTimeBegin}
            </if>
            <if test="params != null and params.uploadTimeEnd != null and params.uploadTimeEnd != ''">
                AND ca.uploadTime &lt;= #{params.uploadTimeEnd}
            </if>
            <if test="params != null and params.createdBegin != null and params.createdBegin != ''">
                AND ca.created &gt;= #{params.createdBegin}
            </if>
            <if test="params != null and params.createdEnd != null and params.createdEnd != ''">
                AND ca.created &lt;= #{params.createdEnd}
            </if>
            <if test="createdBy != null and createdBy != ''">
                <bind name="createdByPattern" value="'%' + createdBy + '%'" />
                AND ca.createdBy like #{createdByPattern}
            </if>
            <if test="params != null and params.lastUpdatedBegin != null and params.lastUpdatedBegin != ''">
                AND ca.lastUpdated &gt;= #{params.lastUpdatedBegin}
            </if>
            <if test="params != null and params.lastUpdatedEnd != null and params.lastUpdatedEnd != ''">
                AND ca.lastUpdated &lt;= #{params.lastUpdatedEnd}
            </if>
            <if test="lastUpdatedBy != null and lastUpdatedBy != ''">
                <bind name="lastUpdatedByPattern" value="'%' + lastUpdatedBy + '%'" />
                AND ca.lastUpdatedBy like #{lastUpdatedByPattern}
            </if>
            <if test="remark != null and remark != ''">
                AND ca.remark = #{remark}
            </if>
            <if test="uploadTime != null and uploadTime != ''">
                AND ca.uploadTime = #{uploadTime}
            </if>
            <if test="uploadType != null and uploadType != ''">
                AND ca.uploadType = #{uploadType}
            </if>
            <if test="enable != null and uploadType != ''">
                AND ca.enable = #{enable}
            </if>
        </where>
    </select>

    <select id="selectByIdisSourceCode" resultType="com.huaheng.pc.inventory.cyclecountAdjust.domain.CyclecountAdjust">
      SELECT ca.id, ca.warehouseId, ca.warehouseCode, ca.companyId, ca.companyCode, ca.code, ca.cyclecountHeadId, ca.created, ca.createdBy, ca.lastUpdated, ca.lastUpdatedBy, ca.status, ca.remark,
         ca.uploadTime, ca.uploadType,ca.enable, ch.code sourceCode
        FROM cyclecount_adjust ca
        INNER JOIN cyclecount_header ch ON ca.headId = ch.id
        WHERE ca.id = #{id}
  </select>

    <insert id="insertAdjust" parameterType="com.huaheng.pc.inventory.cyclecountAdjust.domain.CyclecountAdjust" keyProperty="id" useGeneratedKeys="true" >
        INSERT INTO cyclecount_adjust
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="warehouseId != null">
                warehouseId,
            </if>
            <if test="warehouseCode != null">
                warehouseCode,
            </if>
            <if test="companyId != null">
                companyId,
            </if>
            <if test="companyCode != null">
                companyCode,
            </if>
            <if test="code != null">
                code,
            </if>
            <if test="cyclecountHeadId != null">
                cyclecountHeadId,
            </if>
            <if test="created != null">
                created,
            </if>
            <if test="createdBy != null">
                createdBy,
            </if>
            <if test="lastUpdated != null">
                lastUpdated,
            </if>
            <if test="lastUpdatedBy != null">
                lastUpdatedBy,
            </if>
            <if test="verifyBy != null">
                verifyBy,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="remark != null">
                remark,
            </if>
            <if test="enable != null">
                enable,
            </if>
            <if test="uploadTime != null">
                uploadTime,
            </if>
            <if test="uploadType != null">
                uploadType,
            </if>
        </trim>
        <trim prefix=" values (" suffix=")" suffixOverrides=",">
            <if test="warehouseId != null">
                #{warehouseId, jdbcType=INTEGER},
            </if>
            <if test="warehouseCode != null">
                #{warehouseCode, jdbcType=VARCHAR},
            </if>
            <if test="companyId != null">
                #{companyId, jdbcType=INTEGER},
            </if>
            <if test="companyCode != null">
                #{companyCode, jdbcType=VARCHAR},
            </if>
            <if test="code != null">
                #{code, jdbcType=VARCHAR},
            </if>
            <if test="cyclecountHeadId != null">
                #{cyclecountHeadId, jdbcType=INTEGER},
            </if>
            <if test="created != null">
                #{created, jdbcType=TIMESTAMP},
            </if>
            <if test="createdBy != null">
                #{createdBy, jdbcType=VARCHAR},
            </if>
            <if test="lastUpdated != null">
                #{lastUpdated, jdbcType=TIMESTAMP},
            </if>
            <if test="lastUpdatedBy != null">
                #{lastUpdatedBy, jdbcType=VARCHAR},
            </if>
            <if test="verifyBy != null">
                #{verifyBy, jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status, jdbcType=INTEGER},
            </if>
            <if test="remark != null">
                #{remark, jdbcType=VARCHAR},
            </if>
            <if test="enable != null">
                #{enable, jdbcType=BIT},
            </if>
            <if test="uploadTime != null">
                #{uploadTime, jdbcType=TIMESTAMP},
            </if>
            <if test="uploadType != null">
                #{uploadType, jdbcType=INTEGER},
            </if>
        </trim>
    </insert>

    <select id="getLastCode" resultType="java.lang.String">
        SELECT code FROM cyclecount_adjust ORDER BY id DESC LIMIT 1
    </select>

    <select id="selectFirstEntity" resultType="com.huaheng.pc.inventory.cyclecountAdjust.domain.CyclecountAdjust">
        SELECT ca.id, ca.warehouseId, ca.warehouseCode, ca.companyId, ca.companyCode, ca.code, ca.cyclecountHeadId, ca.created, ca.createdBy, ca.lastUpdated, ca.lastUpdatedBy, ca.status, ca.remark,
        ca.uploadTime, ca.uploadType, ca.enable, ch.code sourceCode
        FROM cyclecount_adjust ca
        INNER JOIN cyclecount_header ch ON ca.cyclecountHeadId = ch.id
        <where>
            <if test="sourceCode != null and sourceCode != '' ">
                AND ch.code = #{sourceCode}
            </if>
            <if test="id != null ">
                AND ca.id = #{id}
            </if>
            <if test="warehouseId != null and warehouseId != '' ">
                AND ca.warehouseId = #{warehouseId}
            </if>
            <if test="warehouseCode != null and warehouseCode != '' ">
                AND ca.warehouseCode = #{warehouseCode}
            </if>
            <if test="companyId != null and companyId != '' ">
                AND ca.companyId = #{companyId}
            </if>
            <if test="companyCode != null and companyCode != '' ">
                AND ca.companyCode = #{companyCode}
            </if>
            <if test="code != null and code != '' ">
                AND ca.code = #{code}
            </if>
            <if test="cyclecountHeadId != null and cyclecountHeadId != '' ">
                AND ca.cyclecountHeadId = #{cyclecountHeadId}
            </if>
            <if test="status != null ">
                AND ca.status = #{status}
            </if>
            <if test="params != null and params.uploadTimeBegin != null and params.uploadTimeBegin != ''">
                AND ca.uploadTime &gt;= #{params.uploadTimeBegin}
            </if>
            <if test="params != null and params.uploadTimeEnd != null and params.uploadTimeEnd != ''">
                AND ca.uploadTime &lt;= #{params.uploadTimeEnd}
            </if>
            <if test="params != null and params.createdBegin != null and params.createdBegin != ''">
                AND ca.created &gt;= #{params.createdBegin}
            </if>
            <if test="params != null and params.createdEnd != null and params.createdEnd != ''">
                AND ca.created &lt;= #{params.createdEnd}
            </if>
            <if test="createdBy != null and createdBy != ''">
                <bind name="createdByPattern" value="'%' + createdBy + '%'" />
                AND ca.createdBy like #{createdByPattern}
            </if>
            <if test="params != null and params.lastUpdatedBegin != null and params.lastUpdatedBegin != ''">
                AND ca.lastUpdated &gt;= #{params.lastUpdatedBegin}
            </if>
            <if test="params != null and params.lastUpdatedEnd != null and params.lastUpdatedEnd != ''">
                AND ca.lastUpdated &lt;= #{params.lastUpdatedEnd}
            </if>
            <if test="lastUpdatedBy != null and lastUpdatedBy != ''">
                <bind name="lastUpdatedByPattern" value="'%' + lastUpdatedBy + '%'" />
                AND ca.lastUpdatedBy like #{lastUpdatedByPattern}
            </if>
            <if test="remark != null and remark != ''">
                AND ca.remark = #{remark}
            </if>
            <if test="enable != null and enable != ''">
                AND ca.enable = #{enable}
            </if>
            <if test="uploadTime != null and uploadTime != ''">
                AND ca.uploadTime = #{uploadTime}
            </if>
            <if test="uploadType != null and uploadType != ''">
                AND ca.uploadType = #{uploadType}
            </if>
        </where>
    </select>
</mapper>