a-tuoheng-task/src/main/resources/mapper/task/TaskPlanMapper.xml

142 lines
7.5 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.task.mapper.TaskPlanMapper">
<resultMap type="com.ruoyi.task.mapper.entity.TaskPlanEntity" id="TaskPlanResult">
<result property="id" column="id" />
<result property="planName" column="plan_name" />
<result property="planType" column="plan_type" />
<result property="cycleType" column="cycle_type" />
<result property="cycleValue" column="cycle_value" />
<result property="executeType" column="execute_type" />
<result property="executeTime" column="execute_time" />
<result property="duration" column="duration" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="routeId" column="route_id" />
<result property="uavId" column="uav_id" />
<result property="status" column="status" />
<result property="description" column="description" />
<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="selectTaskPlanVo">
select id, plan_name, plan_type, cycle_type, cycle_value, execute_type,
execute_time, duration, start_date, end_date, route_id, uav_id, status,
description, create_by, create_time, update_by, update_time, remark
from task_plan
</sql>
<select id="selectTaskPlanById" parameterType="Long" resultMap="TaskPlanResult">
<include refid="selectTaskPlanVo"/>
where id = #{id}
</select>
<select id="selectTaskPlanList" parameterType="com.ruoyi.task.mapper.entity.TaskPlanEntity" resultMap="TaskPlanResult">
<include refid="selectTaskPlanVo"/>
<where>
<if test="planName != null and planName != ''">
and plan_name like concat('%', #{planName}, '%')
</if>
<if test="planType != null and planType != ''">
and plan_type = #{planType}
</if>
<if test="cycleType != null and cycleType != ''">
and cycle_type = #{cycleType}
</if>
<if test="executeType != null and executeType != ''">
and execute_type = #{executeType}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="routeId != null">
and route_id = #{routeId}
</if>
<if test="uavId != null">
and uav_id = #{uavId}
</if>
</where>
</select>
<insert id="insertTaskPlan" parameterType="com.ruoyi.task.mapper.entity.TaskPlanEntity" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into task_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planName != null and planName != ''">plan_name,</if>
<if test="planType != null and planType != ''">plan_type,</if>
<if test="cycleType != null and cycleType != ''">cycle_type,</if>
<if test="cycleValue != null and cycleValue != ''">cycle_value,</if>
<if test="executeType != null and executeType != ''">execute_type,</if>
<if test="executeTime != null">execute_time,</if>
<if test="duration != null">duration,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="routeId != null">route_id,</if>
<if test="uavId != null">uav_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="description != null and description != ''">description,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planName != null and planName != ''">#{planName},</if>
<if test="planType != null and planType != ''">#{planType},</if>
<if test="cycleType != null and cycleType != ''">#{cycleType},</if>
<if test="cycleValue != null and cycleValue != ''">#{cycleValue},</if>
<if test="executeType != null and executeType != ''">#{executeType},</if>
<if test="executeTime != null">#{executeTime},</if>
<if test="duration != null">#{duration},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="routeId != null">#{routeId},</if>
<if test="uavId != null">#{uavId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
now()
</trim>
</insert>
<update id="updateTaskPlan" parameterType="com.ruoyi.task.mapper.entity.TaskPlanEntity">
update task_plan
<trim prefix="SET" suffixOverrides=",">
<if test="planName != null and planName != ''">plan_name = #{planName},</if>
<if test="planType != null and planType != ''">plan_type = #{planType},</if>
<if test="cycleType != null and cycleType != ''">cycle_type = #{cycleType},</if>
<if test="cycleValue != null and cycleValue != ''">cycle_value = #{cycleValue},</if>
<if test="executeType != null and executeType != ''">execute_type = #{executeType},</if>
<if test="executeTime != null">execute_time = #{executeTime},</if>
<if test="duration != null">duration = #{duration},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="routeId != null">route_id = #{routeId},</if>
<if test="uavId != null">uav_id = #{uavId},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="description != null and description != ''">description = #{description},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = now()
</trim>
where id = #{id}
</update>
<delete id="deleteTaskPlanById" parameterType="Long">
delete from task_plan where id = #{id}
</delete>
<delete id="deleteTaskPlanByIds" parameterType="Long">
delete from task_plan where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>