157 lines
9.3 KiB
XML
157 lines
9.3 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="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" />
|
||
|
</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, create_by, create_time, update_by, update_time, remark from as_device
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectAsDeviceList" parameterType="AsDevice" resultMap="AsDeviceResult">
|
||
|
<include refid="selectAsDeviceVo"/>
|
||
|
<where>
|
||
|
<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 = #{model}</if>
|
||
|
<if test="mac != null and mac != ''"> and mac = #{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>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectAsDeviceByDeviceId" parameterType="Long" resultMap="AsDeviceResult">
|
||
|
<include refid="selectAsDeviceVo"/>
|
||
|
where device_id = #{deviceId}
|
||
|
</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="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>
|
||
|
</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="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>
|
||
|
</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="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>
|
||
|
</trim>
|
||
|
where device_id = #{deviceId}
|
||
|
</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>
|