Lius
2024-08-12 16e35b191d910e5e586a9eae5678324bfa679408
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProcessQuantityMapper.xml
@@ -2,4 +2,154 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mdc.mapper.MdcProcessQuantityMapper">
    <!--分页查询-->
    <select id="pageList" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto">
        SELECT
            t1.id id,
            t3.equipment_id equipmentId,
            t3.equipment_name equipmentName,
            t2.parts_code partsCode,
            t2.batch_code batchCode,
            t2.sequence_number sequenceNumber,
            t1.standard_id standardId,
            t1.efficient_date efficientDate,
            t1.process_quantity processQuantity,
            t2.duration duration,
            t1.remark remark,
            t1.create_by createBy,
            t1.create_time createTime,
            t1.update_by updateBy,
            t1.update_time updateTime
        FROM
            mdc_process_quantity t1
            LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id
            LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id
        <where>
            <if test="mdcProcessQuantity.equipmentId != null and mdcProcessQuantity.equipmentId != ''">
                AND t3.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%')
            </if>
            <if test="mdcProcessQuantity.equipmentName != null and mdcProcessQuantity.equipmentName != ''">
                AND t3.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%')
            </if>
            <if test="mdcProcessQuantity.partsCode != null and mdcProcessQuantity.partsCode != ''">
                AND t2.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%')
            </if>
            <if test="mdcProcessQuantity.batchCode != null and mdcProcessQuantity.batchCode != ''">
                AND t2.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%')
            </if>
            <if test="mdcProcessQuantity.sequenceNumber != null and mdcProcessQuantity.sequenceNumber != ''">
                AND t2.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%')
            </if>
            <if test="mdcProcessQuantity.startTime != null and mdcProcessQuantity.endTime != null">
                AND t1.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime }
            </if>
            <if test="mdcProcessQuantity.processQuantity != null and mdcProcessQuantity.processQuantity != ''">
                AND t1.process_quantity = #{ mdcProcessQuantity.processQuantity }
            </if>
            <if test="mdcProcessQuantity.mdcSectionIds != null and mdcProcessQuantity.mdcSectionIds.size() > 0 ">
                AND t3.equipment_id IN
                <foreach collection="mdcProcessQuantity.mdcSectionIds" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
        </where>
        ORDER BY t3.equipment_name ASC, t1.efficient_date DESC
    </select>
    <!--导出数据查询-->
    <select id="list" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto">
        SELECT
        t1.id id,
        t3.equipment_id equipmentId,
        t3.equipment_name equipmentName,
        t2.parts_code partsCode,
        t2.batch_code batchCode,
        t2.sequence_number sequenceNumber,
        t1.standard_id standardId,
        t1.efficient_date efficientDate,
        t1.process_quantity processQuantity,
        t2.duration duration,
        t1.remark remark,
        t1.create_by createBy,
        t1.create_time createTime,
        t1.update_by updateBy,
        t1.update_time updateTime
        FROM
        mdc_process_quantity t1
        LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id
        LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id
        <where>
            <if test="mdcProcessQuantity.equipmentId != null and mdcProcessQuantity.equipmentId != ''">
                AND t3.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%')
            </if>
            <if test="mdcProcessQuantity.equipmentName != null and mdcProcessQuantity.equipmentName != ''">
                AND t3.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%')
            </if>
            <if test="mdcProcessQuantity.partsCode != null and mdcProcessQuantity.partsCode != ''">
                AND t2.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%')
            </if>
            <if test="mdcProcessQuantity.batchCode != null and mdcProcessQuantity.batchCode != ''">
                AND t2.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%')
            </if>
            <if test="mdcProcessQuantity.sequenceNumber != null and mdcProcessQuantity.sequenceNumber != ''">
                AND t2.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%')
            </if>
            <if test="mdcProcessQuantity.startTime != null and mdcProcessQuantity.endTime != null">
                AND t1.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime }
            </if>
            <if test="mdcProcessQuantity.processQuantity != null and mdcProcessQuantity.processQuantity != ''">
                AND t1.process_quantity = #{ mdcProcessQuantity.processQuantity }
            </if>
            <if test="mdcProcessQuantity.mdcSectionIds != null and mdcProcessQuantity.mdcSectionIds.size() > 0 ">
                AND t3.equipment_id IN
                <foreach collection="mdcProcessQuantity.mdcSectionIds" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
        </where>
        ORDER BY t3.equipment_name ASC, t1.efficient_date DESC
    </select>
    <!--根据id查询-->
    <select id="findById" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto">
        SELECT
            t1.id id,
            t3.equipment_id equipmentId,
            t3.equipment_name equipmentName,
            t2.parts_code partsCode,
            t2.batch_code batchCode,
            t2.sequence_number sequenceNumber,
            t1.standard_id standardId,
            t1.efficient_date efficientDate,
            t1.process_quantity processQuantity,
            t2.duration duration,
            t1.remark remark,
            t1.create_by createBy,
            t1.create_time createTime,
            t1.update_by updateBy,
            t1.update_time updateTime
        FROM mdc_process_quantity t1
            LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id
            LEFT JOIN mdc_equipment t3 ON t1.equipment_id = t3.equipment_id
        WHERE t1.id = #{ id }
    </select>
    <select id="findList" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto">
        SELECT
            t1.id id,
            t1.equipment_id equipmentId,
            t2.parts_code partsCode,
            t2.batch_code batchCode,
            t2.sequence_number sequenceNumber,
            t1.standard_id standardId,
            t1.efficient_date efficientDate,
            t1.process_quantity processQuantity,
            t2.duration duration
        FROM
            mdc_process_quantity t1
                LEFT JOIN mdc_standard_process_duration t2 ON t1.standard_id = t2.id
        WHERE
            t1.equipment_id = #{equipmentId}
            AND t1.efficient_date LIKE CONCAT(CONCAT('%',#{ validDate }),'%')
    </select>
</mapper>