Browse Source

【CHG】安全工具实验数量统计

ZhaoMn 3 năm trước cách đây
mục cha
commit
6e1eeaaa4a

+ 3 - 2
railway-business/src/main/resources/mapper/safetool/BaseSafetyToolMapper.xml

@@ -450,14 +450,15 @@
     <result column="tool_code" property="toolCode"/>
     <result column="last_test_date" property="lastTestDate"/>
     <result column="isok" property="isok"/>
+    <result column="exp_id" property="experimentId"/>
   </resultMap>
 
   <select id="listExperimentTool" resultMap="ExpResultMap">
     SELECT
-    <include refid="Base_Column_List"/>, t1.isok
+    <include refid="Base_Column_List"/>, t1.isok, #{experimentId} as exp_id
     FROM base_safety_tool t
     left join sec_experiment_tool t1 on t.tool_id = t1.tool_id
-    where t1.exp_id=#{expId}
+    where t1.exp_id=#{experimentId}
     <where>
       t.del_flag='0'
       <if test="deptId!=null and deptId!=''">

+ 2 - 1
railway-business/src/main/resources/mapper/safetool/SecExperimentMapper.xml

@@ -115,9 +115,10 @@
   </resultMap>
 
   <select id="getList" resultMap="listResultMap">
-    select e.id,e.state,e.scheduled_time,e.end_time,e.exp_date,e.dept_name,e.lab_name,u.real_name
+    select e.id,e.state,e.scheduled_time,e.end_time,e.exp_date,e.dept_name,e.lab_name,u.real_name, t.c
     from sec_experiment e
     left join sys_user u on e.create_by = u.user_name
+    left join (select exp_id, count(*) as c from sec_experiment_tool where del_flag = '0' group by exp_id) t on t.exp_id = e.id
     <where>
       e.del_flag = '0'
       <if test="deptId!=null and deptId!=''">