| | |
| | | r.code reportCode, |
| | | i.code inspectionCode, |
| | | im.name materialName, |
| | | r.conclusion , |
| | | r.status , |
| | | r.conclusion, |
| | | r.status, |
| | | r.approver approver, |
| | | i.type, |
| | | check_time, |
| | | u.name |
| | | from lims_laboratory.report r |
| | |
| | | order by r.id |
| | | </select> |
| | | |
| | | <resultMap id="report" type="map"> |
| | | <id property="rcode" column="rcode"/> |
| | | <result property="name" column="name"/> |
| | | <result property="specifications" column="specifications"/> |
| | | <result property="supplier" column="supplier"/> |
| | | <result property="insCode" column="ins_code"/> |
| | | <result property="type" column="type"/> |
| | | <result property="imCode" column="im_code"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="checkTime" column="check_time"/> |
| | | <result property="inspectionStatus" column="inspection_status"/> |
| | | <collection property="products" resultMap="products" javaType="java.util.List"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="products" type="map"> |
| | | <id property="code" column="id"/> |
| | | <result property="ipName" column="ip_name"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="required" column="required"/> |
| | | <result property="testValue" column="test_value"/> |
| | | <result property="testState" column="test_state"/> |
| | | </resultMap> |
| | | |
| | | <select id="getReportContext" resultMap="report"> |
| | | SELECT r.`code` rcode,date_format(r.create_time, '%Y-%m-%d') create_time,date_format(r.check_time, '%Y-%m-%d') check_time,i.inspection_status,im.`name`,im.specifications,im.supplier,im.`code` im_code,i.`code` ins_code,i.type,ip.id,ip.`name` ip_name,ip.unit,ip.required,ip.test_value,ip.test_state |
| | | FROM report r |
| | | LEFT JOIN inspection i |
| | | ON r.inspection_id = i.id |
| | | LEFT JOIN inspection_material im |
| | | ON im.inspection_id = i.id |
| | | LEFT JOIN inspection_product ip |
| | | ON ip.inspection_material_id = im.id |
| | | WHERE ip.state != 0 |
| | | and im.state != 0 |
| | | and i.state != 0 |
| | | and r.`code` = #{code} |
| | | </select> |
| | | |
| | | </mapper> |