RtInventoryMapper.xml 1.7 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.eport.rest.dao.report.RtInventoryDao">

    <sql id="Columns">
        a.IN_TIME AS "inTime"
        ,a.COP_G_NO AS "copGNo"
        ,a.G_NO AS "gNo"
        ,SUM(a.NUM_VAL) as "numVal"
        ,SUM(a.OUT_VAL) as "outVal"
    </sql>

    <select id="findItemMat" parameterType="HashMap"
            resultType="com.eport.rest.entity.report.RtInventoryEntity">
        SELECT
        <include refid="Columns"/>
        FROM ept_in_storage a
        WHERE 1=1
        AND a.COP_G_NO = ''
        <if test="gNo != null">
            AND a.G_NO = #{gNo}
        </if>
        <if test="startTime !=null and startTime!=''">
            AND a.IN_TIME &gt;=#{startTime}
        </if>
        <if test="endTime !=null and endTime!=''">
            AND a.IN_TIME &lt;=#{endTime}
        </if>
        GROUP BY a.IN_TIME,a.G_NO,a.COP_G_NO
        ORDER BY a.IN_TIME ASC
    </select>

    <select id="findMat" parameterType="HashMap"
            resultType="com.eport.rest.entity.report.RtInventoryEntity">
        SELECT
        <include refid="Columns"/>
        FROM ept_in_storage a
        WHERE 1=1
        <if test="copGNo != null">
            AND a.COP_G_NO = #{copGNo}
        </if>
        <if test="gNo != null">
            AND a.G_NO = #{gNo}
        </if>
        <if test="startTime !=null and startTime!=''">
            AND a.IN_TIME &gt;=#{startTime}
        </if>
        <if test="endTime !=null and endTime!=''">
            AND a.IN_TIME &lt;=#{endTime}
        </if>
        GROUP BY a.IN_TIME,a.G_NO,a.COP_G_NO
        ORDER BY a.IN_TIME ASC
    </select>

</mapper>