Commit 8b682ccc authored by wangjinjing's avatar wangjinjing

任务派发修改同步

parent 9e616c66
长兴县博物馆,每天8:30和15:00抽取监控截图,上传至服务器
\ No newline at end of file
quartz 执行任务派发到rabbitmq
\ No newline at end of file
package com.cx.cn.cxquartz.bean;
public class QuartzTaskRecords {
private Long id;
private String taskno;
private String timekeyvalue;
private Long executetime;
private String taskstatus;
private Integer failcount;
private String failreason;
private Long createtime;
private Long lastmodifytime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTaskno() {
return taskno;
}
public void setTaskno(String taskno) {
this.taskno = taskno == null ? null : taskno.trim();
}
public String getTimekeyvalue() {
return timekeyvalue;
}
public void setTimekeyvalue(String timekeyvalue) {
this.timekeyvalue = timekeyvalue == null ? null : timekeyvalue.trim();
}
public Long getExecutetime() {
return executetime;
}
public void setExecutetime(Long executetime) {
this.executetime = executetime;
}
public String getTaskstatus() {
return taskstatus;
}
public void setTaskstatus(String taskstatus) {
this.taskstatus = taskstatus == null ? null : taskstatus.trim();
}
public Integer getFailcount() {
return failcount;
}
public void setFailcount(Integer failcount) {
this.failcount = failcount;
}
public String getFailreason() {
return failreason;
}
public void setFailreason(String failreason) {
this.failreason = failreason == null ? null : failreason.trim();
}
public Long getCreatetime() {
return createtime;
}
public void setCreatetime(Long createtime) {
this.createtime = createtime;
}
public Long getLastmodifytime() {
return lastmodifytime;
}
public void setLastmodifytime(Long lastmodifytime) {
this.lastmodifytime = lastmodifytime;
}
}
package com.cx.cn.cxquartz.config;
/**
* 消息队列常量
*/
public class QueueConstants {
/**
* 派发任务队列常量
*/
public interface QueueSnapTaskConsumer{
/**
* 交换机名称
*/
String EXCHANGE = "RabbitMQ.DirectExchange.SnapTaskConsumer";
/**
* 队列名称
*/
String QUEUE = "RabbitMQ.DirectQueue.SnapTaskConsumer";
/**
* 路由键
*/
String ROUTEKEY = "RabbitMQ.RouteKey.SnapTaskConsumer";
}
/**
* 消息通知队列
*/
public enum QueueSnapTaskEnum {
QUEUE_SNAP_TASK_ENUM(QueueConstants.QueueSnapTaskConsumer.EXCHANGE,
QueueConstants.QueueSnapTaskConsumer.QUEUE,
QueueConstants.QueueSnapTaskConsumer.ROUTEKEY);
/**
* 交换机名称
*/
private String exchange;
/**
* 队列名称
*/
private String queue;
/**
* 路由键
*/
private String routeKey;
QueueSnapTaskEnum(String exchange, String queue, String routeKey) {
this.exchange = exchange;
this.queue = queue;
this.routeKey = routeKey;
}
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
this.exchange = exchange;
}
public String getQueue() {
return queue;
}
public void setQueue(String queue) {
this.queue = queue;
}
public String getRouteKey() {
return routeKey;
}
public void setRouteKey(String routeKey) {
this.routeKey = routeKey;
}
}
}
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.bean.QuartzTaskRecords;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface QuartzTaskRecordsMapper {
int deleteByPrimaryKey(Long id);
long insert(QuartzTaskRecords record);
int insertSelective(QuartzTaskRecords record);
QuartzTaskRecords selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(QuartzTaskRecords record);
int updateByPrimaryKey(QuartzTaskRecords record);
List<QuartzTaskRecords> getTaskRecordsByTaskNo(String taskNo);
}
package com.cx.cn.cxquartz.helper;
import com.cx.cn.cxquartz.util.JsonUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.core.MessageDeliveryMode;
import org.springframework.amqp.core.MessageProperties;
/**
* RabbitMQ消息处理类
*/
public class MessageHelper {
public static Message objToMsg(Object obj) {
if (null == obj) {
return null;
}
Message message = MessageBuilder.withBody(JsonUtil.objToStr(obj).getBytes()).build();
// 消息持久化
message.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT);
message.getMessageProperties().setContentType(MessageProperties.CONTENT_TYPE_JSON);
return message;
}
public static Message msgToMsg(String mess) {
if (null == mess) {
return null;
}
Message message = MessageBuilder.withBody(mess.getBytes()).build();
// 消息持久化
message.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT);
message.getMessageProperties().setContentType(MessageProperties.CONTENT_TYPE_JSON);
return message;
}
public static <T> T msgToObj(Message message, Class<T> clazz) {
if (null == message || null == clazz) {
return null;
}
String str = new String(message.getBody());
return JsonUtil.strToObj(str, clazz);
}
}
......@@ -2,19 +2,14 @@ package com.cx.cn.cxquartz.job;
import com.cx.cn.cxquartz.config.QueueConstants;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.redis.QueueSender;
import com.cx.cn.cxquartz.util.ApplicationContextHolder;
import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.util.Date;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
@DisallowConcurrentExecution
public class QuartzMainJobFactory implements Job {
......@@ -35,10 +30,6 @@ public class QuartzMainJobFactory implements Job {
QueueConstants.QueueSnapTaskEnum.QUEUE_SNAP_TASK_ENUM.getRouteKey(),
MessageHelper.objToMsg(jobDataMap.get("taskinfo")),
correlationData);
}catch (Exception ex){
logger.error("Scheduler executing error:{}",ex);
}
......
package com.cx.cn.cxquartz.redis;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@Component
public class OrderProducer implements Producer {
public static final Logger log = LoggerFactory.getLogger(OrderProducer.class);
@Autowired
private RedisTemplate redisTemplate;
public OrderProducer(){
}
@Override
public void produce(String queue,Object message) {
redisTemplate.opsForList().leftPush(queue,message);//消息左入
log.info("添加消息到队列:{}",message.toString());
}
}
package com.cx.cn.cxquartz.redis;
public interface Producer {
void produce(String queue,Object message);
}
package com.cx.cn.cxquartz.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@Service
public class QueueSender {
@Autowired
private RedisTemplate redisTemplate;
public QueueSender(RedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
public void sendMsg(String queue, Object msg) {
redisTemplate.opsForList().leftPush(queue, msg);
}
}
......@@ -25,18 +25,11 @@ public interface QuartzService {
void initLoadOnlineTasks();
void sendMessage(String message);
QuartzTaskRecords addTaskRecords(String taskNo);
Integer updateRecordById(Integer count, Long id);
Integer updateModifyTimeById(QuartzTaskInformations quartzTaskInformations);
Integer addTaskErrorRecord(String id, String errorKey, String errorValue);
List<QuartzTaskRecordsVo> taskRecords(String taskNo);
String runTaskRightNow(String taskNo);
QuartzTaskErrors detailTaskErrors(String recordId);
......
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.bean.QuartzTaskRecords;
import java.util.List;
public interface QuartzTaskRecordsService {
long addTaskRecords(QuartzTaskRecords quartzTaskRecords);
Integer updateTaskRecords(QuartzTaskRecords quartzTaskRecords);
List<QuartzTaskRecords> listTaskRecordsByTaskNo(String taskNo);
}
......@@ -6,7 +6,6 @@ import com.cx.cn.cxquartz.job.QuartzMainJobFactory;
import com.cx.cn.cxquartz.service.quartz.QuartzService;
import com.cx.cn.cxquartz.service.quartz.QuartzTaskErrorsService;
import com.cx.cn.cxquartz.service.quartz.QuartzTaskInformationsService;
import com.cx.cn.cxquartz.service.quartz.QuartzTaskRecordsService;
import com.cx.cn.cxquartz.util.ResultEnum;
import com.cx.cn.cxquartz.util.ResultUtil;
import com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo;
......@@ -34,8 +33,6 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
private static final Logger logger = LoggerFactory.getLogger(QuartzServiceImpl.class);
public static final String QUARTZ_TOPIC = "quartztopic";
private AtomicInteger atomicInteger;
@Autowired
private QuartzTaskInformationsService quartzTaskInformationsService;
......@@ -43,9 +40,6 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
@Autowired
private QuartzTaskErrorsService quartzTaskErrorsService;
@Autowired
private QuartzTaskRecordsService quartzTaskRecordsService;
@Autowired
private SchedulerFactoryBean schedulerBean;
......@@ -190,53 +184,6 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
this.initLoadOnlineTasks();
}
@Override
public QuartzTaskRecords addTaskRecords(String taskNo) {
QuartzTaskRecords quartzTaskRecords = null;
try {
QuartzTaskInformations quartzTaskInformation = quartzTaskInformationsService.getTaskByTaskNo(taskNo);
if (null == quartzTaskInformation || ResultEnum.FROZEN.name().equals(quartzTaskInformation.getFrozenstatus())) {
logger.info("taskNo={} not exist or status is frozen!");
return null;
}
long currentTimeMillis = System.currentTimeMillis();
//QuartzTaskInformations task = new QuartzTaskInformations();
//task.setId(quartzTaskInformation.getId());
// task.setLastmodifytime(currentTimeMillis);
// quartzTaskInformationsService.updateTask(task);
//logger.info("taskNo={},taskName={}更新最后修改时间成功", quartzTaskInformation.getTaskno(), quartzTaskInformation.getTaskname());
quartzTaskRecords = new QuartzTaskRecords();
quartzTaskRecords.setTaskno(taskNo);
quartzTaskRecords.setTimekeyvalue(quartzTaskInformation.getTimekey());
quartzTaskRecords.setExecutetime(currentTimeMillis);
quartzTaskRecords.setTaskstatus(ResultEnum.INIT.name());
quartzTaskRecords.setFailcount(0);
quartzTaskRecords.setFailreason("");
quartzTaskRecords.setCreatetime(currentTimeMillis);
quartzTaskRecords.setLastmodifytime(currentTimeMillis);
quartzTaskRecordsService.addTaskRecords(quartzTaskRecords);
logger.info("taskNo={},taskName={}添加执行记录表成功", quartzTaskInformation.getTaskno(), quartzTaskInformation.getTaskname());
} catch (Exception ex) {
logger.error("添加执行记录表异常exceptio={}", ex);
return null;
}
return quartzTaskRecords;
}
@Override
public Integer updateRecordById(Integer count, Long id) {
QuartzTaskRecords records = new QuartzTaskRecords();
records.setId(id);
records.setFailcount(count);
records.setLastmodifytime(System.currentTimeMillis());
if (count > 0) {
records.setTaskstatus(ResultEnum.FAIL.name());
} else {
records.setTaskstatus(ResultEnum.SUCCESS.name());
}
return quartzTaskRecordsService.updateTaskRecords(records);
}
@Override
public Integer updateModifyTimeById(QuartzTaskInformations quartzTaskInformations) {
......@@ -270,29 +217,6 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
logger.info("taskNo={},taskName={},scheduleRule={} load to quartz success!", quartzTaskInfo.getTaskno(), quartzTaskInfo.getTaskname(), quartzTaskInfo.getSchedulerrule());
}
/**
* kafka推送消息
*
* @param message
*/
@Override
public void sendMessage(String message) {
logger.info("给kafka推送消息message={}成功", message);
}
@Override
public List<QuartzTaskRecordsVo> taskRecords(String taskNo) {
List<QuartzTaskRecords> quartzTaskRecords = quartzTaskRecordsService.listTaskRecordsByTaskNo(taskNo);
QuartzTaskRecordsVo recordsVo = null;
List<QuartzTaskRecordsVo> voList = new ArrayList<>();
for (QuartzTaskRecords quartzTaskRecord : quartzTaskRecords) {
recordsVo = new QuartzTaskRecordsVo();
BeanUtils.copyProperties(quartzTaskRecord, recordsVo);
recordsVo.setTime(quartzTaskRecord.getLastmodifytime() - quartzTaskRecord.getCreatetime());
voList.add(recordsVo);
}
return voList;
}
@Override
public String runTaskRightNow(String taskNo) {
......
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.bean.QuartzTaskRecords;
import com.cx.cn.cxquartz.dao.QuartzTaskRecordsMapper;
import com.cx.cn.cxquartz.service.quartz.QuartzTaskRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class QuartzTaskRecordsServiceImpl implements QuartzTaskRecordsService {
@Autowired
private QuartzTaskRecordsMapper quartzTaskRecordsMapper;
@Override
public long addTaskRecords(QuartzTaskRecords quartzTaskRecords) {
return quartzTaskRecordsMapper.insert(quartzTaskRecords);
}
@Override
public Integer updateTaskRecords(QuartzTaskRecords quartzTaskRecords) {
return quartzTaskRecordsMapper.updateByPrimaryKeySelective(quartzTaskRecords);
}
public List<QuartzTaskRecords> listTaskRecordsByTaskNo(String taskNo) {
return quartzTaskRecordsMapper.getTaskRecordsByTaskNo(taskNo);
}
;
}
package com.cx.cn.cxquartz.util;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AdminInterceptor implements HandlerInterceptor {
/**
* 在请求处理之前进行调用(Controller方法调用之前)
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
// System.out.println("执行了TestInterceptor的preHandle方法");
try {
//
// //统一拦截(查询当前session是否存在user)(这里user会在每次登陆成功后,写入session)
// String token = (String) request.getSession().getAttribute("token");
// RestTemplate restTemplate = new RestTemplate();
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// ResponseEntity<String> result = null;
// if (null == token) {
// //登录
//// String jsontoken= dologin(restTemplate,headers);
//// request.getSession().setAttribute("token",jsontoken);
// }
// else{//验证权限
// headers.add("access-token", request.getSession().getAttribute("token").toString());
// ResponseEntity<Map> response_result = restTemplate.exchange(
// "http://www.zjwwzf.cn/xzzfSpv/ext/auth/verify.do",
// HttpMethod.GET,
// new HttpEntity<String>(headers),
// Map.class,
// new HashMap<>());
// Map<Object,Object> bodyresult = response_result.getBody();
// if(null!=bodyresult.get("status") && !String.valueOf(bodyresult.get("status")).equals("0")){
// String jsontoken= dologin(restTemplate,headers);
// request.getSession().setAttribute("token",jsontoken);
// }
// }
} catch (Exception e) {
e.printStackTrace();
}
return true;//如果设置为false时,被请求时,拦截器执行到此处将不会继续操作
//如果设置为true时,请求将会继续执行后面的操作
}
/**
* 请求处理之后进行调用,但是在视图被渲染之前(Controller方法调用之后)
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
// System.out.println("执行了TestInterceptor的postHandle方法");
}
/**
* 在整个请求结束之后被调用,也就是在DispatcherServlet 渲染了对应的视图之后执行(主要是用于进行资源清理工作)
*/
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
// System.out.println("执行了TestInterceptor的afterCompletion方法");
}
}
package com.cx.cn.cxquartz.util;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class LoginConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
//注册TestInterceptor拦截器
InterceptorRegistration registration = registry.addInterceptor(new AdminInterceptor());
registration.addPathPatterns("/**"); //所有路径都被拦截
registration.excludePathPatterns( //添加不拦截路径
"/**/*.html", //html静态资源
"/**/*.js", //js静态资源
"/**/*.css", //css静态资源
"/**/*.woff",
"/**/*.ttf"
);
}
}
server:
port: 4082
spring:
datasource:
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
maxActive: 1000
initialSize: 100
maxWait: 60000
minIdle: 500
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
local:
czurl: http://localhost:4082/ext/getRTSP/1
fxurl: http://localhost:4082/ext/getDeviceSnapshotAndRecognize
server:
port: 4085
spring:
datasource:
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
maxActive: 1000
initialSize: 100
maxWait: 60000
minIdle: 500
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
local:
czurl: http://localhost:4085/ext/getRTSP/1
fxurl: http://localhost:4085/ext/getDeviceSnapshotAndRecognize
\ No newline at end of file
server:
port: 8089
port: 7089
spring:
datasource:
url: jdbc:mysql://192.168.78.31:3307/hzdxtest?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
username: hzdxtest
password: 1qaz@wsx
url: jdbc:mysql://192.168.78.31:3306/imagepro?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
maxActive: 20
......@@ -44,17 +44,7 @@ spring:
#重试时间间隔
initial-interval: 3000
#最大重试次数
max-attempts: 3
# redis:
# database: 0
# host: 192.168.78.31
# port: 6379
# pool:
# max-active: 20
# max-wait: 3000
# max-idle: 1
# min-idle: 1
# timeout: 60000
max-attempts: 300
logging:
level:
......
server:
port: 7089
spring:
datasource:
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
rabbitmq:
host: 172.16.24.29
port: 5672
username: admin
password: admin
virtual-host: /
#消息发送到交换机确认机制,是否确认回调
publisher-confirms: true
##消息发送到交换机确认机制,是否返回回调
publisher-returns: true
#启用强制信息;默认false
template.mandatory: true
#设置为 true 后 消费者在消息没有被路由到合适队列情况下会被return监听,而不会自动删除
listener:
simple:
#设置手动确认(ack)
acknowledge-mode: manual
concurrency: 5
max-concurrency: 10
prefetch: 10
#开启消费者重试
retry:
enabled: true
#重试时间间隔
initial-interval: 3000
#最大重试次数
max-attempts: 300
logging:
level:
com.cx.cn.cxquartz.dao:
debug
......@@ -10,8 +10,3 @@ mybatis:
default-statement-timeout: 3000
mapper-locations: classpath:mapper/*.xml
redis:
database: 0
host: 172.16.24.29
port: 6379
......@@ -2,7 +2,7 @@
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
<!--<property name="log.path" value="/home/ubuntu/tar/zjdxtest/logs/${spring.application.name}"/>-->
<property name="log.path" value="/home/ubuntu/tar/logs/taskdispatch/${spring.application.name}"/>
<property name="log.path" value="/home/prod/tar/log/taskdispatch/${spring.application.name}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
......
<?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.cx.cn.cxquartz.dao.QuartzTaskRecordsMapper">
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.bean.QuartzTaskRecords">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="taskNo" property="taskno" jdbcType="VARCHAR"/>
<result column="timeKeyValue" property="timekeyvalue" jdbcType="VARCHAR"/>
<result column="executeTime" property="executetime" jdbcType="BIGINT"/>
<result column="taskStatus" property="taskstatus" jdbcType="VARCHAR"/>
<result column="failcount" property="failcount" jdbcType="INTEGER"/>
<result column="failReason" property="failreason" jdbcType="VARCHAR"/>
<result column="createTime" property="createtime" jdbcType="BIGINT"/>
<result column="lastModifyTime" property="lastmodifytime" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
id, taskNo, timeKeyValue, executeTime, taskStatus, failcount, failReason, createTime,
lastModifyTime
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from quartz_task_records
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from quartz_task_records
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" keyColumn="id"
parameterType="com.cx.cn.cxquartz.bean.QuartzTaskRecords">
insert into quartz_task_records (taskNo, timeKeyValue,
executeTime, taskStatus, failcount,
failReason, createTime, lastModifyTime
)
values (#{taskno,jdbcType=VARCHAR}, #{timekeyvalue,jdbcType=VARCHAR},
#{executetime,jdbcType=BIGINT}, #{taskstatus,jdbcType=VARCHAR}, #{failcount,jdbcType=INTEGER},
#{failreason,jdbcType=VARCHAR}, #{createtime,jdbcType=BIGINT}, #{lastmodifytime,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskRecords">
insert into quartz_task_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="taskno != null">
taskNo,
</if>
<if test="timekeyvalue != null">
timeKeyValue,
</if>
<if test="executetime != null">
executeTime,
</if>
<if test="taskstatus != null">
taskStatus,
</if>
<if test="failcount != null">
failcount,
</if>
<if test="failreason != null">
failReason,
</if>
<if test="createtime != null">
createTime,
</if>
<if test="lastmodifytime != null">
lastModifyTime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="taskno != null">
#{taskno,jdbcType=VARCHAR},
</if>
<if test="timekeyvalue != null">
#{timekeyvalue,jdbcType=VARCHAR},
</if>
<if test="executetime != null">
#{executetime,jdbcType=BIGINT},
</if>
<if test="taskstatus != null">
#{taskstatus,jdbcType=VARCHAR},
</if>
<if test="failcount != null">
#{failcount,jdbcType=INTEGER},
</if>
<if test="failreason != null">
#{failreason,jdbcType=VARCHAR},
</if>
<if test="createtime != null">
#{createtime,jdbcType=BIGINT},
</if>
<if test="lastmodifytime != null">
#{lastmodifytime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskRecords">
update quartz_task_records
<set>
<if test="taskno != null">
taskNo = #{taskno,jdbcType=VARCHAR},
</if>
<if test="timekeyvalue != null">
timeKeyValue = #{timekeyvalue,jdbcType=VARCHAR},
</if>
<if test="executetime != null">
executeTime = #{executetime,jdbcType=BIGINT},
</if>
<if test="taskstatus != null">
taskStatus = #{taskstatus,jdbcType=VARCHAR},
</if>
<if test="failcount != null">
failcount = #{failcount,jdbcType=INTEGER},
</if>
<if test="failreason != null">
failReason = #{failreason,jdbcType=VARCHAR},
</if>
<if test="createtime != null">
createTime = #{createtime,jdbcType=BIGINT},
</if>
<if test="lastmodifytime != null">
lastModifyTime = #{lastmodifytime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskRecords">
update quartz_task_records
set taskNo = #{taskno,jdbcType=VARCHAR},
timeKeyValue = #{timekeyvalue,jdbcType=VARCHAR},
executeTime = #{executetime,jdbcType=BIGINT},
taskStatus = #{taskstatus,jdbcType=VARCHAR},
failcount = #{failcount,jdbcType=INTEGER},
failReason = #{failreason,jdbcType=VARCHAR},
createTime = #{createtime,jdbcType=BIGINT},
lastModifyTime = #{lastmodifytime,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="getTaskRecordsByTaskNo" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from quartz_task_records where taskNo = #{taskNo} order by createTime desc;
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment