| | |
| | | <result property="remark" column="remark"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="selectSampleDefectsMap" type="com.yuanchu.mom.vo.SampleDefectsFatherVo"> |
| | | <id column="id" property="id"/> |
| | | <result column="sample" property="sample"/> |
| | | <association property="children" resultMap="SampleDefectsChildrenMap" javaType="java.util.List"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="SampleDefectsChildrenMap" type="com.yuanchu.mom.vo.SampleDefectsChildrenVo"> |
| | | <result column="entrust_code" property="entrust_code" /> |
| | | <result column="inspection_item" property="inspection_item" /> |
| | | <result column="name" property="name"/> |
| | | <result column="create_time" property="create_time" /> |
| | | </resultMap> |
| | | <select id="selectInsOrderParameter" resultType="com.yuanchu.mom.pojo.InsOrder"> |
| | | select * |
| | | from ( |
| | |
| | | <select id="selectSampleAndProductByOrderId" resultType="com.yuanchu.mom.dto.SampleProductDto2"> |
| | | select * |
| | | from ( |
| | | select i.id,isa.sample_code,isa.sample,isa.model,ip.state,ip.unit,ip.inspection_item,ip.inspection_item_subclass, |
| | | select i.id,isa.sample_code,isa.sample,isa.model,isa.ins_state,ip.state,ip.unit,ip.inspection_item,ip.inspection_item_subclass, |
| | | ip.son_laboratory,ip.inspection_item_type,ip.inspection_value_type,ip.ask,ip.`last_value`,ip.ins_result,ipr.equip_value |
| | | from ins_sample isa |
| | | left join ins_order i on isa.ins_order_id = i.id |
| | |
| | | isa.sample, |
| | | isa.model, |
| | | c.price, |
| | | ip.inspection_item, |
| | | c.cost, |
| | | c.inspection_item, |
| | | u.company, |
| | | u.`name`, |
| | | i.create_user, |
| | |
| | | FROM |
| | | ins_order i |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id |
| | | LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id |
| | | LEFT JOIN `user` u ON u.id = i.user_id |
| | | LEFT JOIN (select SUM(b.price) price,b.ins_sample_id from (select * from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where ip.state = 1 |
| | | LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item SEPARATOR ',') |
| | | inspection_item from (select * from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | |
| | | </where> |
| | | </update> |
| | | |
| | | <select id="selectSampleDefects" resultMap="selectSampleDefectsMap"> |
| | | SELECT io.entrust_code,sam.sample,ip.inspection_item,u.name,b.create_time, sam.id |
| | | from ins_order io |
| | | left JOIN ins_sample sam on io.id=sam.ins_order_id |
| | | LEFT JOIN ins_product ip on ip.ins_sample_id=sam.id |
| | | LEFT JOIN |
| | | (SELECT create_time,create_user,ins_product_id FROM (select * FROM ins_product_user ORDER BY ins_product_user.create_time DESC) a GROUP BY a.ins_product_id) b |
| | | on b.ins_product_id=ip.id |
| | | left JOIN `user` u on u.id=b.create_user |
| | | WHERE (ip.ins_result=0 OR ip.state=0) |
| | | <if test="inspectionItems != null and inspectionItems != ''"> |
| | | and inspection_item like concat('%', #{inspectionItems}, '%') |
| | | </if> |
| | | <if test="orderNumber != null and orderNumber != ''"> |
| | | and io.entrust_code like concat('%', #{orderNumber}, '%') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getCount" resultType="long"> |
| | | select count(1) |
| | | from ( |
| | | SELECT io.entrust_code,sam.sample,ip.inspection_item,u.name,b.create_time, sam.id |
| | | from ins_order io |
| | | left JOIN ins_sample sam on io.id=sam.ins_order_id |
| | | LEFT JOIN ins_product ip on ip.ins_sample_id=sam.id |
| | | LEFT JOIN |
| | | (SELECT create_time,create_user,ins_product_id FROM (select * FROM ins_product_user ORDER BY ins_product_user.create_time DESC) a GROUP BY a.ins_product_id) b |
| | | on b.ins_product_id=ip.id |
| | | left JOIN `user` u on u.id=b.create_user |
| | | where (ip.ins_result=0 OR ip.state=0) |
| | | <if test="inspectionItems != null and inspectionItems != ''"> |
| | | and inspection_item like concat('%', #{inspectionItems}, '%') |
| | | </if> |
| | | <if test="orderNumber != null and orderNumber != ''"> |
| | | and io.entrust_code like concat('%', #{orderNumber}, '%') |
| | | </if> |
| | | ) temp |
| | | </select> |
| | | </mapper> |