| | |
| | | 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"/> |
| | | <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,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> |