| | |
| | | <?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.pojo.QualityInspect"> |
| | | <select id="qualityInspectListPage" resultType="com.ruoyi.quality.dto.QualityInspectDto"> |
| | | SELECT |
| | | * |
| | | FROM quality_inspect |
| | | where |
| | | qi.*, |
| | | <choose> |
| | | <when test="qualityInspect.inspectType == 0"> |
| | | pl.purchase_contract_number as purchase_contract_no |
| | | </when> |
| | | <otherwise> |
| | | pot.work_order_no, |
| | | po_sales.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 production_operation_task pot ON ppm.production_operation_task_id = pot.id |
| | | left join production_order po ON po.id = pot.production_order_id |
| | | left join ( |
| | | select po2.id as order_id, |
| | | group_concat(distinct sl2.sales_contract_no order by sl2.sales_contract_no separator ',') as sales_contract_no |
| | | from production_order po2 |
| | | left join production_plan pp2 |
| | | on find_in_set(pp2.id, replace(replace(replace(po2.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0 |
| | | left join sales_ledger sl2 on sl2.id = pp2.sales_ledger_id |
| | | group by po2.id |
| | | ) po_sales ON po_sales.order_id = po.id |
| | | </otherwise> |
| | | </choose> |
| | | WHERE |
| | | inspect_type=#{qualityInspect.inspectType} |
| | | <if test="qualityInspect.supplier != null and qualityInspect.supplier != '' "> |
| | | AND supplier like concat('%',#{qualityInspect.supplier},'%') |
| | | AND qi.supplier like concat('%',#{qualityInspect.supplier},'%') |
| | | </if> |
| | | <if test="qualityInspect.customer != null and qualityInspect.customer != '' "> |
| | | AND customer like concat('%',#{qualityInspect.customer},'%') |
| | | AND qi.customer like concat('%',#{qualityInspect.customer},'%') |
| | | </if> |
| | | <if test="qualityInspect.process != null and qualityInspect.process != '' "> |
| | | AND process like concat('%',#{qualityInspect.process},'%') |
| | | AND qi.process like concat('%',#{qualityInspect.process},'%') |
| | | </if> |
| | | <if test="qualityInspect.productName != null and qualityInspect.productName != '' "> |
| | | AND product_name like concat('%',#{qualityInspect.productName},'%') |
| | | AND qi.product_name like concat('%',#{qualityInspect.productName},'%') |
| | | </if> |
| | | <if test="qualityInspect.entryDateStart != null and qualityInspect.entryDateStart != '' "> |
| | | AND check_time >= DATE_FORMAT(#{qualityInspect.entryDateStart},'%Y-%m-%d') |
| | | AND qi.check_time >= DATE_FORMAT(#{qualityInspect.entryDateStart},'%Y-%m-%d') |
| | | </if> |
| | | <if test="qualityInspect.entryDateEnd != null and qualityInspect.entryDateEnd != '' "> |
| | | AND check_time <= DATE_FORMAT(#{qualityInspect.entryDateEnd},'%Y-%m-%d') |
| | | AND qi.check_time <= DATE_FORMAT(#{qualityInspect.entryDateEnd},'%Y-%m-%d') |
| | | </if> |
| | | ORDER BY check_time DESC |
| | | ORDER BY qi.check_time DESC |
| | | </select> |
| | | |
| | | <select id="qualityInspectExport" resultType="com.ruoyi.quality.pojo.QualityInspect"> |
| | | SELECT |
| | | * |