gongchunyi
3 天以前 423ac2a5e7e451248d8cdfc2cda3f32dba0ec8f8
src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -12,6 +12,7 @@
        <result property="applyNo" column="apply_no"/>
        <result property="customerName" column="customer_name"/>
        <result property="materialCode" column="material_code"/>
        <result property="productMaterialId" column="product_material_id"/>
        <result property="productName" column="product_name"/>
        <result property="productSpec" column="product_spec"/>
        <result property="length" column="length"/>
@@ -34,13 +35,61 @@
        <result property="dataSourceType" column="data_source_type"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="totalCount" column="total_count"/>
    </resultMap>
    <select id="listPage" resultMap="ProductionPlanResultMap">
    <select id="listPage" resultType="com.ruoyi.productionPlan.dto.ProductionPlanDto">
        SELECT *
        FROM production_plan
        FROM production_plan pp
        WHERE 1 = 1
        <if test="c.customerName != null and c.customerName != '' ">
            AND pp.customer_name LIKE CONCAT('%',#{c.customerName},'%')
        </if>
        <if test="c.productName != null and c.productName != '' ">
            AND pp.product_name LIKE CONCAT('%',#{c.productName},'%')
        </if>
        <if test="c.productSpec != null and c.productSpec != '' ">
            AND pp.product_spec LIKE CONCAT('%',#{c.productSpec},'%')
        </if>
        <if test="c.materialCode != null and c.materialCode != '' ">
            AND pp.material_code LIKE CONCAT('%',#{c.materialCode},'%')
        </if>
        <if test="c.startDate != null">
            AND pp.start_date &gt;= DATE_FORMAT(#{c.startDate},'%Y-%m-%d')
        </if>
        <if test="c.endDate != null">
            AND pp.end_date &lt;= DATE_FORMAT(#{c.endDate},'%Y-%m-%d')
        </if>
    </select>
    <select id="selectSummaryByProductType" resultType="com.ruoyi.productionPlan.dto.ProductionPlanSummaryDto">
        SELECT
        material_code,
        product_name,
        product_spec,
        length,
        width,
        height,
        COALESCE(SUM(quantity),0) AS quantity,
        COALESCE(SUM(volume),0) AS volume
        FROM production_plan
        <where>
            <if test="materialCode != null and materialCode != ''">
                AND material_code LIKE CONCAT('%', #{materialCode}, '%')
            </if>
            <if test="productName != null and productName != ''">
                AND product_name LIKE CONCAT('%', #{productName}, '%')
            </if>
        </where>
        GROUP BY
        material_code,
        product_name,
        product_spec,
        length,
        width,
        height
    </select>
</mapper>