| | |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.ReportMapper"> |
| | | |
| | | <!--查询检验报告--> |
| | | <select id="selectAllReport" resultType="com.yuanchu.limslaboratory.pojo.vo.ReportVo">select im.code materialCode, |
| | | <select id="selectAllReport" resultType="com.yuanchu.limslaboratory.pojo.vo.ReportVo"> |
| | | select r.id, |
| | | im.code materialCode, |
| | | r.code reportCode, |
| | | i.code inspectionCode, |
| | | im.name materialName, |
| | | r.conclusion, |
| | | r.status, |
| | | r.approver approver, |
| | | r.status status, |
| | | r.conclusion conclusion, |
| | | u.name name |
| | | from report r |
| | | join inspection i on r.inspection_id = i.id |
| | | join user u on i.user_id = u.id |
| | | join inspection_material im on i.id = im.inspection_id |
| | | i.type, |
| | | check_time, |
| | | u.name |
| | | from lims_laboratory.report r |
| | | join lims_laboratory.inspection i on r.inspection_id = i.id |
| | | join lims_laboratory.user u on i.user_id = u.id |
| | | join lims_laboratory.inspection_material im on i.id = im.inspection_id |
| | | <where> |
| | | r.state = 1 |
| | | <if test="status != null"> |
| | |
| | | or r.code like concat('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | order by r.id |
| | | </select> |
| | | |
| | | <!--查询报告审核--> |
| | | <select id="selectAllReportAuditing" resultType="com.yuanchu.limslaboratory.pojo.vo.ReportAuditingVo"> |
| | | select im.code materialCode, |
| | | r.code reportCode, |
| | | im.name materialName, |
| | | r.status status, |
| | | r.approver approver, |
| | | DATE_FORMAT(r.`create_time`, '%Y-%m-%d') submitTime, |
| | | DATE_FORMAT(r.`check_time`, '%Y-%m-%d') checkTime |
| | | from report r |
| | | join inspection i on r.inspection_id = i.id |
| | | join inspection_material im on i.id = im.inspection_id |
| | | <where> |
| | | r.state = 1 |
| | | <if test="status == null"> |
| | | and r.status in (0, 1) |
| | | </if> |
| | | <if test="status != null"> |
| | | and r.status = #{status} |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | and im.code like concat('%', #{name}, '%') |
| | | or i.code like concat('%', #{name}, '%') |
| | | or im.name like concat('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | <resultMap id="report" type="map"> |
| | | <id property="rcode" column="rcode"/> |
| | | <result property="name" column="name"/> |
| | | <result property="num" column="num"/> |
| | | <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"/> |
| | | <result property="notes" column="notes"/> |
| | | <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"/> |
| | | <result property="ipName" column="ipName"/> |
| | | </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.num, |
| | | im.specifications, |
| | | im.supplier, |
| | | im.`code` im_code, |
| | | i.`code` ins_code, |
| | | i.type, |
| | | ip.id, |
| | | ip.`name` ip_name, |
| | | im.form_time formTime, |
| | | ip.unit, |
| | | ip.required, |
| | | ip.test_value, |
| | | ip.test_state, |
| | | u.`name` ipName, |
| | | im.notes |
| | | 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 |
| | | LEFT JOIN `user` u on ip.user_id =u.id |
| | | WHERE |
| | | ip.state != 0 |
| | | AND im.state != 0 |
| | | AND i.state != 0 |
| | | AND r.`code` = #{code} |
| | | </select> |
| | | |
| | | </mapper> |