From 47a751cb301d05276ae5d75145d57b2d090fe4e1 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期一, 01 七月 2024 10:58:35 +0800
Subject: [PATCH] change

---
 src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.xml |  104 ++++++++++++++++++++++++++--------------------------
 1 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.xml b/src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.xml
index b5a4509..afe6602 100644
--- a/src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.xml
@@ -10,7 +10,7 @@
     <result column="solid" jdbcType="DECIMAL" property="solid" />
     <result column="medical" jdbcType="DECIMAL" property="medical" />
     <result column="apply_person" jdbcType="VARCHAR" property="applyPerson" />
-    <result column="project" jdbcType="VARCHAR" property="project" />
+    <result column="project_id" property="projectId" />
     <result column="department" jdbcType="VARCHAR" property="department" />
     <result column="unit" jdbcType="VARCHAR" property="unit" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@@ -19,10 +19,13 @@
     <result column="creator" jdbcType="VARCHAR" property="creator" />
     <result column="updator" jdbcType="VARCHAR" property="updator" />
     <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
+    <result column="project_name" property="projectName" />
+    <result column="apply_person_name" property="applyPersonName" />
+    <result column="unit_name" property="unitName" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--          -->
-    id, acid, alkali, organic, solid, medical, apply_person, project, department, unit,
+    id, acid, alkali, organic, solid, medical, apply_person, project_id, department, unit,
     create_time, tid, status, creator, updator, updatetime
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -37,26 +40,22 @@
     delete from sys_hazardous_waste
     where id = #{id,jdbcType=BIGINT}
   </delete>
-  <insert id="insert" parameterType="com.nanometer.smartlab.entity.HazardousWaste">
+  <insert id="insert" parameterType="com.nanometer.smartlab.entity.HazardousWaste" useGeneratedKeys = "true" keyProperty = "id">
     <!--          -->
