添加任务数据库设计

This commit is contained in:
孙小云 2026-03-05 16:14:52 +08:00
parent 0bfe9843a5
commit dbafd98b14
10 changed files with 1190 additions and 0 deletions

View File

@ -0,0 +1,60 @@
package com.ruoyi.task.mapper;
import com.ruoyi.task.mapper.entity.TaskInfoEntity;
import java.util.List;
/**
* 任务信息表Mapper接口
*
* @author ruoyi
* @date 2026-03-05
*/
public interface TaskInfoMapper {
/**
* 根据任务主键查询任务信息
*
* @param id 任务主键
* @return 任务信息
*/
TaskInfoEntity selectTaskInfoById(Long id);
/**
* 查询任务信息列表
*
* @param taskInfo 任务信息
* @return 任务信息集合
*/
List<TaskInfoEntity> selectTaskInfoList(TaskInfoEntity taskInfo);
/**
* 新增任务信息
*
* @param taskInfo 任务信息
* @return 影响行数
*/
int insertTaskInfo(TaskInfoEntity taskInfo);
/**
* 修改任务信息
*
* @param taskInfo 任务信息
* @return 影响行数
*/
int updateTaskInfo(TaskInfoEntity taskInfo);
/**
* 删除任务信息
*
* @param id 任务主键
* @return 影响行数
*/
int deleteTaskInfoById(Long id);
/**
* 批量删除任务信息
*
* @param ids 需要删除的任务主键集合
* @return 影响行数
*/
int deleteTaskInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,60 @@
package com.ruoyi.task.mapper;
import com.ruoyi.task.mapper.entity.TaskPlanEntity;
import java.util.List;
/**
* 任务计划表Mapper接口
*
* @author ruoyi
* @date 2026-03-05
*/
public interface TaskPlanMapper {
/**
* 根据计划主键查询任务计划
*
* @param id 计划主键
* @return 任务计划信息
*/
TaskPlanEntity selectTaskPlanById(Long id);
/**
* 查询任务计划列表
*
* @param taskPlan 任务计划信息
* @return 任务计划集合
*/
List<TaskPlanEntity> selectTaskPlanList(TaskPlanEntity taskPlan);
/**
* 新增任务计划
*
* @param taskPlan 任务计划信息
* @return 影响行数
*/
int insertTaskPlan(TaskPlanEntity taskPlan);
/**
* 修改任务计划
*
* @param taskPlan 任务计划信息
* @return 影响行数
*/
int updateTaskPlan(TaskPlanEntity taskPlan);
/**
* 删除任务计划
*
* @param id 计划主键
* @return 影响行数
*/
int deleteTaskPlanById(Long id);
/**
* 批量删除任务计划
*
* @param ids 需要删除的计划主键集合
* @return 影响行数
*/
int deleteTaskPlanByIds(Long[] ids);
}

View File

@ -0,0 +1,60 @@
package com.ruoyi.task.mapper;
import com.ruoyi.task.mapper.entity.TaskStatEntity;
import java.util.List;
/**
* 任务统计表Mapper接口
*
* @author ruoyi
* @date 2026-03-05
*/
public interface TaskStatMapper {
/**
* 根据统计主键查询任务统计
*
* @param id 统计主键
* @return 任务统计信息
*/
TaskStatEntity selectTaskStatById(Long id);
/**
* 查询任务统计列表
*
* @param taskStat 任务统计信息
* @return 任务统计集合
*/
List<TaskStatEntity> selectTaskStatList(TaskStatEntity taskStat);
/**
* 新增任务统计
*
* @param taskStat 任务统计信息
* @return 影响行数
*/
int insertTaskStat(TaskStatEntity taskStat);
/**
* 修改任务统计
*
* @param taskStat 任务统计信息
* @return 影响行数
*/
int updateTaskStat(TaskStatEntity taskStat);
/**
* 删除任务统计
*
* @param id 统计主键
* @return 影响行数
*/
int deleteTaskStatById(Long id);
/**
* 批量删除任务统计
*
* @param ids 需要删除的统计主键集合
* @return 影响行数
*/
int deleteTaskStatByIds(Long[] ids);
}

View File

@ -0,0 +1,166 @@
package com.ruoyi.task.mapper.entity;
import com.ruoyi.common.core.web.domain.BaseEntity;
import java.util.Date;
/**
* 任务信息表实体对象 task_info
* Mapper 层实体对应数据库表
*
* @author ruoyi
* @date 2026-03-05
*/
public class TaskInfoEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 任务主键 */
private Long id;
/** 任务名称 */
private String taskName;
/** 任务类别 */
private String taskCategory;
/** 任务类型 */
private String taskType;
/** 计划ID */
private Long planId;
/** 航线ID */
private Long routeId;
/** 无人机ID */
private Long uavId;
/** 执行类型 */
private String executeType;
/** 状态 */
private String status;
/** 开始时间 */
private Date startTime;
/** 结束时间 */
private Date endTime;
/** 描述 */
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTaskName() {
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public String getTaskCategory() {
return taskCategory;
}
public void setTaskCategory(String taskCategory) {
this.taskCategory = taskCategory;
}
public String getTaskType() {
return taskType;
}
public void setTaskType(String taskType) {
this.taskType = taskType;
}
public Long getPlanId() {
return planId;
}
public void setPlanId(Long planId) {
this.planId = planId;
}
public Long getRouteId() {
return routeId;
}
public void setRouteId(Long routeId) {
this.routeId = routeId;
}
public Long getUavId() {
return uavId;
}
public void setUavId(Long uavId) {
this.uavId = uavId;
}
public String getExecuteType() {
return executeType;
}
public void setExecuteType(String executeType) {
this.executeType = executeType;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "TaskInfoEntity{" +
"id=" + id +
", taskName='" + taskName + '\'' +
", taskCategory='" + taskCategory + '\'' +
", taskType='" + taskType + '\'' +
", planId=" + planId +
", routeId=" + routeId +
", uavId=" + uavId +
", executeType='" + executeType + '\'' +
", status='" + status + '\'' +
", startTime=" + startTime +
", endTime=" + endTime +
", description='" + description + '\'' +
'}';
}
}

View File

@ -0,0 +1,178 @@
package com.ruoyi.task.mapper.entity;
import com.ruoyi.common.core.web.domain.BaseEntity;
import java.util.Date;
/**
* 任务计划表实体对象 task_plan
* Mapper 层实体对应数据库表
*
* @author ruoyi
* @date 2026-03-05
*/
public class TaskPlanEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 计划主键 */
private Long id;
/** 计划名称 */
private String planName;
/** 计划类型 */
private String planType;
/** 周期类型 */
private String cycleType;
/** 周期值 */
private String cycleValue;
/** 执行类型 */
private String executeType;
/** 执行时间 */
private Date executeTime;
/** 开始日期 */
private Date startDate;
/** 结束日期 */
private Date endDate;
/** 航线ID */
private Long routeId;
/** 无人机ID */
private Long uavId;
/** 状态 */
private String status;
/** 描述 */
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPlanName() {
return planName;
}
public void setPlanName(String planName) {
this.planName = planName;
}
public String getPlanType() {
return planType;
}
public void setPlanType(String planType) {
this.planType = planType;
}
public String getCycleType() {
return cycleType;
}
public void setCycleType(String cycleType) {
this.cycleType = cycleType;
}
public String getCycleValue() {
return cycleValue;
}
public void setCycleValue(String cycleValue) {
this.cycleValue = cycleValue;
}
public String getExecuteType() {
return executeType;
}
public void setExecuteType(String executeType) {
this.executeType = executeType;
}
public Date getExecuteTime() {
return executeTime;
}
public void setExecuteTime(Date executeTime) {
this.executeTime = executeTime;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getRouteId() {
return routeId;
}
public void setRouteId(Long routeId) {
this.routeId = routeId;
}
public Long getUavId() {
return uavId;
}
public void setUavId(Long uavId) {
this.uavId = uavId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "TaskPlanEntity{" +
"id=" + id +
", planName='" + planName + '\'' +
", planType='" + planType + '\'' +
", cycleType='" + cycleType + '\'' +
", cycleValue='" + cycleValue + '\'' +
", executeType='" + executeType + '\'' +
", executeTime=" + executeTime +
", startDate=" + startDate +
", endDate=" + endDate +
", routeId=" + routeId +
", uavId=" + uavId +
", status='" + status + '\'' +
", description='" + description + '\'' +
'}';
}
}

View File

@ -0,0 +1,140 @@
package com.ruoyi.task.mapper.entity;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* 任务统计表实体对象 task_stat
* Mapper 层实体对应数据库表
*
* @author ruoyi
* @date 2026-03-05
*/
public class TaskStatEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 统计主键 */
private Long id;
/** 机场代码 */
private String airportCode;
/** 航线名称 */
private String routeName;
/** 任务类别 */
private String taskCategory;
/** 任务类型 */
private String taskType;
/** 任务状态 */
private String taskStatus;
/** 年份 */
private Integer year;
/** 月份 */
private Integer month;
/** 日期 */
private Integer day;
/** 任务数量 */
private Integer taskCount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAirportCode() {
return airportCode;
}
public void setAirportCode(String airportCode) {
this.airportCode = airportCode;
}
public String getRouteName() {
return routeName;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
}
public String getTaskCategory() {
return taskCategory;
}
public void setTaskCategory(String taskCategory) {
this.taskCategory = taskCategory;
}
public String getTaskType() {
return taskType;
}
public void setTaskType(String taskType) {
this.taskType = taskType;
}
public String getTaskStatus() {
return taskStatus;
}
public void setTaskStatus(String taskStatus) {
this.taskStatus = taskStatus;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public Integer getMonth() {
return month;
}
public void setMonth(Integer month) {
this.month = month;
}
public Integer getDay() {
return day;
}
public void setDay(Integer day) {
this.day = day;
}
public Integer getTaskCount() {
return taskCount;
}
public void setTaskCount(Integer taskCount) {
this.taskCount = taskCount;
}
@Override
public String toString() {
return "TaskStatEntity{" +
"id=" + id +
", airportCode='" + airportCode + '\'' +
", routeName='" + routeName + '\'' +
", taskCategory='" + taskCategory + '\'' +
", taskType='" + taskType + '\'' +
", taskStatus='" + taskStatus + '\'' +
", year=" + year +
", month=" + month +
", day=" + day +
", taskCount=" + taskCount +
'}';
}
}

View File

@ -0,0 +1,123 @@
-- ----------------------------
-- 任务计划表
-- ----------------------------
CREATE TABLE IF NOT EXISTS task_plan (
id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '计划ID',
plan_name VARCHAR(100) NOT NULL COMMENT '计划名称',
plan_type VARCHAR(50) NOT NULL COMMENT '计划类型(定时任务计划、周期任务计划)',
execute_type VARCHAR(50) NOT NULL COMMENT '执行类型(单次执行、连续执行)',
cycle_type VARCHAR(50) DEFAULT '' COMMENT '周期类型(日周期、周周期、月周期)',
cycle_value VARCHAR(100) DEFAULT '' COMMENT '周期值周周期1-7多选如"1,3,5"月周期1-31多选如"1,15,30"',
start_date DATETIME COMMENT '开始日期',
end_date DATETIME COMMENT '结束日期',
execute_time DATETIME COMMENT '执行时间(仅在定义任务时有效)',
route_id BIGINT(20) DEFAULT NULL COMMENT '航线ID',
uav_id BIGINT(20) DEFAULT NULL COMMENT '无人机ID',
status CHAR(1) DEFAULT '0' COMMENT '计划状态0待执行 1执行中 2已完成 3已取消',
description VARCHAR(500) DEFAULT NULL COMMENT '描述',
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
create_time DATETIME COMMENT '创建时间',
update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
update_time DATETIME COMMENT '更新时间',
remark VARCHAR(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=100 COMMENT='任务计划表';
-- ----------------------------
-- 任务表
-- ----------------------------
CREATE TABLE IF NOT EXISTS task_info (
id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '任务ID',
plan_id BIGINT(20) DEFAULT NULL COMMENT '计划ID可为空如一键起飞',
task_name VARCHAR(100) NOT NULL COMMENT '任务名称',
task_category VARCHAR(50) NOT NULL COMMENT '任务类别(如人工执飞)',
task_type VARCHAR(50) NOT NULL COMMENT '任务类型(如一键起飞)',
execute_type VARCHAR(50) NOT NULL COMMENT '执行类型(单次执行、连续执行)',
route_id BIGINT(20) DEFAULT NULL COMMENT '航线ID',
uav_id BIGINT(20) DEFAULT NULL COMMENT '无人机ID',
status CHAR(1) DEFAULT '0' COMMENT '任务状态0待执行 1执行中 2已完成 3已取消',
start_time DATETIME COMMENT '开始时间',
end_time DATETIME COMMENT '结束时间',
description VARCHAR(500) DEFAULT NULL COMMENT '描述',
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
create_time DATETIME COMMENT '创建时间',
update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
update_time DATETIME COMMENT '更新时间',
remark VARCHAR(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (id),
KEY idx_task_info_plan_id (plan_id)
) ENGINE=InnoDB AUTO_INCREMENT=100 COMMENT='任务表';
-- ----------------------------
-- 任务统计表
-- ----------------------------
CREATE TABLE IF NOT EXISTS task_stat (
id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '统计ID',
airport_code VARCHAR(50) DEFAULT '' COMMENT '机场代码',
route_name VARCHAR(100) DEFAULT '' COMMENT '航线名称',
task_category VARCHAR(50) NOT NULL COMMENT '任务类别(如人工执飞)',
task_type VARCHAR(50) NOT NULL COMMENT '任务类型(如一键起飞)',
task_status CHAR(1) DEFAULT '0' COMMENT '任务状态0待执行 1执行中 2已完成 3已取消',
year INT(4) COMMENT '年份',
month INT(2) COMMENT '月份',
day INT(2) COMMENT '日期',
task_count INT(11) DEFAULT 0 COMMENT '任务数量',
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
create_time DATETIME COMMENT '创建时间',
update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
update_time DATETIME COMMENT '更新时间',
remark VARCHAR(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (id),
KEY idx_task_stat_year (year),
KEY idx_task_stat_month (month),
KEY idx_task_stat_day (day),
KEY idx_task_stat_task_category (task_category),
KEY idx_task_stat_task_type (task_type),
KEY idx_task_stat_task_status (task_status)
) ENGINE=InnoDB AUTO_INCREMENT=100 COMMENT='任务统计表';
-- ----------------------------
-- 计划与航线关联表
-- ----------------------------
CREATE TABLE IF NOT EXISTS plan_airline (
plan_id BIGINT(20) NOT NULL COMMENT '计划ID',
airline_id BIGINT(20) NOT NULL COMMENT '航线ID',
PRIMARY KEY (plan_id, airline_id)
) ENGINE=InnoDB COMMENT='计划与航线关联表';
-- ----------------------------
-- 计划与无人机关联表
-- ----------------------------
CREATE TABLE IF NOT EXISTS plan_uav (
plan_id BIGINT(20) NOT NULL COMMENT '计划ID',
uav_id BIGINT(20) NOT NULL COMMENT '无人机ID',
PRIMARY KEY (plan_id, uav_id)
) ENGINE=InnoDB COMMENT='计划与无人机关联表';
-- ----------------------------
-- 任务与航线关联表
-- ----------------------------
CREATE TABLE IF NOT EXISTS task_airline (
task_id BIGINT(20) NOT NULL COMMENT '任务ID',
airline_id BIGINT(20) NOT NULL COMMENT '航线ID',
PRIMARY KEY (task_id, airline_id)
) ENGINE=InnoDB COMMENT='任务与航线关联表';
-- ----------------------------
-- 任务与无人机关联表
-- ----------------------------
CREATE TABLE IF NOT EXISTS task_uav (
task_id BIGINT(20) NOT NULL COMMENT '任务ID',
uav_id BIGINT(20) NOT NULL COMMENT '无人机ID',
PRIMARY KEY (task_id, uav_id)
) ENGINE=InnoDB COMMENT='任务与无人机关联表';
-- ----------------------------
-- 任务与用户关联表
-- ----------------------------
CREATE TABLE IF NOT EXISTS task_user (
task_id BIGINT(20) NOT NULL COMMENT '任务ID',
user_id BIGINT(20) NOT NULL COMMENT '用户ID',
role_type VARCHAR(50) DEFAULT '' COMMENT '角色类型(负责人、参与者等)',
PRIMARY KEY (task_id, user_id)
) ENGINE=InnoDB COMMENT='任务与用户关联表';

View File

@ -0,0 +1,137 @@
<?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.TaskInfoMapper">
<resultMap type="com.ruoyi.task.mapper.entity.TaskInfoEntity" id="TaskInfoResult">
<result property="id" column="id" />
<result property="taskName" column="task_name" />
<result property="taskCategory" column="task_category" />
<result property="taskType" column="task_type" />
<result property="planId" column="plan_id" />
<result property="routeId" column="route_id" />
<result property="uavId" column="uav_id" />
<result property="executeType" column="execute_type" />
<result property="status" column="status" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<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="selectTaskInfoVo">
select id, task_name, task_category, task_type, plan_id, route_id,
uav_id, execute_type, status, start_time, end_time, description,
create_by, create_time, update_by, update_time, remark
from task_info
</sql>
<select id="selectTaskInfoById" parameterType="Long" resultMap="TaskInfoResult">
<include refid="selectTaskInfoVo"/>
where id = #{id}
</select>
<select id="selectTaskInfoList" parameterType="com.ruoyi.task.mapper.entity.TaskInfoEntity" resultMap="TaskInfoResult">
<include refid="selectTaskInfoVo"/>
<where>
<if test="taskName != null and taskName != ''">
and task_name like concat('%', #{taskName}, '%')
</if>
<if test="taskCategory != null and taskCategory != ''">
and task_category = #{taskCategory}
</if>
<if test="taskType != null and taskType != ''">
and task_type = #{taskType}
</if>
<if test="planId != null">
and plan_id = #{planId}
</if>
<if test="routeId != null">
and route_id = #{routeId}
</if>
<if test="uavId != null">
and uav_id = #{uavId}
</if>
<if test="executeType != null and executeType != ''">
and execute_type = #{executeType}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
</select>
<insert id="insertTaskInfo" parameterType="com.ruoyi.task.mapper.entity.TaskInfoEntity" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into task_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskName != null and taskName != ''">task_name,</if>
<if test="taskCategory != null and taskCategory != ''">task_category,</if>
<if test="taskType != null and taskType != ''">task_type,</if>
<if test="planId != null">plan_id,</if>
<if test="routeId != null">route_id,</if>
<if test="uavId != null">uav_id,</if>
<if test="executeType != null and executeType != ''">execute_type,</if>
<if test="status != null and status != ''">status,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</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="taskName != null and taskName != ''">#{taskName},</if>
<if test="taskCategory != null and taskCategory != ''">#{taskCategory},</if>
<if test="taskType != null and taskType != ''">#{taskType},</if>
<if test="planId != null">#{planId},</if>
<if test="routeId != null">#{routeId},</if>
<if test="uavId != null">#{uavId},</if>
<if test="executeType != null and executeType != ''">#{executeType},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</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="updateTaskInfo" parameterType="com.ruoyi.task.mapper.entity.TaskInfoEntity">
update task_info
<trim prefix="SET" suffixOverrides=",">
<if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
<if test="taskCategory != null and taskCategory != ''">task_category = #{taskCategory},</if>
<if test="taskType != null and taskType != ''">task_type = #{taskType},</if>
<if test="planId != null">plan_id = #{planId},</if>
<if test="routeId != null">route_id = #{routeId},</if>
<if test="uavId != null">uav_id = #{uavId},</if>
<if test="executeType != null and executeType != ''">execute_type = #{executeType},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</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="deleteTaskInfoById" parameterType="Long">
delete from task_info where id = #{id}
</delete>
<delete id="deleteTaskInfoByIds" parameterType="Long">
delete from task_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,138 @@
<?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="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, 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="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="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="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>

View File

@ -0,0 +1,128 @@
<?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.TaskStatMapper">
<resultMap type="com.ruoyi.task.mapper.entity.TaskStatEntity" id="TaskStatResult">
<result property="id" column="id" />
<result property="airportCode" column="airport_code" />
<result property="routeName" column="route_name" />
<result property="taskCategory" column="task_category" />
<result property="taskType" column="task_type" />
<result property="taskStatus" column="task_status" />
<result property="year" column="year" />
<result property="month" column="month" />
<result property="day" column="day" />
<result property="taskCount" column="task_count" />
<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="selectTaskStatVo">
select id, airport_code, route_name, task_category, task_type, task_status,
year, month, day, task_count, create_by, create_time, update_by, update_time, remark
from task_stat
</sql>
<select id="selectTaskStatById" parameterType="Long" resultMap="TaskStatResult">
<include refid="selectTaskStatVo"/>
where id = #{id}
</select>
<select id="selectTaskStatList" parameterType="com.ruoyi.task.mapper.entity.TaskStatEntity" resultMap="TaskStatResult">
<include refid="selectTaskStatVo"/>
<where>
<if test="airportCode != null and airportCode != ''">
and airport_code = #{airportCode}
</if>
<if test="routeName != null and routeName != ''">
and route_name like concat('%', #{routeName}, '%')
</if>
<if test="taskCategory != null and taskCategory != ''">
and task_category = #{taskCategory}
</if>
<if test="taskType != null and taskType != ''">
and task_type = #{taskType}
</if>
<if test="taskStatus != null and taskStatus != ''">
and task_status = #{taskStatus}
</if>
<if test="year != null">
and year = #{year}
</if>
<if test="month != null">
and month = #{month}
</if>
<if test="day != null">
and day = #{day}
</if>
</where>
</select>
<insert id="insertTaskStat" parameterType="com.ruoyi.task.mapper.entity.TaskStatEntity" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into task_stat
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="airportCode != null and airportCode != ''">airport_code,</if>
<if test="routeName != null and routeName != ''">route_name,</if>
<if test="taskCategory != null and taskCategory != ''">task_category,</if>
<if test="taskType != null and taskType != ''">task_type,</if>
<if test="taskStatus != null and taskStatus != ''">task_status,</if>
<if test="year != null">year,</if>
<if test="month != null">month,</if>
<if test="day != null">day,</if>
<if test="taskCount != null">task_count,</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="airportCode != null and airportCode != ''">#{airportCode},</if>
<if test="routeName != null and routeName != ''">#{routeName},</if>
<if test="taskCategory != null and taskCategory != ''">#{taskCategory},</if>
<if test="taskType != null and taskType != ''">#{taskType},</if>
<if test="taskStatus != null and taskStatus != ''">#{taskStatus},</if>
<if test="year != null">#{year},</if>
<if test="month != null">#{month},</if>
<if test="day != null">#{day},</if>
<if test="taskCount != null">#{taskCount},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
now()
</trim>
</insert>
<update id="updateTaskStat" parameterType="com.ruoyi.task.mapper.entity.TaskStatEntity">
update task_stat
<trim prefix="SET" suffixOverrides=",">
<if test="airportCode != null and airportCode != ''">airport_code = #{airportCode},</if>
<if test="routeName != null and routeName != ''">route_name = #{routeName},</if>
<if test="taskCategory != null and taskCategory != ''">task_category = #{taskCategory},</if>
<if test="taskType != null and taskType != ''">task_type = #{taskType},</if>
<if test="taskStatus != null and taskStatus != ''">task_status = #{taskStatus},</if>
<if test="year != null">year = #{year},</if>
<if test="month != null">month = #{month},</if>
<if test="day != null">day = #{day},</if>
<if test="taskCount != null">task_count = #{taskCount},</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="deleteTaskStatById" parameterType="Long">
delete from task_stat where id = #{id}
</delete>
<delete id="deleteTaskStatByIds" parameterType="Long">
delete from task_stat where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>