From a3202d4c62be404247d23f0676e95f8c5d146983 Mon Sep 17 00:00:00 2001
From: 刘小明 <liuxm_a@163.com>
Date: 星期六, 06 七月 2024 09:49:17 +0800
Subject: [PATCH] 添加根据设备号查询生产日志,生命周期,和相关信息;限制上传文档类型

---
 pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml
index d3936f5..fb8527f 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml
@@ -23,6 +23,13 @@
             <result property="updatedBy" column="updated_by" jdbcType="BIGINT"/>
             <result property="memo" column="memo" jdbcType="VARCHAR"/>
     </resultMap>
+    <resultMap id="joinResultMap" type="com.dy.pmsGlobal.pojoSta.StaDeviceLife" extends="BaseResultMap">
+        <result property="planName" column="plan_name" jdbcType="VARCHAR"/>
+        <result property="stationName" column="station_name" jdbcType="VARCHAR"/>
+        <result property="updateUserName" column="update_user_name" jdbcType="VARCHAR"/>
+        <association property="assistantNames" jdbcType="VARCHAR" column="assistants"
+                     select="com.dy.pmsGlobal.daoBa.BaUserMapper.selectNamesByAssistants" fetchType="eager" />
+    </resultMap>
 
     <sql id="Base_Column_List">
         id,equip_no,work_id,
@@ -40,14 +47,19 @@
         where  id = #{id,jdbcType=BIGINT} 
     </select>
 
-    <select id="selectByEquipNo" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <select id="selectByEquipNo" parameterType="java.lang.String" resultMap="joinResultMap">
         select
-        <include refid="Base_Column_List" />
-        from sta_device_life
-        where  equip_no = #{equipNo,jdbcType=VARCHAR}
-        order by id desc
+            t.* ,p.`name` plan_name,s.`name` station_name,u.`name` update_user_name
+        FROM
+        sta_device_life t
+        left join pr_assembly_plan p on t.plan_id=p.id
+        left join plt_station s on s.id = t.station_id
+        left JOIN ba_user u on u.id=t.updated_by
+        where  t.equip_no = #{equipNo,jdbcType=VARCHAR}
+        ORDER BY t.id DESC
     </select>
 
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from sta_device_life
         where  id = #{id,jdbcType=BIGINT} 

--
Gitblit v1.8.0