From 63a66690008a3adbac1d2034e9d060629206cd55 Mon Sep 17 00:00:00 2001
From: wangmengzhao <1036088376@qq.com>
Date: 星期二, 14 十一月 2023 19:02:29 +0800
Subject: [PATCH] 设备安装的代码编写20231114 wmz

---
 wumei-smart-master/springboot/wumei-iot/src/main/resources/mapper/iot/DeviceOrderMapper.xml |  111 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 79 insertions(+), 32 deletions(-)

diff --git a/wumei-smart-master/springboot/wumei-iot/src/main/resources/mapper/iot/DeviceOrderMapper.xml b/wumei-smart-master/springboot/wumei-iot/src/main/resources/mapper/iot/DeviceOrderMapper.xml
index 5106c58..6a05f1c 100644
--- a/wumei-smart-master/springboot/wumei-iot/src/main/resources/mapper/iot/DeviceOrderMapper.xml
+++ b/wumei-smart-master/springboot/wumei-iot/src/main/resources/mapper/iot/DeviceOrderMapper.xml
@@ -10,6 +10,7 @@
                erecto_id,
                device_id,
                user_id,
+               erecto_name,
                user_name,
                user_phone,
                address,
@@ -30,6 +31,7 @@
         <result property="erectoId" column="erecto_id"/>
         <result property="deviceId" column="device_id"/>
         <result property="userId" column="user_id"/>
+        <result property="erectoName" column="erecto_name"/>
         <result property="userName" column="user_name"/>
         <result property="userPhone" column="user_phone"/>
         <result property="address" column="address"/>
@@ -42,33 +44,75 @@
         <result property="receiveTime" column="receive_time"/>
         <result property="finshTime" column="finsh_time"/>
         <result property="state" column="state"/>
-        <!--        <collection property="suser" column="" javaType="" resultMap=""-->
+        <association property="devic" javaType="Device" resultMap="DeviceResult"/>
+        <collection property="suser" ofType="sysUser" resultMap="UserResult"/>
     </resultMap>
 
+    <resultMap id="UserResult" type="sysUser">
+        <id property="userId" column="u.user_id"/>
+        <result property="userName" column="u.user_name"/>
+        <result property="isAuthentication" column="u.is_authentication"/>
+    </resultMap>
+    <resultMap id="DeviceResult" type="Device">
+        <id property="deviceId" column="de.device_id"/>
+        <result property="deviceName" column="de.device_name"/>
+    </resultMap>
     <!--id = 鎵�闇�閲嶅啓鐨勬帴鍙f娊璞℃柟娉曪紝resultType = 鏌ヨ鍚庢墍闇�杩斿洖鐨勫璞$被鍨�-->
     <select id="selectDeviceOrderList" resultMap="DeviceOrderResult">
-        select
-        d.id,
+        select d.id,
         d.user_id,
         d.erecto_id,
+        d.erecto_name,
         d.user_name,
+        d.user_phone,
+        d.address,
         d.order_type,
         d.appointment_time,
         d.evaluate,
+        d.device_id,
         d.remark,
-        u.address,
         u.user_id,
         u.user_name,
-        d.user_phone,
+        u.is_authentication,
         d.score,
-        d.state
-        from iot_device_order d,
-        sys_user u
+        d.state,
+        de.device_id,
+        de.device_name
+        from iot_device_order as d,
+        sys_user as u,iot_device as de
         where d.erecto_id = u.user_id
-        <if test=" state!=null and state != ''">
+        <if test="state!=null">
             and d.state = #{state}
         </if>
+        and d.order_type = 1 and d.device_id = de.device_id
         ${params.dataScope}
