DX
5 days ago
37 changed files with 1136 additions and 75 deletions
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.web.controller.app; |
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import com.ruoyi.system.service.ITasksService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
@RestController |
||||
@RequestMapping("/app/task") |
||||
@Slf4j |
||||
public class TaskController { |
||||
|
||||
@Autowired |
||||
private ITasksService iTasksService; |
||||
|
||||
@RequestMapping("/list") |
||||
public AjaxResult getTask() { |
||||
iTasksService.getAppTaskList(); |
||||
return AjaxResult.success(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,106 @@
|
||||
package com.ruoyi.web.controller.system; |
||||
|
||||
import java.util.List; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
import com.ruoyi.system.domain.vo.TaskSaveVo; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.PutMapping; |
||||
import org.springframework.web.bind.annotation.DeleteMapping; |
||||
import org.springframework.web.bind.annotation.PathVariable; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
import com.ruoyi.common.annotation.Log; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import com.ruoyi.common.enums.BusinessType; |
||||
import com.ruoyi.system.domain.Tasks; |
||||
import com.ruoyi.system.service.ITasksService; |
||||
import com.ruoyi.common.utils.poi.ExcelUtil; |
||||
import com.ruoyi.common.core.page.TableDataInfo; |
||||
|
||||
/** |
||||
* 任务,用于存储所有的任务信息,任务可由不同用户创建并管理。Controller |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-14 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/system/tasks") |
||||
public class TasksController extends BaseController |
||||
{ |
||||
@Autowired |
||||
private ITasksService tasksService; |
||||
|
||||
/** |
||||
* 查询任务,用于存储所有的任务信息,任务可由不同用户创建并管理。列表 |
||||
*/ |
||||
// @PreAuthorize("@ss.hasPermi('system:tasks:list')")
|
||||
// @GetMapping("/list")
|
||||
// public TableDataInfo list(Tasks tasks)
|
||||
// {
|
||||
// startPage();
|
||||
// List<Tasks> list = tasksService.(tasks);
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 导出任务,用于存储所有的任务信息,任务可由不同用户创建并管理。列表
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:tasks:export')")
|
||||
// @Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(HttpServletResponse response, Tasks tasks)
|
||||
// {
|
||||
// List<Tasks> list = tasksService.selectTasksList(tasks);
|
||||
// ExcelUtil<Tasks> util = new ExcelUtil<Tasks>(Tasks.class);
|
||||
// util.exportExcel(response, list, "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。数据");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取任务,用于存储所有的任务信息,任务可由不同用户创建并管理。详细信息
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:tasks:query')")
|
||||
// @GetMapping(value = "/{id}")
|
||||
// public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
// {
|
||||
// return success(tasksService.selectTasksById(id));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 新增任务,用于存储所有的任务信息,任务可由不同用户创建并管理。
|
||||
// */
|
||||
@PreAuthorize("@ss.hasPermi('system:tasks:add')") |
||||
@Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@RequestBody TaskSaveVo taskSaveVo) |
||||
{ |
||||
return toAjax(tasksService.insertTasks(taskSaveVo)); |
||||
} |
||||
//
|
||||
// /**
|
||||
// * 修改任务,用于存储所有的任务信息,任务可由不同用户创建并管理。
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:tasks:edit')")
|
||||
// @Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.UPDATE)
|
||||
// @PutMapping
|
||||
// public AjaxResult edit(@RequestBody Tasks tasks)
|
||||
// {
|
||||
// return toAjax(tasksService.updateTasks(tasks));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除任务,用于存储所有的任务信息,任务可由不同用户创建并管理。
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:tasks:remove')")
|
||||
// @Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{ids}")
|
||||
// public AjaxResult remove(@PathVariable Long[] ids)
|
||||
// {
|
||||
// return toAjax(tasksService.deleteTasksByIds(ids));
|
||||
// }
|
||||
} |
@ -1,28 +1,15 @@
|
||||
package com.ruoyi.common.config; |
||||
|
||||
import lombok.Data; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
@ConfigurationProperties(prefix = "wx") |
||||
@Data |
||||
public class WeChatConfig { |
||||
|
||||
private String appId; |
||||
private String appSecret; |
||||
|
||||
public String getAppId() { |
||||
return appId; |
||||
} |
||||
|
||||
public void setAppId(String appId) { |
||||
this.appId = appId; |
||||
} |
||||
|
||||
public String getAppSecret() { |
||||
return appSecret; |
||||
} |
||||
|
||||
public void setAppSecret(String appSecret) { |
||||
this.appSecret = appSecret; |
||||
} |
||||
private String callBackUrl; |
||||
} |
||||
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.common.core.domain; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class TaskDTO { |
||||
//任务标题
|
||||
private String title; |
||||
//任务类型
|
||||
private Integer taskType; |
||||
//任务优先级
|
||||
private String priority; |
||||
//任务状态
|
||||
private String status; |
||||
//任务计划开始时间
|
||||
private LocalDate startDate; |
||||
//任务计划结束时间
|
||||
private LocalDate endDate; |
||||
//企业集合
|
||||
private List<Long> enterprisesList; |
||||
} |
@ -0,0 +1,41 @@
|
||||
package com.ruoyi.common.utils; |
||||
|
||||
import org.quartz.*; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
/** |
||||
* 定时任务工具类,支持创建和删除任务 |
||||
*/ |
||||
@Component |
||||
public class ScheduleUtils { |
||||
|
||||
/** |
||||
* 创建定时任务 |
||||
* |
||||
* @param scheduler Quartz调度器 |
||||
* @param jobName 任务名称 |
||||
* @param groupName 任务分组 |
||||
* @param cronExpression Cron表达式 |
||||
* @param jobDetail 任务详情 |
||||
*/ |
||||
public static void createJob(Scheduler scheduler, String jobName, String groupName, String cronExpression, JobDetail jobDetail) throws SchedulerException { |
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression); |
||||
CronTrigger trigger = TriggerBuilder.newTrigger() |
||||
.withIdentity(jobName, groupName) |
||||
.withSchedule(cronScheduleBuilder) |
||||
.build(); |
||||
scheduler.scheduleJob(jobDetail, trigger); |
||||
} |
||||
|
||||
/** |
||||
* 删除定时任务 |
||||
* |
||||
* @param scheduler Quartz调度器 |
||||
* @param jobName 任务名称 |
||||
* @param groupName 任务分组 |
||||
*/ |
||||
public static void deleteJob(Scheduler scheduler, String jobName, String groupName) throws SchedulerException { |
||||
JobKey jobKey = JobKey.jobKey(jobName, groupName); |
||||
scheduler.deleteJob(jobKey); |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.ruoyi.quartz.config; |
||||
|
||||
import org.quartz.spi.TriggerFiredBundle; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.beans.factory.annotation.Configurable; |
||||
import org.springframework.context.ApplicationContext; |
||||
import org.springframework.scheduling.quartz.SpringBeanJobFactory; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
public class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory { |
||||
|
||||
@Autowired |
||||
private ApplicationContext applicationContext; |
||||
|
||||
@Override |
||||
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { |
||||
Object jobInstance = super.createJobInstance(bundle); |
||||
applicationContext.getAutowireCapableBeanFactory().autowireBean(jobInstance); |
||||
return jobInstance; |
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.ruoyi.quartz.config; |
||||
|
||||
import org.quartz.Scheduler; |
||||
import org.quartz.SchedulerException; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean; |
||||
|
||||
@Configuration |
||||
public class QuartzConfig { |
||||
|
||||
private final AutowiringSpringBeanJobFactory jobFactory; |
||||
|
||||
public QuartzConfig(AutowiringSpringBeanJobFactory jobFactory) { |
||||
this.jobFactory = jobFactory; |
||||
} |
||||
|
||||
@Bean |
||||
public SchedulerFactoryBean schedulerFactoryBean() { |
||||
SchedulerFactoryBean factory = new SchedulerFactoryBean(); |
||||
factory.setJobFactory(jobFactory); // 设置自定义 Job 工厂
|
||||
return factory; |
||||
} |
||||
|
||||
@Bean |
||||
public Scheduler scheduler(SchedulerFactoryBean schedulerFactoryBean) throws SchedulerException { |
||||
return schedulerFactoryBean.getScheduler(); |
||||
} |
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.quartz.task; |
||||
|
||||
import com.ruoyi.common.core.domain.TaskDTO; |
||||
import org.quartz.Job; |
||||
import org.quartz.JobExecutionContext; |
||||
import org.quartz.JobExecutionException; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component("autoTask") |
||||
public class AutoTaskJob implements Job { |
||||
|
||||
|
||||
@Override |
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
||||
|
||||
// 获取任务信息
|
||||
TaskDTO task = (TaskDTO) jobExecutionContext.getJobDetail().getJobDataMap().get("task"); |
||||
System.out.println("AutoTaskJob execute"); |
||||
System.out.println("执行任务:" + task.getTitle()); |
||||
jobExecutionContext.getJobDetail().getKey().getName(); |
||||
} |
||||
//
|
||||
|
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.ruoyi.system.domain; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
import lombok.Data; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
||||
/** |
||||
* 任务企业映射,用于关联任务与企业的对应关系。对象 task_enterprises |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-14 |
||||
*/ |
||||
@TableName("tasks_enterprises") |
||||
@Data |
||||
public class TaskEnterprises extends BaseEntity |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** 映射记录ID,主键 */ |
||||
@TableId(value = "id",type = IdType.AUTO) |
||||
private Long id; |
||||
|
||||
/** 任务ID */ |
||||
private Long taskId; |
||||
|
||||
/** 企业ID */ |
||||
private Long enterpriseId; |
||||
} |
@ -0,0 +1,86 @@
|
||||
package com.ruoyi.system.domain; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.time.LocalDateTime; |
||||
import java.util.Date; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
import java.io.Serializable; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
/** |
||||
* 任务,用于存储所有的任务信息,任务可由不同用户创建并管理。对象 tasks |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-14 |
||||
*/ |
||||
@Data |
||||
@AllArgsConstructor |
||||
@NoArgsConstructor |
||||
@TableName("tasks") |
||||
public class Tasks extends BaseEntity implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 任务ID,主键 |
||||
*/ |
||||
@TableId(type = IdType.AUTO) |
||||
private Long id; |
||||
|
||||
/** |
||||
* 任务标题 |
||||
*/ |
||||
@TableField("`title`") |
||||
private String title; |
||||
|
||||
/** |
||||
* 任务描述 |
||||
*/ |
||||
@TableField("`description`") |
||||
private String description; |
||||
|
||||
/** |
||||
* 任务类型,表示任务的类别,例如:1.发布任务、2.自动任务等 |
||||
*/ |
||||
@TableField("`task_type`") |
||||
private Integer taskType; |
||||
|
||||
/** |
||||
* 任务优先级 |
||||
*/ |
||||
@TableField("`priority`") |
||||
private String priority; |
||||
|
||||
/** |
||||
* 任务状态 |
||||
*/ |
||||
@TableField("`status`") |
||||
private String status; |
||||
|
||||
/** |
||||
* 任务计划开始时间 |
||||
*/ |
||||
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
@TableField("`start_date`") |
||||
private LocalDate startDate; |
||||
|
||||
/** |
||||
* 任务计划结束时间 |
||||
*/ |
||||
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
@TableField("`end_date`") |
||||
private LocalDate endDate; |
||||
|
||||
} |
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
package com.ruoyi.system.domain.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class LabelValueVo { |
||||
private String label; |
||||
private Long value; |
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.system.domain.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class TaskSaveVo { |
||||
//任务标题
|
||||
private String title; |
||||
//任务类型
|
||||
private Integer taskType; |
||||
//任务优先级
|
||||
private String priority; |
||||
//任务状态
|
||||
private String status; |
||||
//任务计划开始时间
|
||||
private LocalDate startDate; |
||||
//任务计划结束时间
|
||||
private LocalDate endDate; |
||||
//企业集合
|
||||
private List<Long> enterprisesList; |
||||
|
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.system.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ruoyi.system.domain.TaskEnterprises; |
||||
import com.ruoyi.system.domain.TaskEnterprises; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* ${comments} Mapper 接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date ${date} |
||||
*/ |
||||
@Mapper |
||||
public interface TaskEnterprisesMapper extends BaseMapper<TaskEnterprises> { |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.ruoyi.system.mapper; |
||||
|
||||
import java.util.List; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ruoyi.system.domain.Tasks; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* 任务,用于存储所有的任务信息,任务可由不同用户创建并管理。Mapper接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-14 |
||||
*/ |
||||
@Mapper |
||||
public interface TasksMapper extends BaseMapper<Tasks> { |
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.system.service; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.TaskEnterprises; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* 任务企业映射,用于关联任务与企业的对应关系。Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-14 |
||||
*/ |
||||
public interface ITaskEnterprisesService extends IService<TaskEnterprises> { |
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.ruoyi.system.service; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.Tasks; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ruoyi.system.domain.vo.TaskSaveVo; |
||||
|
||||
/** |
||||
* 任务,用于存储所有的任务信息,任务可由不同用户创建并管理。Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-14 |
||||
*/ |
||||
public interface ITasksService extends IService<Tasks> { |
||||
int insertTasks(TaskSaveVo taskSaveVo); |
||||
|
||||
List<Tasks> getAppTaskList(); |
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.ruoyi.system.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import com.ruoyi.system.mapper.TaskEnterprisesMapper; |
||||
import com.ruoyi.system.domain.TaskEnterprises; |
||||
import com.ruoyi.system.service.ITaskEnterprisesService; |
||||
|
||||
/** |
||||
* 任务企业映射,用于关联任务与企业的对应关系。Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-14 |
||||
*/ |
||||
@Service |
||||
public class TaskEnterprisesServiceImpl extends ServiceImpl<TaskEnterprisesMapper, TaskEnterprises> implements ITaskEnterprisesService { |
||||
|
||||
} |
@ -0,0 +1,74 @@
|
||||
package com.ruoyi.system.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ruoyi.common.exception.ServiceException; |
||||
import com.ruoyi.system.domain.TaskEnterprises; |
||||
import com.ruoyi.system.domain.vo.TaskSaveVo; |
||||
import com.ruoyi.system.mapper.TaskEnterprisesMapper; |
||||
import com.ruoyi.system.service.ITaskEnterprisesService; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import com.ruoyi.system.mapper.TasksMapper; |
||||
import com.ruoyi.system.domain.Tasks; |
||||
import com.ruoyi.system.service.ITasksService; |
||||
import com.ruoyi.system.mapper.TasksMapper; |
||||
import reactor.core.scheduler.Scheduler; |
||||
|
||||
import java.util.List; |
||||
//import org.quartz.Scheduler;
|
||||
|
||||
/** |
||||
* 任务,用于存储所有的任务信息,任务可由不同用户创建并管理。Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-14 |
||||
*/ |
||||
@Service |
||||
public class TasksServiceImpl extends ServiceImpl<TasksMapper, Tasks> implements ITasksService { |
||||
|
||||
@Autowired |
||||
private TaskEnterprisesMapper taskEnterprisesMapper; |
||||
@Autowired |
||||
private TasksMapper tasksMapper; |
||||
|
||||
|
||||
@Override |
||||
public int insertTasks(TaskSaveVo taskSaveVo) { |
||||
//任务类型
|
||||
Tasks tasks = new Tasks(); |
||||
|
||||
BeanUtils.copyProperties(taskSaveVo, tasks); |
||||
|
||||
final int insert = tasksMapper.insert(tasks); |
||||
if (insert < 1) { |
||||
throw new ServiceException("插入失败"); |
||||
} |
||||
|
||||
if (taskSaveVo.getTaskType() == 2) { |
||||
//自动执行
|
||||
|
||||
|
||||
} else { |
||||
|
||||
} |
||||
|
||||
final List<Long> enterprisesList = taskSaveVo.getEnterprisesList(); |
||||
for (Long id : enterprisesList) { |
||||
TaskEnterprises enterprises = new TaskEnterprises(); |
||||
enterprises.setTaskId(tasks.getId()); |
||||
enterprises.setEnterpriseId(id); |
||||
taskEnterprisesMapper.insert(enterprises); |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public List<Tasks> getAppTaskList() { |
||||
LambdaQueryWrapper<Tasks> wrapper = new LambdaQueryWrapper<>(); |
||||
wrapper.eq(Tasks::getTaskType, 1); |
||||
return tasksMapper.selectList(wrapper); |
||||
} |
||||
} |
@ -0,0 +1,106 @@
|
||||
<?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.system.mapper.TasksMapper"> |
||||
|
||||
<resultMap type="Tasks" id="TasksResult"> |
||||
<result property="id" column="id" /> |
||||
<result property="title" column="title" /> |
||||
<result property="description" column="description" /> |
||||
<result property="taskType" column="task_type" /> |
||||
<result property="priority" column="priority" /> |
||||
<result property="status" column="status" /> |
||||
<result property="startDate" column="start_date" /> |
||||
<result property="endDate" column="end_date" /> |
||||
<result property="createTime" column="create_time" /> |
||||
<result property="updateTime" column="update_time" /> |
||||
</resultMap> |
||||
|
||||
<sql id="selectTasksVo"> |
||||
select id, creator, title, description, task_type, priority, status, start_date, end_date, create_time, update_time, updater, deleted from tasks |
||||
</sql> |
||||
|
||||
<select id="selectTasksList" parameterType="Tasks" resultMap="TasksResult"> |
||||
<include refid="selectTasksVo"/> |
||||
<where> |
||||
<if test="creator != null "> and creator = #{creator}</if> |
||||
<if test="title != null and title != ''"> and title = #{title}</if> |
||||
<if test="description != null and description != ''"> and description = #{description}</if> |
||||
<if test="taskType != null "> and task_type = #{taskType}</if> |
||||
<if test="priority != null and priority != ''"> and priority = #{priority}</if> |
||||
<if test="status != null and status != ''"> and status = #{status}</if> |
||||
<if test="startDate != null "> and start_date = #{startDate}</if> |
||||
<if test="endDate != null "> and end_date = #{endDate}</if> |
||||
<if test="updater != null "> and updater = #{updater}</if> |
||||
<if test="deleted != null "> and deleted = #{deleted}</if> |
||||
</where> |
||||
</select> |
||||
|
||||
<select id="selectTasksById" parameterType="Long" resultMap="TasksResult"> |
||||
<include refid="selectTasksVo"/> |
||||
where id = #{id} |
||||
</select> |
||||
|
||||
<insert id="insertTasks" parameterType="Tasks" useGeneratedKeys="true" keyProperty="id"> |
||||
insert into tasks |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<if test="creator != null">creator,</if> |
||||
<if test="title != null and title != ''">title,</if> |
||||
<if test="description != null">description,</if> |
||||
<if test="taskType != null">task_type,</if> |
||||
<if test="priority != null and priority != ''">priority,</if> |
||||
<if test="status != null and status != ''">status,</if> |
||||
<if test="startDate != null">start_date,</if> |
||||
<if test="endDate != null">end_date,</if> |
||||
<if test="createTime != null">create_time,</if> |
||||
<if test="updateTime != null">update_time,</if> |
||||
<if test="updater != null">updater,</if> |
||||
<if test="deleted != null">deleted,</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="creator != null">#{creator},</if> |
||||
<if test="title != null and title != ''">#{title},</if> |
||||
<if test="description != null">#{description},</if> |
||||
<if test="taskType != null">#{taskType},</if> |
||||
<if test="priority != null and priority != ''">#{priority},</if> |
||||
<if test="status != null and status != ''">#{status},</if> |
||||
<if test="startDate != null">#{startDate},</if> |
||||
<if test="endDate != null">#{endDate},</if> |
||||
<if test="createTime != null">#{createTime},</if> |
||||
<if test="updateTime != null">#{updateTime},</if> |
||||
<if test="updater != null">#{updater},</if> |
||||
<if test="deleted != null">#{deleted},</if> |
||||
</trim> |
||||
</insert> |
||||
|
||||
<update id="updateTasks" parameterType="Tasks"> |
||||
update tasks |
||||
<trim prefix="SET" suffixOverrides=","> |
||||
<if test="creator != null">creator = #{creator},</if> |
||||
<if test="title != null and title != ''">title = #{title},</if> |
||||
<if test="description != null">description = #{description},</if> |
||||
<if test="taskType != null">task_type = #{taskType},</if> |
||||
<if test="priority != null and priority != ''">priority = #{priority},</if> |
||||
<if test="status != null and status != ''">status = #{status},</if> |
||||
<if test="startDate != null">start_date = #{startDate},</if> |
||||
<if test="endDate != null">end_date = #{endDate},</if> |
||||
<if test="createTime != null">create_time = #{createTime},</if> |
||||
<if test="updateTime != null">update_time = #{updateTime},</if> |
||||
<if test="updater != null">updater = #{updater},</if> |
||||
<if test="deleted != null">deleted = #{deleted},</if> |
||||
</trim> |
||||
where id = #{id} |
||||
</update> |
||||
|
||||
<delete id="deleteTasksById" parameterType="Long"> |
||||
delete from tasks where id = #{id} |
||||
</delete> |
||||
|
||||
<delete id="deleteTasksByIds" parameterType="String"> |
||||
delete from tasks where id in |
||||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
#{id} |
||||
</foreach> |
||||
</delete> |
||||
</mapper> |
Loading…
Reference in new issue