-    insert into sys_hazardous_waste (id, acid, alkali, organic,
+    insert into sys_hazardous_waste ( acid, alkali, organic,
       solid, medical, apply_person,
-      project, department, unit,
-      create_time, tid, status,
-      creator,updator, updatetime)
-    values (#{id,jdbcType=BIGINT}, #{acid,jdbcType=DECIMAL}, #{alkali,jdbcType=DECIMAL}, #{organic,jdbcType=DECIMAL},
-      #{solid,jdbcType=DECIMAL}, #{medical,jdbcType=DECIMAL}, #{applyPerson,jdbcType=VARCHAR},
-      #{project,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
-      #{createTime,jdbcType=TIMESTAMP}, #{tid,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
-      #{creator,jdbcType=VARCHAR},#{updator,jdbcType=VARCHAR},#{updatetime,jdbcType=TIMESTAMP})
+      project_id, department, unit,tid, status,
+      creator,updator)
+    values (#{acid,jdbcType=DECIMAL}, #{alkali,jdbcType=DECIMAL}, #{organic,jdbcType=DECIMAL},
+      #{solid,jdbcType=DECIMAL}, #{medical,jdbcType=DECIMAL}, #{applyPerson},
+      #{projectId}, #{department,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
+    #{tid,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
+      #{creator,jdbcType=VARCHAR},#{updator,jdbcType=VARCHAR})
   </insert>
-  <insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.HazardousWaste">
+  <insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.HazardousWaste" useGeneratedKeys = "true" keyProperty = "id">
     <!--          -->
     insert into sys_hazardous_waste
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
       <if test="acid != null">
         acid,
       </if>
@@ -75,8 +74,8 @@
       <if test="applyPerson != null">
         apply_person,
       </if>
-      <if test="project != null">
-        project,
+      <if test="projectId != null">
+        project_id,
       </if>
       <if test="department != null">
         department,
@@ -104,9 +103,6 @@
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
       <if test="acid != null">
         #{acid,jdbcType=DECIMAL},
       </if>
@@ -125,8 +121,8 @@
       <if test="applyPerson != null">
         #{applyPerson,jdbcType=VARCHAR},
       </if>
-      <if test="project != null">
-        #{project,jdbcType=VARCHAR},
+      <if test="projectId != null">
+        #{projectId},
       </if>
       <if test="department != null">
         #{department,jdbcType=VARCHAR},
@@ -176,8 +172,8 @@
       <if test="applyPerson != null">
         apply_person = #{applyPerson,jdbcType=VARCHAR},
       </if>
-      <if test="project != null">
-        project = #{project,jdbcType=VARCHAR},
+      <if test="projectId != null">
+        project_id = #{projectId},
       </if>
       <if test="department != null">
         department = #{department,jdbcType=VARCHAR},
@@ -215,7 +211,7 @@
       solid = #{solid,jdbcType=DECIMAL},
       medical = #{medical,jdbcType=DECIMAL},
       apply_person = #{applyPerson,jdbcType=VARCHAR},
-      project = #{project,jdbcType=VARCHAR},
+      project_id = #{projectId},
       department = #{department,jdbcType=VARCHAR},
       unit = #{unit,jdbcType=VARCHAR},
       create_time = #{createTime,jdbcType=TIMESTAMP},
@@ -270,30 +266,34 @@
   <select id="selectAll" parameterType="java.util.Map" resultMap="BaseResultMap">
     <!--          -->
     select
-    <include refid="Base_Column_List" />
-    from sys_hazardous_waste
+    hw.id, hw.acid, hw.alkali, hw.organic, hw.solid, hw.medical, hw.apply_person, hw.project_id, hw.department, hw.unit,
+    hw.create_time, hw.tid, hw.status, hw.creator, hw.updator, hw.updatetime,sp.project_name,su.name as apply_person_name,bm.meta_value as unit_name
+    from sys_hazardous_waste hw
+    left join sys_project sp on sp.id=hw.project_id
+    left join sys_user su on su.id=hw.apply_person
+    left join base_meta bm on bm.id=hw.unit
     <where>
       1 = 1
       <if test="startTime != null and startTime != ''">
-        and create_time &gt;= #{startTime}
+        and hw.create_time &gt;= #{startTime}
       </if>
       <if test="endTime != null and endTime != ''">
-        and create_time &lt;= #{endTime}
+        and hw.create_time &lt;= #{endTime}
       </if>
       <if test="status != null and status != ''">
-        and status = #{status}
+        and hw.status = #{status}
       </if>
       <if test="applyPerson != null and applyPerson != ''">
-        and apply_person = #{applyPerson}
+        and hw.apply_person = #{applyPerson}
       </if>
-      <if test="project != null and project != ''">
-        and project = #{project}
+      <if test="projectId != null and projectId != ''">
+        and hw.project_id = #{projectId}
       </if>
       <if test="department != null and department != ''">
-        and department = #{department}
+        and hw.department = #{department}
       </if>
       <if test="tid != null and tid != ''">
-        and tid = #{tid}
+        and hw.tid = #{tid}
       </if>
     </where>
     order by create_time desc
@@ -320,8 +320,8 @@
       <if test="applyPerson != null and applyPerson != ''">
         and apply_person = #{applyPerson}
       </if>
-      <if test="project != null and project != ''">
-        and project = #{project}
+      <if test="projectId != null and projectId != ''">
+        and project_id = #{projectId}
       </if>
       <if test="department != null and department != ''">
         and department = #{department}
@@ -333,7 +333,7 @@
   </select>
   <select id="selectExportList" resultType="java.util.Map">
     select
-    id, acid, alkali, organic, solid, medical, apply_person as applyPerson, project, department, unit,
+    id, acid, alkali, organic, solid, medical, apply_person as applyPerson, project_id, department, unit,
     create_time as createTime, tid, status, creator
     from sys_hazardous_waste
     <where>
@@ -350,8 +350,8 @@
       <if test="applyPerson != null and applyPerson != ''">
         and apply_person = #{applyPerson}
       </if>
-      <if test="project != null and project != ''">
-        and project = #{project}
+      <if test="projectId != null and projectId != ''">
+        and project_id = #{projectId}
       </if>
       <if test="department != null and department != ''">
         and department = #{department}
@@ -380,20 +380,20 @@
       <if test="applyPerson != null and applyPerson != ''">
         and apply_person = #{applyPerson}
       </if>
-      <if test="project != null and project != ''">
-        and project = #{project}
+      <if test="projectId != null and projectId != ''">
+        and project_id = #{projectId}
       </if>
       <if test="department != null and department != ''">
         and department = #{department}
       </if>
-      group by project,department,unit
+      group by project_id,department,unit
     </where>
     ) shw
   </select>
   <select id="selectStatistics" resultType="com.nanometer.smartlab.entity.HazardousWaste">
     select
     id, sum(acid) as acid,sum(alkali) as alkali, sum(organic) as organic,sum(solid) as solid,sum(medical) as medical,
-    apply_person as applyPerson, project, department, unit,create_time as createTime, tid, status, creator
+    apply_person as applyPerson, project_id, department, unit,create_time as createTime, tid, status, creator
     from sys_hazardous_waste
     <where>
       1 = 1
@@ -409,14 +409,14 @@
       <if test="applyPerson != null and applyPerson != ''">
         and apply_person = #{applyPerson}
       </if>
-      <if test="project != null and project != ''">
-        and project = #{project}
+      <if test="projectId != null and projectId != ''">
+        and project_id = #{projectId}
       </if>
       <if test="department != null and department != ''">
         and department = #{department}
       </if>
     </where>
-    group by project,department,unit
+    group by project_id,department,unit
     order by create_time desc
     <if test="first != null and pageSize != null">
       limit #{first},#{pageSize}
@@ -425,7 +425,7 @@
   <select id="selectStatisticsExportList" resultType="java.util.Map">
     select
     id, sum(acid) as acid,sum(alkali) as alkali, sum(organic) as organic,sum(solid) as solid,sum(medical) as medical,
-    apply_person as applyPerson, project, department, unit,create_time as createTime, tid, status, creator
+    apply_person as applyPerson, project_id, department, unit,create_time as createTime, tid, status, creator
     from sys_hazardous_waste
     <where>
       1 = 1
@@ -441,14 +441,14 @@
       <if test="applyPerson != null and applyPerson != ''">
         and apply_person = #{applyPerson}
       </if>
-      <if test="project != null and project != ''">
-        and project = #{project}
+      <if test="projectId != null and projectId != ''">
+        and project_id = #{projectId}
       </if>
       <if test="department != null and department != ''">
         and department = #{department}
       </if>
     </where>
-    group by project,department,unit
+    group by project_id,department,unit
     order by create_time desc
   </select>
   <select id="selectByTid" resultType="com.nanometer.smartlab.entity.HazardousWaste">

--
Gitblit v1.9.2