| | |
| | | |
| | | <select id="findInsSampleAndOrder" resultType="com.ruoyi.inspect.vo.InsOrderPlanVO"> |
| | | select * from( |
| | | select * from( |
| | | SELECT a.*,ios.ins_state,ios.verify_tell,verify_user |
| | | FROM |
| | | ( |
| | | SELECT |
| | | io.id, |
| | | io.entrust_code, |
| | | io.type, |
| | | io.appointed, |
| | | io.send_time, |
| | | io.order_type, |
| | | case when |
| | | io.type_source = 0 |
| | | then io.sample_view |
| | | else io.sample end sample, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | T4.userName, |
| | | ip.son_laboratory, |
| | | io.ins_time, |
| | | io.laboratory, |
| | | io.type_source, |
| | | io.ifs_inventory_id, |
| | | ira.id ins_report_id, |
| | | ira.url, |
| | | ira.url_s, |
| | | ira.temp_url_pdf, |
| | | iiq.is_copper |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id |
| | | LEFT JOIN ins_report ira ON ira.ins_order_id = io.id |
| | | LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id |
| | | LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id |
| | | LEFT JOIN ins_sample_user isu ON isa.id = isu.user_id |
| | | LEFT JOIN user uu ON ip.check_user_id = uu.id |
| | | LEFT JOIN ( |
| | | SELECT T1.ins_order_id,GROUP_CONCAT( DISTINCT T3.name SEPARATOR ', ' ) AS userName FROM ins_sample T1 LEFT JOIN ins_product T2 ON T1.id = T2.ins_sample_id LEFT JOIN user T3 ON T2.check_user_id = T3.id GROUP BY T1.ins_order_id |
| | | ) T4 ON T4.ins_order_id = io.id |
| | | WHERE io.state = 1 and send_time is not null |
| | | -- 非检测管理员 |
| | | <if test="otherParam.testAdminFlag != null and !otherParam.testAdminFlag"> |
| | | <if test="otherParam.checkUserFlag != null and otherParam.checkUserFlag"> |
| | | AND ( |
| | | isu.user_id = #{otherParam.userId} OR ip.check_user_id = #{otherParam.userId} |
| | | ) |
| | | </if> |
| | | </if> |
| | | -- 是检测管理员 |
| | | <if test="otherParam.testAdminFlag != null and otherParam.testAdminFlag"> |
| | | <if test="otherParam.viewMySelfFlag != null and otherParam.viewMySelfFlag"> |
| | | AND ( |
| | | isu.user_id = #{otherParam.userId} OR ip.check_user_id = #{otherParam.userId} |
| | | ) |
| | | </if> |
| | | </if> |
| | | GROUP BY io.id |
| | | ) a |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory |
| | | ORDER BY a.type DESC,a.id |
| | | ) b |
| | | where ins_state is not null |
| | | select * from( |
| | | SELECT a.*,ios.ins_state,ios.verify_tell,verify_user |
| | | FROM |
| | | ( |
| | | SELECT |
| | | io.id, |
| | | io.entrust_code, |
| | | io.type, |
| | | io.appointed, |
| | | io.send_time, |
| | | io.order_type, |
| | | io.work_shop_id, |
| | | case when |
| | | io.type_source = 0 |
| | | then io.sample_view |
| | | else io.sample end sample, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | T4.userName, |
| | | ip.son_laboratory, |
| | | io.ins_time, |
| | | io.laboratory, |
| | | io.type_source, |
| | | io.ifs_inventory_id, |
| | | ira.id ins_report_id, |
| | | ira.url, |
| | | ira.url_s, |
| | | ira.temp_url_pdf, |
| | | iiq.is_copper |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id |
| | | LEFT JOIN ins_report ira ON ira.ins_order_id = io.id |
| | | LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id |
| | | LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id |
| | | LEFT JOIN ins_sample_user isu ON isa.id = isu.user_id |
| | | LEFT JOIN user uu ON ip.check_user_id = uu.id |
| | | LEFT JOIN ( |
| | | SELECT T1.ins_order_id,GROUP_CONCAT( DISTINCT T3.name SEPARATOR ', ' ) AS userName FROM ins_sample T1 LEFT JOIN |
| | | ins_product T2 ON T1.id = T2.ins_sample_id LEFT JOIN user T3 ON T2.check_user_id = T3.id GROUP BY |
| | | T1.ins_order_id |
| | | ) T4 ON T4.ins_order_id = io.id |
| | | WHERE io.state = 1 and send_time is not null |
| | | -- 非检测管理员 |
| | | <if test="otherParam.testAdminFlag != null and !otherParam.testAdminFlag"> |
| | | <if test="otherParam.checkUserFlag != null and otherParam.checkUserFlag"> |
| | | AND ( |
| | | isu.user_id = #{otherParam.userId} OR ip.check_user_id = #{otherParam.userId} |
| | | ) |
| | | </if> |
| | | </if> |
| | | -- 是检测管理员 |
| | | <if test="otherParam.testAdminFlag != null and otherParam.testAdminFlag"> |
| | | <if test="otherParam.viewMySelfFlag != null and otherParam.viewMySelfFlag"> |
| | | AND ( |
| | | isu.user_id = #{otherParam.userId} OR ip.check_user_id = #{otherParam.userId} |
| | | ) |
| | | </if> |
| | | </if> |
| | | GROUP BY io.id |
| | | ) a |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory |
| | | ORDER BY a.type DESC,a.id |
| | | ) b |
| | | where ins_state is not null |
| | | )A |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |