提交修改
This commit is contained in:
parent
b25a590462
commit
d931366345
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.job.entity.ScheduleJobEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -26,4 +27,6 @@ public interface ScheduleJobDao extends BaseMapper<ScheduleJobEntity> {
|
||||
* 批量更新状态
|
||||
*/
|
||||
int updateBatch(Map<String, Object> map);
|
||||
|
||||
List<ScheduleJobEntity> selectAll();
|
||||
}
|
||||
|
||||
@ -33,12 +33,18 @@ public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, Schedule
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ScheduleJobDao scheduleJobMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化定时器
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
List<ScheduleJobEntity> scheduleJobList = this.list();
|
||||
List<ScheduleJobEntity> scheduleJobList = scheduleJobMapper.selectAll();
|
||||
for(ScheduleJobEntity scheduleJob : scheduleJobList){
|
||||
CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getJobId());
|
||||
//如果不存在,则创建
|
||||
|
||||
@ -11,4 +11,10 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectAll" resultType="com.lz.modules.job.entity.ScheduleJobEntity">
|
||||
select * from schedule_job where status = 0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user