+    </select>
+    <select id="selectDeviceOrderAll" resultMap="DeviceOrderResult">
+        select d.id,
+               d.user_id,
+               d.erecto_id,
+               d.erecto_name,
+               d.user_name,
+               d.user_phone,
+               d.address,
+               d.order_type,
+               d.erecto_name,
+               d.appointment_time,
+               d.evaluate,
+               d.remark,
+               u.user_id,
+               u.user_name,
+               u.is_authentication,
+               d.score,
+               d.state,
+               de.device_id,
+               de.device_name
+        from iot_device_order d,
+             sys_user u,
+             iot_device de
+        where d.erecto_id = u.user_id
+          and d.order_type = 1
+          and d.device_id = de.device_id
     </select>
     <insert id="insertDeviceOrder" parameterType="DeviceOrder" useGeneratedKeys="true" keyProperty="id">
         insert into iot_device_order(
@@ -76,33 +120,35 @@
         <if test="erectoId != null and erectoId != 0">erecto_id,</if>
         <if test="deviceId != null and deviceId != 0">device_id,</if>
         <if test="userId != null and userId != 0">user_id,</if>
+        <if test="erectoName != null and erectoName != ''">erecto_name,</if>
         <if test="userName != null and userName != ''">user_name,</if>
         <if test="userPhone != null and userPhone != ''">user_phone,</if>
         <if test="address != null and address != ''">address,</if>
         <if test="orderType != null and orderType != ''">order_type,</if>
         <if test="remark != null and remark != ''">remark,</if>
-        <if test="appointmentTime != null and appointmentTime != ''">user_name,</if>
+        <if test="appointmentTime != null">appointment_time,</if>
         <if test="score != null and score != ''">score,</if>
         <if test="evaluate != null and evaluate != ''">evaluate,</if>
-        <if test="receiveTime != null and receiveTime != ''">receive_time,</if>
-        <if test="finshTime != null and finshTime != ''">finsh_time,</if>
+        <if test="receiveTime != null">receive_time,</if>
+        <if test="finshTime != null">finsh_time,</if>
         <if test="state != null and state != ''">state,</if>
         create_time)
         values (
         <if test="id != null and id != ''">#{id},</if>
         <if test="erectoId != null and erectoId != ''">#{erectoId},</if>
         <if test="deviceId != null and deviceId != ''">#{deviceId},</if>
-        <if test="userId != null and userId != ''">#{userId},</if>
-        <if test="userName != null and userName != ''">#{userName},</if>
-        <if test="userPhone != null and userPhone != ''">#{userPhone},</if>
+        <if test="userId != null">#{userId},</if>
+        <if test="erectoName!=null">#{erectoName},</if>
+        <if test="userName != null">#{userName},</if>
+        <if test="userPhone != null">#{userPhone},</if>
         <if test="address != null">#{address},</if>
         <if test="orderType != null and orderType != ''">#{orderType},</if>
         <if test="remark != null and remark != ''">#{remark},</if>
-        <if test="appointmentTime != null and appointmentTime != ''">#{appointmentTime},</if>
+        <if test="appointmentTime != null">#{appointmentTime},</if>
         <if test="score != null and score != ''">#{score},</if>
         <if test="evaluate != null and evaluate != ''">#{evaluate},</if>
-        <if test="receiveTime != null and receiveTime != ''">#{receiveTime},</if>
-        <if test="finshTime != null and finshTime != ''">#{finshTime},</if>
+        <if test="receiveTime != null">#{receiveTime},</if>
+        <if test="finshTime != null">#{finshTime},</if>
         <if test="state != null and state != ''">#{state},</if>
         sysdate())
     </insert>
@@ -110,27 +156,28 @@
         update iot_device_order
         <set>
             <if test="id != null and id != 0">id = #{id},</if>
-            <if test="erecto_id != null and id != 0">erecto_id = #{erectoId},</if>
-            <if test="device_id != null and device_id != 0">device_id = #{deviceId},</if>
-            <if test="user_id != null and user_id != 0">user_id = #{userId},</if>
-            <if test="user_name != null and user_name != ''">user_name = #{userName},</if>
-            <if test="user_phone != null and user_phone != ''">user_phone = #{userPhone},</if>
+            <if test=" erectoId!= null and erectoId != 0">erecto_id = #{erectoId},</if>
+            <if test="deviceId != null and deviceId != 0">device_id = #{deviceId},</if>
+            <if test="userId != null and userId != 0">user_id = #{userId},</if>
+            <if test="erectoName!=null and erectoName != ''">erectoName = #{erectoName},</if>
+            <if test="userName != null and userName != ''">user_name = #{userName},</if>
+            <if test="userPhone != null and userPhone != ''">user_phone = #{userPhone},</if>
             <if test="address != null and address != ''">address = #{address},</if>
-            <if test="order_type != null and order_type != ''">order_type = #{orderType},</if>
+            <if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
             <if test="remark != null and remark != ''">remark = #{remark},</if>
-            <if test="appointment_time != null and appointment_time != ''">appointment_time = #{appointmentTime},</if>
+            <if test="appointmentTime != null">appointment_time = #{appointmentTime},</if>
             <if test="score != null and score != ''">score = #{score},</if>
-            <if test="evaluate != null and evaluate != ''">evaluate = #{evaluate},</if>
-            <if test="receive_time != null and receive_time != ''">receive_time = #{receiveTime},</if>
-            <if test="finsh_time != null and finsh_time != ''">finsh_time = #{finshTime},</if>
-            <if test="state != null and state != ''">state</if>
+            <if test="evaluate != null">evaluate = #{evaluate},</if>
+            <if test="receiveTime != null">receive_time = #{receiveTime},</if>
+            <if test="finshTime != null">finsh_time = #{finshTime},</if>
+            <if test="state != null and state != ''">state = #{state}</if>
         </set>
         where id = #{id}
     </update>
     <delete id="deleteDeviceOrderById">
-        update iot_device_order
-        set state = '3'
-        where erecto_id = #{erecto_id}
+        delete
+        from iot_device_order
+        where id = #{id}
     </delete>
     <delete id="deleteDeviceOrder">
         update iot_device_order set state = '3' where erecto_id in

--
Gitblit v1.8.0