<?xml version="1.0" encoding="UTF-8" ?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!--namespace = 所需实现的接口全限定名-->
|
<mapper namespace="com.ruoyi.iot.mapper.DeviceOrderTimeMapper">
|
|
<!--id = 所需重写的接口抽象方法,resultType = 查询后所需返回的对象类型-->
|
<resultMap id="DeviceOrderTimeResult" type="DeviceOrderTime">
|
<id property="id" column="id"/>
|
<result property="userId" column="user_id"/>
|
<result property="orderType" column="order_type"/>
|
<result property="receiveTimeout" column="receive_timeout"/>
|
<result property="finishTimeout" column="finish_timeout"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
|
<select id="selectDeviceOrderTimeByUserId" resultMap="DeviceOrderTimeResult">
|
select id,
|
user_id,
|
order_type,
|
receive_timeout,
|
finish_timeout,
|
create_time,
|
update_time
|
from iot_device_ordertime
|
where user_id = #{userId}
|
and order_type = #{orderType}
|
</select>
|
<select id="selectDeviceOrderTimeoutById" resultMap="DeviceOrderTimeResult">
|
select receive_timeout,finish_timeout
|
from iot_device_ordertime
|
<where>
|
<if test="userId != null and userId != 0">
|
and user_id = #{userId}
|
</if>
|
<if test="orderType != null and orderType != 0">
|
and order_type = #{orderType}
|
</if>
|
</where>
|
</select>
|
<insert id="insertDeviceOrderTimeout" parameterType="DeviceOrderTime" useGeneratedKeys="true" keyProperty="id">
|
insert into iot_device_ordertime(
|
<if test="id != null">id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="orderType != null and orderType != 0">order_type,</if>
|
<if test="receiveTimeout != null">receive_timeout,</if>
|
<if test="finishTimeout != null">finish_timeout,</if>
|
create_time)
|
values (
|
<if test="id != null and id != ''">#{id},</if>
|
<if test="userId != null and userId != 0">#{userId},</if>
|
<if test="orderType != null and orderType != 0">#{orderType},</if>
|
<if test="receiveTimeout != null">#{receiveTimeout},</if>
|
<if test="finishTimeout != null">#{finishTimeout},</if>
|
sysdate())
|
</insert>
|
<update id="updateDeviceOrderTimeoutById" parameterType="DeviceOrderTime">
|
update iot_device_ordertime
|
<set>
|
<if test="receiveTimeout != null">
|
receive_timeout = #{receiveTimeout},
|
</if>
|
<if test="finishTimeout != null">
|
finish_timeout = #{finishTimeout},
|
</if>
|
update_time = sysdate()
|
</set>
|
where user_id = #{userId} and order_type = #{orderType}
|
</update>
|
</mapper>
|