| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.PlanMapper"> |
| | | |
| | | <resultMap id="selectAllPlanMap" type="map"> |
| | | <id property="code" column="code"/> |
| | | <result property="id" column="id"/> |
| | | <result property="samplename" column="samplename"/> |
| | | <result property="testState" column="inspectionStatus"/> |
| | | <result property="startTime" column="startTime"/> |
| | | <result property="endTime" column="endTime"/> |
| | | <collection property="children" resultMap="selectAllPlanMapTowsMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="selectAllPlanMapTowsMap" type="map"> |
| | | <id property="pid" column="pid"/> |
| | | <result property="name" column="name"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="required" column="required"/> |
| | | <result property="internal" column="internal"/> |
| | | <result property="testValue" column="testValue"/> |
| | | <result property="testState" column="testState"/> |
| | | <result property="uId" column="uId"/> |
| | | <result property="checker" column="checker"/> |
| | | <result property="isuId" column="isuId"/> |
| | | <result property="instrumentname" column="instrumentname"/> |
| | | <result property="classId" column="classId"/> |
| | | </resultMap> |
| | | <!--查询检验计划--> |
| | | <select id="selectAllPlan" resultType="com.yuanchu.limslaboratory.pojo.vo.PlanVo"> |
| | | select i.equipment_name device, |
| | | <select id="selectAllPlan" resultMap="selectAllPlanMap"> |
| | | select i.id , |
| | | i.code, |
| | | inspection_status inspectionStatus, |
| | | DATE_FORMAT(start_time,'%Y-%m-%d') startTime, |
| | | DATE_FORMAT(end_time,'%Y-%m-%d') endTime, |
| | | im.name samplename, |
| | | im.code sampleid, |
| | | im.specifications modelandspecification, |
| | | im.unit unit, |
| | | im.num amount, |
| | | ip.name checkproject, |
| | | ip.id pid, |
| | | ip.name, |
| | | ip.unit, |
| | | required, |
| | | internal, |
| | | test_value testValue, |
| | | test_state testState, |
| | | u.id uId, |
| | | u.name checker, |
| | | ip.start_time starttime, |
| | | ip.end_time finishtime, |
| | | i.id deviceId, |
| | | u.id userId, |
| | | ip.test_state state |
| | | from instrument i |
| | | left join (select ip.* |
| | | from inspection_product ip |
| | | right join (select instrument_id, max(ip.end_time) t |
| | | from inspection_product ip |
| | | group by instrument_id) it |
| | | on ip.instrument_id = it.instrument_id and ip.end_time = it.t) ip |
| | | on i.id = ip.instrument_id |
| | | left join inspection_material im on im.id = ip.inspection_material_id |
| | | left join user u on u.id = ip.user_id |
| | | isu.id isuId, |
| | | isu.classify_id classId, |
| | | equipment_name instrumentname |
| | | from lims_laboratory.inspection_product ip |
| | | left join lims_laboratory.inspection_material im on ip.inspection_material_id = im.id |
| | | left join lims_laboratory.inspection i on im.inspection_id = i.id |
| | | left join lims_laboratory.user u on ip.user_id = u.id |
| | | left join lims_laboratory.instrument isu on ip.instrument_id = isu.id |
| | | <where> |
| | | <if test="deviceId != null"> |
| | | and i.id = #{deviceId} |
| | | <if test="code != null and code != null"> |
| | | and i.code like concat('%',#{code},'%') |
| | | </if> |
| | | <if test="userId != null"> |
| | | and u.id = #{userId} |
| | | <if test="status != null "> |
| | | and inspection_status = #{status} |
| | | </if> |
| | | <if test="beginTime != null and endTime != null"> |
| | | and ip.start_time between #{beginTime} and #{endTime} |
| | | and i.start_time between #{beginTime} and #{endTime} |
| | | </if> |
| | | <if test="isLookMe != false and id != null"> |
| | | and ip.user_id=#{id} |
| | | </if> |
| | | </where> |
| | | </select> |