98 lines
4.6 KiB
XML
98 lines
4.6 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.AsTimerMapper">
|
|
|
|
<resultMap type="AsTimer" id="AsTimerResult">
|
|
<result property="id" column="id" />
|
|
<result property="deviceId" column="device_id" />
|
|
<result property="mode" column="mode" />
|
|
<result property="startTime" column="start_time" />
|
|
<result property="wateringDuration" column="watering_duration" />
|
|
<result property="week" column="week" />
|
|
<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="selectAsTimerVo">
|
|
select id, device_id, mode, start_time, watering_duration, is_switch, week, create_by, create_time, update_by, update_time, remark from as_timer
|
|
</sql>
|
|
|
|
<select id="selectAsTimerList" parameterType="AsTimer" resultMap="AsTimerResult">
|
|
<include refid="selectAsTimerVo"/>
|
|
<where>
|
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
|
<if test="mode != null and mode != ''"> and mode = #{mode}</if>
|
|
<if test="startTime != null "> and start_time = #{startTime}</if>
|
|
<if test="wateringDuration != null "> and watering_duration = #{wateringDuration}</if>
|
|
<if test="week != null and week != ''"> and week = #{week}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectAsTimerById" parameterType="Long" resultMap="AsTimerResult">
|
|
<include refid="selectAsTimerVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertAsTimer" parameterType="AsTimer" useGeneratedKeys="true" keyProperty="id">
|
|
insert into as_timer
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="deviceId != null">device_id,</if>
|
|
<if test="mode != null">mode,</if>
|
|
<if test="startTime != null">start_time,</if>
|
|
<if test="wateringDuration != null">watering_duration,</if>
|
|
<if test="week != null">week,</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="deviceId != null">#{deviceId},</if>
|
|
<if test="mode != null">#{mode},</if>
|
|
<if test="startTime != null">#{startTime},</if>
|
|
<if test="wateringDuration != null">#{wateringDuration},</if>
|
|
<if test="week != null">#{week},</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="updateAsTimer" parameterType="AsTimer">
|
|
update as_timer
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
|
<if test="mode != null">mode = #{mode},</if>
|
|
<if test="startTime != null">start_time = #{startTime},</if>
|
|
<if test="wateringDuration != null">watering_duration = #{wateringDuration},</if>
|
|
<if test="isSwitch != null">is_switch = #{isSwitch},</if>
|
|
<if test="week != null">week = #{week},</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 id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteAsTimerById" parameterType="Long">
|
|
delete from as_timer where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteAsTimerByIds" parameterType="String">
|
|
delete from as_timer where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|