wumei-smart-master/springboot/wumei-iot/src/main/resources/mapper/iot/DeviceOrderMapper.xml
@@ -4,7 +4,6 @@
<!--namespace = 所需实现的接口全限定名-->
<!--        package com.ruoyi.iot.mapper;-->
<mapper namespace="com.ruoyi.iot.mapper.DeviceOrderMapper">
    <sql id="selectDeviceOrderVo">
        select d.id,
               d.user_id,
@@ -50,7 +49,9 @@
        <result property="appointmentTime" column="appointment_time"/>
        <result property="score" column="score"/>
        <result property="evaluate" column="evaluate"/>
        <result property="rate" column="rate"/>
        <result property="createTime" column="create_time"/>
        <result property="assginTime" column="assgin_time"/>
        <result property="receiveTime" column="receive_time"/>
        <result property="finishTime" column="finish_time"/>
        <result property="state" column="state"/>
@@ -89,6 +90,7 @@
        u.user_name,
        u.is_authentication,
        d.score,
        d.rate,
        d.state,
        d.createuser_id,
        d.imgurl,
@@ -128,6 +130,7 @@
               u.user_name,
               u.is_authentication,
               d.score,
               d.rate,
               d.state,
               d.createuser_id,
               de.device_id,
@@ -193,6 +196,35 @@
            AND d.erecto_id = #{erectoId}
        </if>
    </select>
    <select id="selectDeviceOrderByIdAnderectoName" 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.appointment_time,
               d.evaluate,
               d.rate,
               d.device_id,
               d.remark,
               d.description,
               u.user_id,
               u.user_name,
               u.is_authentication,
               d.score,
               d.state,
               d.createuser_id,
               de.device_id,
               de.device_name
        from iot_device_order as d
                 left join sys_user as u on d.erecto_id = u.user_id
                 left join iot_device as de on d.device_id = de.device_id
        where d.id = #{id}
          AND d.erecto_name = #{erectoName}
    </select>
    <insert id="insertDeviceOrder" parameterType="DeviceOrder" useGeneratedKeys="true" keyProperty="id">
        insert into iot_device_order(
@@ -210,6 +242,7 @@
        <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="assginTime != null">assgin_time,</if>
        <if test="receiveTime != null">receive_time,</if>
        <if test="finishTime != null">finish_time,</if>
        <if test="state != null and state != ''">state,</if>
@@ -231,35 +264,92 @@
        <if test="appointmentTime != null">#{appointmentTime},</if>
        <if test="score != null and score != ''">#{score},</if>
        <if test="evaluate != null and evaluate != ''">#{evaluate},</if>
        <if test="assginTime != null">#{assginTime},</if>
        <if test="receiveTime != null">#{receiveTime},</if>
        <if test="finishTime != null">#{finishTime},</if>
        <if test="state != null and state != ''">#{state},</if>
        <if test="createUserId != null and createUserId != 0">#{createUserId},</if>
        <if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if>
        <if test="imgUrl != null and imgUrl != ''">#{imgUrl}</if>
        sysdate())
    </insert>
    <update id="updateDeviceOrder" parameterType="DeviceOrder">
        update iot_device_order
        <set>
            <if test="id != null and id != 0">id = #{id},</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 != ''">erecto_name = #{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="orderType != null and orderType != ''">order_type = #{orderType},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="description != null">description = #{description},</if>
            <if test="id != null and id != 0">
                id = #{id},
            </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 != ''">
                erecto_name = #{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="orderType != null and orderType != ''">
                order_type = #{orderType},
            </if>
            <if test="remark != null">
                remark = #{remark},
            </if>
            <if test="description != null">
                description = #{description},
            </if>
            appointment_time = #{appointmentTime},
            <if test="score != null and score != ''">score = #{score},</if>
            <if test="evaluate != null">evaluate = #{evaluate},</if>
            <if test="assginTime!= null">assgin_time = #{assginTime},</if>
            <if test="receiveTime != null">receive_time = #{receiveTime},</if>
            <if test="finishTime != null">finish_time = #{finishTime},</if>
            <if test="state != null">state = #{state},</if>
            <if test="updateUserId != null and updateUserId != 0">updateuser_id = #{updateUserId},</if>
            <if test="imgUrl != null and imgUrl != ''">imgurl = #{imgUrl}</if>
            <if test="imgUrl != null and imgUrl != ''">imgurl = #{imgUrl},</if>
        </set>
        where id = #{id}
    </update>
    <update id="updateDeviceOrderScoreAndComment" parameterType="DeviceOrder">
        update iot_device_order
        <set>
            <if test="id != null and id != 0">
                id = #{id},
            </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 != ''">
                erecto_name = #{erectoName},
            </if>
            <if test="userName != null and userName != ''">
                user_name = #{userName},
            </if>
            <if test="score != null and score != ''">
                score = #{score},
            </if>
            <if test="evaluate != null">
                evaluate = #{evaluate},
            </if>
            <if test="rate != null">
                rate = #{rate}
            </if>
        </set>
        where id = #{id}
    </update>