From e7f7daae5d21ad2988cadd25b6987ca5e7ef8001 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期六, 09 九月 2023 09:51:20 +0800
Subject: [PATCH] 修改bug

---
 inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml |  119 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 89 insertions(+), 30 deletions(-)

diff --git a/inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml b/inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml
index 0bc06a7..a7ad0c4 100644
--- a/inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml
+++ b/inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml
@@ -1,13 +1,22 @@
 <?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.LinkBasicInformationMapper">
-
+    <delete id="deleteByID">
+        delete from link_basic_information where id=#{id}
+    </delete>
     <select id="getLinkBasicPage" resultType="map">
-        SELECT l.`id`, l.`entrust_coding`, l.`entrusted`, d.`samples_number`, d.`sample_name`, d.`specifications_models`,
-            DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') inspectionTime, l.`completion_deadline`, l.`contacts`, d.`date_survey`, d.`inspection_status`
-        FROM link_basic_information l, link_detection d
+        SELECT d.`id`, l.`entrust_coding`, l.`entrusted`, d.`samples_number`, d.`sample_name`,
+        s.name   specifications_models,
+        d.spe_name speName,
+        DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') inspectionTime, DATE_FORMAT(l.`completion_deadline`,'%Y-%m-%d')
+        completionDeadline, l.`contacts`,
+        DATE_FORMAT(d.`date_survey`,'%Y-%m-%d') dateSurvey, d.`inspection_status`,
+        DATE_FORMAT(l.`ins_time`,'%Y-%m-%d') insTime
+        FROM link_basic_information l, link_detection d,specifications s
         WHERE l.`id` = d.`link_basic_id`
-        AND l.`state` = 1
+        and s.id=d.`specifications_models`
+        AND d.`state` = 1
+        and l.`state` = 1
         <if test="entrustCoding != null and entrustCoding != null">
             AND l.`entrust_coding` like concat('%', #{entrustCoding}, '%')
         </if>
@@ -15,7 +24,7 @@
             AND d.`sample_name` like concat('%', #{sampleName}, '%')
         </if>
         <if test="entrusted != null and entrusted != null">
-            AND l.`contacts` like concat('%', #{entrusted}, '%')
+            AND l.`entrusted` like concat('%', #{entrusted}, '%')
         </if>
         <if test="inspectionStatus != null and inspectionStatus != null">
             AND d.`inspection_status` = #{inspectionStatus}
@@ -23,31 +32,81 @@
     </select>
 
     <select id="selectLinkAll" resultType="java.util.Map">
-        SELECT l.`id`, l.`entrust_coding`, l.`entrusted`, d.`samples_number`, d.`sample_name`, d.`specifications_models`,
-        DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') inspectionTime, l.`completion_deadline`, l.`contacts`, d.`date_survey`, d.`inspection_status`
-        FROM lims_laboratory.link_basic_information l, lims_laboratory.link_detection d
-        WHERE l.`id` = d.`link_basic_id`
-        AND l.`state` = 1
-    </select>
-
-    <select id="selectLinkByid" resultType="com.yuanchu.limslaboratory.pojo.vo.InspectionVo">
-        SELECT l.`inspection_time` formTime,
-        l.`entrusted` supplier,
-        d.`sample_number` mcode,
-        d.`sample_name` name,
-        d.`specifications_models` specifications,
-        d.`unit`,
-        d.`samples_number` num,
-        d.date_survey startTime,
-        l.completion_deadline endTime
-        FROM lims_laboratory.link_basic_information l, lims_laboratory.link_detection d
+        SELECT d.id,
+               l.entrust_coding                             entrustCoding,
+               DATE_FORMAT(l.`inspection_time`, '%Y-%m-%d') formTime,
+               l.`entrusted`                                supplier,
+               d.`sample_number`                            mcode,
+               d.`sample_name`                              name,
+               d.`spe_name`                    specifications,
+               d.`unit`,
+               d.`samples_number`                           num,
+               d.specifications_models                      specificationsId,
+               experiment,
+               DATE_FORMAT(date_survey, '%Y-%m-%d')         startTime,
+               DATE_FORMAT(completion_deadline, '%Y-%m-%d') endTime
+        FROM lims_laboratory.link_basic_information l,
+             lims_laboratory.link_detection d
         WHERE l.`id` = d.`link_basic_id`
           AND l.`state` = 1
-        <if test="bid!=null">
-            and l.id=#{bid}
-        </if>
-        <if test="did!=null">
-            and d.id=#{did}
-        </if>
+          and inspection_status = 1
     </select>
+    <select id="getLinkBasicInformation" resultMap="getLinkBasicInformationMap">
+        SELECT lb.entrust_coding        entrustCoding,
+               lb.contacts              contacts,
+               lb.contact_number        contactNumber,
+               lb.contact_address       contactAddress,
+               lb.completion_deadline   completionDeadline,
+               lb.inspection_time       inspectionTime,
+               lb.sample_delivery_mode  sampleDeliveryMode,
+               lb.sample_delivery_phone sampleDeliveryPhone,
+               lb.report_number         reportNumber,
+               lb.entrust_remarks       entrustRemarks,
+               lb.sample_sender         sampleSender,
+               lb.entrusted             entrusted,
+               lb.uid                   uid,
+               ld.id                    id,
+               ld.sample_number         sampleNumber,
+               ld.sample_name           sampleName,
+               ld.specifications_models specificationsModels,
+               ld.unit                  unit,
+               ld.experiment            experiment,
+               ld.samples_number        samplesNumber,
+               ld.remarks               remarks,
+               ld.spe_name                   speName
+        FROM link_basic_information lb left join
+             link_detection ld
+             on lb.id = ld.link_basic_id
+        left join specifications s
+        on ld.specifications_models = s.id
+        where lb.uid = #{uid}
+          and lb.state = 1
+    </select>
+
+    <resultMap id="getLinkBasicInformationMap" type="com.yuanchu.limslaboratory.pojo.LinkBasicInformation">
+        <result property="entrustCoding" column="entrustCoding"/>
+        <result property="contacts" column="contacts"/>
+        <result property="contactNumber" column="contactNumber"/>
+        <result property="contactAddress" column="contactAddress"/>
+        <result property="uid" column="uid"/>
+        <result property="completionDeadline" column="completionDeadline"/>
+        <result property="inspectionTime" column="inspectionTime"/>
+        <result property="sampleDeliveryMode" column="sampleDeliveryMode"/>
+        <result property="sampleDeliveryPhone" column="sampleDeliveryPhone"/>
+        <result property="sampleSender" column="sampleSender"/>
+        <result property="entrustRemarks" column="entrustRemarks"/>
+        <result property="reportNumber" column="reportNumber"/>
+        <result property="entrusted" column="entrusted"/>
+        <collection property="linkDetectionList" ofType="LinkDetection">
+            <result property="id" column="id"/>
+            <result property="sampleNumber" column="sampleNumber"/>
+            <result property="sampleName" column="sampleName"/>
+            <result property="specificationsModels" column="specificationsModels"/>
+            <result property="unit" column="unit"/>
+            <result property="samplesNumber" column="samplesNumber"/>
+            <result property="remarks" column="remarks"/>
+            <result property="experiment" column="experiment"/>
+            <result property="speName" column="speName"/>
+        </collection>
+    </resultMap>
 </mapper>

--
Gitblit v1.9.3