| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="qualityInspectExportByIds" resultType="com.ruoyi.quality.pojo.QualityInspect"> |
| | | SELECT |
| | | qi.*, |
| | | <choose> |
| | | <when test="qualityInspect.inspectType == 0"> |
| | | pl.purchase_contract_number as purchase_contract_no |
| | | </when> |
| | | <otherwise> |
| | | pwo.work_order_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 |
| | | </otherwise> |
| | | </choose> |
| | | WHERE qi.inspect_type=#{qualityInspect.inspectType} |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND qi.id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="qualityInspect.supplier != null and qualityInspect.supplier != '' "> |
| | | AND qi.supplier like concat('%',#{qualityInspect.supplier},'%') |
| | | </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> |
| | | |
| | | <delete id="deleteByProductMainIds"> |
| | | DELETE FROM quality_inspect |
| | | WHERE product_main_id IN |