| | |
| | | <?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.ruoyi.quality.mapper.QualityInspectMapper"> |
| | | <!-- <select id="qualityInspectListPage" resultType="com.ruoyi.quality.dto.QualityInspectDto">--> |
| | | <!-- SELECT--> |
| | | <!-- qi.*,--> |
| | | <!-- <choose>--> |
| | | <!-- <when test="qualityInspect.inspectType == 0">--> |
| | | <!-- pl.purchase_contract_number as purchase_contract_no--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- pwo.work_order_no,--> |
| | | <!-- sl.sales_contract_no--> |
| | | <!-- </otherwise>--> |
| | | <!-- </choose>--> |
| | | <!-- FROM--> |
| | | <!-- quality_inspect qi--> |
| | | <!-- <choose>--> |
| | | <!-- <when test="qualityInspect.inspectType == 0 ">--> |
| | | <!-- LEFT JOIN purchase_ledger pl ON pl.id = qi.purchase_ledger_id--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- LEFT JOIN production_product_main ppm ON qi.product_main_id = ppm.id--> |
| | | <!-- LEFT JOIN product_work_order pwo ON ppm.work_order_id = pwo.id--> |
| | | <!-- left join product_order po ON po.id = pwo.product_order_id--> |
| | | <!-- left join sales_ledger sl ON sl.id = po.sales_ledger_id--> |
| | | <!-- </otherwise>--> |
| | | <!-- </choose>--> |
| | | <!-- WHERE--> |
| | | <!-- inspect_type=#{qualityInspect.inspectType}--> |
| | | <!-- <if test="qualityInspect.supplier != null and qualityInspect.supplier != '' ">--> |
| | | <!-- AND qi.supplier like concat('%',#{qualityInspect.supplier},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.customer != null and qualityInspect.customer != '' ">--> |
| | | <!-- AND qi.customer like concat('%',#{qualityInspect.customer},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.process != null and qualityInspect.process != '' ">--> |
| | | <!-- AND qi.process like concat('%',#{qualityInspect.process},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.productName != null and qualityInspect.productName != '' ">--> |
| | | <!-- AND qi.product_name like concat('%',#{qualityInspect.productName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.entryDateStart != null and qualityInspect.entryDateStart != '' ">--> |
| | | <!-- AND qi.check_time >= DATE_FORMAT(#{qualityInspect.entryDateStart},'%Y-%m-%d')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.entryDateEnd != null and qualityInspect.entryDateEnd != '' ">--> |
| | | <!-- AND qi.check_time <= DATE_FORMAT(#{qualityInspect.entryDateEnd},'%Y-%m-%d')--> |
| | | <!-- </if>--> |
| | | <!-- ORDER BY qi.check_time DESC--> |
| | | <!-- </select>--> |
| | | <!-- 新sql 用中间表sales_ledger_production_ref进行关联sales_ledger和product_order,查询出所有关联的sales_ledger_no--> |
| | | <select id="qualityInspectListPage" resultType="com.ruoyi.quality.dto.QualityInspectDto"> |
| | | SELECT |
| | | qi.*, |
| | |
| | | </when> |
| | | <otherwise> |
| | | pwo.work_order_no, |
| | | sl.sales_contract_no |
| | | (SELECT GROUP_CONCAT(DISTINCT sl_inner.sales_contract_no SEPARATOR ',') |
| | | FROM sales_ledger sl_inner |
| | | INNER JOIN sales_ledger_production_ref ref ON sl_inner.id = ref.sales_ledger_id |
| | | WHERE ref.product_order_id = po.id) AS sales_contract_no |
| | | </otherwise> |
| | | </choose> |
| | | FROM |
| | |
| | | LEFT JOIN production_product_main ppm ON qi.product_main_id = ppm.id |
| | | LEFT JOIN product_work_order pwo ON ppm.work_order_id = pwo.id |
| | | left join product_order po ON po.id = pwo.product_order_id |
| | | left join sales_ledger sl ON sl.id = po.sales_ledger_id |
| | | </otherwise> |
| | | </choose> |
| | | WHERE |