248 lines
15 KiB
XML
248 lines
15 KiB
XML
<?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">
|
|
<mapper namespace="com.ruoyi.device.mapper.AsDeviceMapper">
|
|
|
|
<resultMap type="AsDevice" id="AsDeviceResult">
|
|
<result property="deviceId" column="device_id" />
|
|
<result property="picture" column="picture" />
|
|
<result property="deviceName" column="device_name" />
|
|
<result property="classifyId" column="classify_id" />
|
|
<result property="classifyName" column="classify_name" />
|
|
<result property="modelId" column="model_id" />
|
|
<result property="model" column="model" />
|
|
<result property="mac" column="mac" />
|
|
<result property="activationTime" column="activation_time" />
|
|
<result property="onlineStatus" column="online_status" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="userName" column="user_name" />
|
|
<result property="nickName" column="nick_name" />
|
|
<result property="regularWatering" column="regular_watering" />
|
|
<result property="soilMoistureOpen" column="soil_moisture_open" />
|
|
<result property="soilMoistureClose" column="soil_moisture_close" />
|
|
<result property="waterIntensity" column="water_intensity" />
|
|
<result property="pulseMode" column="pulse_mode" />
|
|
<result property="pulseModeParam" column="pulse_mode_param" />
|
|
<result property="screenRestTime" column="screen_rest_time" />
|
|
<result property="version" column="version" />
|
|
<result property="versionId" column="version_id" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
<result property="regularWateringJson" column="regular_watering_json" />
|
|
<result property="soilMoisture" column="soil_moisture" />
|
|
<result property="waterIntensitySwitch" column="water_intensity_switch" />
|
|
<result property="isNetwork" column="is_network" />
|
|
<result property="isDefault" column="is_default" />
|
|
<result property="modeStr" column="mode_str" />
|
|
<result property="bluetoothId" column="bluetooth_id" />
|
|
<result property="bluetoothName" column="bluetooth_name" />
|
|
</resultMap>
|
|
|
|
<sql id="selectAsDeviceVo">
|
|
select device_id, picture, device_name, classify_id, classify_name, model_id, model, mac, activation_time, online_status,
|
|
user_id, user_name, nick_name, regular_watering, soil_moisture_open, soil_moisture_close, water_intensity, pulse_mode,
|
|
pulse_mode_param, screen_rest_time, version, version_id, create_by, create_time, update_by, update_time, remark, regular_watering_json, soil_moisture, water_intensity_switch,is_network,is_default,mode_str,bluetooth_id,bluetooth_name from as_device
|
|
</sql>
|
|
|
|
<select id="selectAsDeviceList" parameterType="AsDevice" resultMap="AsDeviceResult">
|
|
<include refid="selectAsDeviceVo"/>
|
|
<where>
|
|
status = 0
|
|
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
|
<if test="classifyName != null and classifyName != ''"> and classify_name like concat('%', #{classifyName}, '%')</if>
|
|
<if test="model != null and model != ''"> and model like concat('%', #{model}, '%')</if>
|
|
<if test="mac != null and mac != ''"> and mac like concat('%', #{mac}, '%')</if>
|
|
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
|
|
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
|
<if test="modelId != null "> and model_id = #{modelId}</if>
|
|
<if test="isDefault != null and isDefault != ''"> and is_default = #{isDefault}</if>
|
|
<if test="macList != null and macList.size() > 0">
|
|
and mac in
|
|
<foreach collection="macList" open="(" close=")" separator="," item="item">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
order by is_default desc
|
|
</select>
|
|
|
|
<select id="selectAsDeviceByDeviceId" parameterType="Long" resultMap="AsDeviceResult">
|
|
<include refid="selectAsDeviceVo"/>
|
|
where device_id = #{deviceId}
|
|
</select>
|
|
|
|
<select id="selectAsDeviceByMac" parameterType="String" resultMap="AsDeviceResult">
|
|
<include refid="selectAsDeviceVo"/>
|
|
where mac = #{mac}
|
|
</select>
|
|
|
|
<select id="isBandByMac" resultType="java.lang.Integer">
|
|
select count(1) from as_device
|
|
where mac = #{mac} and user_id IS NOT NULL and is_network = 1 and user_id != 0
|
|
</select>
|
|
|
|
<insert id="insertAsDevice" parameterType="AsDevice" useGeneratedKeys="true" keyProperty="deviceId">
|
|
insert into as_device
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="picture != null">picture,</if>
|
|
<if test="deviceName != null">device_name,</if>
|
|
<if test="classifyId != null">classify_id,</if>
|
|
<if test="classifyName != null and classifyName != ''">classify_name,</if>
|
|
<if test="modelId != null">model_id,</if>
|
|
<if test="model != null">model,</if>
|
|
<if test="mac != null">mac,</if>
|
|
<if test="activationTime != null">activation_time,</if>
|
|
<if test="onlineStatus != null">online_status,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="userName != null and userName != ''">user_name,</if>
|
|
<if test="nickName != null and nickName != ''">nick_name,</if>
|
|
<if test="regularWatering != null">regular_watering,</if>
|
|
<if test="soilMoistureOpen != null">soil_moisture_open,</if>
|
|
<if test="soilMoistureClose != null">soil_moisture_close,</if>
|
|
<if test="waterIntensity != null">water_intensity,</if>
|
|
<if test="pulseMode != null">pulse_mode,</if>
|
|
<if test="pulseModeParam != null">pulse_mode_param,</if>
|
|
<if test="screenRestTime != null">screen_rest_time,</if>
|
|
<if test="version != null">version,</if>
|
|
<if test="versionId != null">version_id,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="regularWateringJson != null">regular_watering_json,</if>
|
|
<if test="soilMoisture != null">soil_moisture,</if>
|
|
<if test="waterIntensitySwitch != null">water_intensity_switch</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="picture != null">#{picture},</if>
|
|
<if test="deviceName != null">#{deviceName},</if>
|
|
<if test="classifyId != null">#{classifyId},</if>
|
|
<if test="classifyName != null and classifyName != ''">#{classifyName},</if>
|
|
<if test="modelId != null">#{modelId},</if>
|
|
<if test="model != null">#{model},</if>
|
|
<if test="mac != null">#{mac},</if>
|
|
<if test="activationTime != null">#{activationTime},</if>
|
|
<if test="onlineStatus != null">#{onlineStatus},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="userName != null and userName != ''">#{userName},</if>
|
|
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
|
<if test="regularWatering != null">#{regularWatering},</if>
|
|
<if test="soilMoistureOpen != null">#{soilMoistureOpen},</if>
|
|
<if test="soilMoistureClose != null">#{soilMoistureClose},</if>
|
|
<if test="waterIntensity != null">#{waterIntensity},</if>
|
|
<if test="pulseMode != null">#{pulseMode},</if>
|
|
<if test="pulseModeParam != null">#{pulseModeParam},</if>
|
|
<if test="screenRestTime != null">#{screenRestTime},</if>
|
|
<if test="version != null">#{version},</if>
|
|
<if test="versionId != null">#{versionId},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="regularWateringJson != null">#{regularWateringJson},</if>
|
|
<if test="soilMoisture != null">#{soilMoisture},</if>
|
|
<if test="waterIntensitySwitch != null">#{waterIntensitySwitch}</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateAsDevice" parameterType="AsDevice">
|
|
update as_device
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="picture != null">picture = #{picture},</if>
|
|
<if test="deviceName != null">device_name = #{deviceName},</if>
|
|
<if test="classifyId != null">classify_id = #{classifyId},</if>
|
|
<if test="classifyName != null and classifyName != ''">classify_name = #{classifyName},</if>
|
|
<if test="modelId != null">model_id = #{modelId},</if>
|
|
<if test="model != null">model = #{model},</if>
|
|
<if test="mac != null">mac = #{mac},</if>
|
|
<if test="activationTime != null">activation_time = #{activationTime},</if>
|
|
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
|
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
|
<if test="regularWatering != null">regular_watering = #{regularWatering},</if>
|
|
<if test="soilMoistureOpen != null">soil_moisture_open = #{soilMoistureOpen},</if>
|
|
<if test="soilMoistureClose != null">soil_moisture_close = #{soilMoistureClose},</if>
|
|
<if test="waterIntensity != null">water_intensity = #{waterIntensity},</if>
|
|
<if test="pulseMode != null">pulse_mode = #{pulseMode},</if>
|
|
<if test="pulseModeParam != null">pulse_mode_param = #{pulseModeParam},</if>
|
|
<if test="screenRestTime != null">screen_rest_time = #{screenRestTime},</if>
|
|
<if test="version != null">version = #{version},</if>
|
|
<if test="versionId != null">version_id = #{versionId},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="regularWateringJson != null">regular_watering_json = #{regularWateringJson},</if>
|
|
<if test="soilMoisture != null">soil_moisture = #{soilMoisture},</if>
|
|
<if test="waterIntensitySwitch != null">water_intensity_switch = #{waterIntensitySwitch},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="isNetwork != null">is_network = #{isNetwork},</if>
|
|
<if test="isDefault != null">is_default = #{isDefault},</if>
|
|
<if test="modeStr != null">mode_str = #{modeStr},</if>
|
|
<if test="bluetoothId != null">bluetooth_id = #{bluetoothId},</if>
|
|
<if test="bluetoothName != null">bluetooth_name = #{bluetoothName}</if>
|
|
</trim>
|
|
where device_id = #{deviceId}
|
|
</update>
|
|
|
|
<update id="updateAsDeviceByMac" parameterType="AsDevice">
|
|
update as_device
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="picture != null">picture = #{picture},</if>
|
|
<if test="deviceName != null">device_name = #{deviceName},</if>
|
|
<if test="classifyId != null">classify_id = #{classifyId},</if>
|
|
<if test="classifyName != null and classifyName != ''">classify_name = #{classifyName},</if>
|
|
<if test="modelId != null">model_id = #{modelId},</if>
|
|
<if test="model != null">model = #{model},</if>
|
|
<if test="activationTime != null">activation_time = #{activationTime},</if>
|
|
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
|
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
|
<if test="regularWatering != null">regular_watering = #{regularWatering},</if>
|
|
<if test="soilMoistureOpen != null">soil_moisture_open = #{soilMoistureOpen},</if>
|
|
<if test="soilMoistureClose != null">soil_moisture_close = #{soilMoistureClose},</if>
|
|
<if test="waterIntensity != null">water_intensity = #{waterIntensity},</if>
|
|
<if test="pulseMode != null">pulse_mode = #{pulseMode},</if>
|
|
<if test="pulseModeParam != null">pulse_mode_param = #{pulseModeParam},</if>
|
|
<if test="screenRestTime != null">screen_rest_time = #{screenRestTime},</if>
|
|
<if test="version != null">version = #{version},</if>
|
|
<if test="versionId != null">version_id = #{versionId},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="regularWateringJson != null">regular_watering_json = #{regularWateringJson},</if>
|
|
<if test="soilMoisture != null">soil_moisture = #{soilMoisture},</if>
|
|
<if test="waterIntensitySwitch != null">water_intensity_switch = #{waterIntensitySwitch},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="isNetwork != null">is_network = #{isNetwork},</if>
|
|
<if test="isDefault != null">is_default = #{isDefault},</if>
|
|
<if test="modeStr != null">mode_str = #{modeStr}</if>
|
|
</trim>
|
|
where mac = #{mac}
|
|
</update>
|
|
|
|
<delete id="deleteAsDeviceByDeviceId" parameterType="Long">
|
|
delete from as_device where device_id = #{deviceId}
|
|
</delete>
|
|
|
|
<delete id="deleteAsDeviceByDeviceIds" parameterType="String">
|
|
delete from as_device where device_id in
|
|
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
|
#{deviceId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|