main
parent
b99154e174
commit
9c7db3bfca
|
|
@ -1,7 +1,10 @@
|
|||
package com.ruoyi.app.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
|
|
@ -13,6 +16,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
|
|||
* @author wyh
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
@Data
|
||||
public class AppEvents extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -54,6 +58,8 @@ public class AppEvents extends BaseEntity
|
|||
@Excel(name = "状态:1-未开始,2-报名中,3-已结束")
|
||||
private Long type;
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
|
@ -136,6 +142,7 @@ public class AppEvents extends BaseEntity
|
|||
return type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -58,4 +58,6 @@ public interface AppEventsMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteAppEventsByIds(Long[] ids);
|
||||
|
||||
int updateByTypeAppEvents(AppEvents appEvents);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.app.service;
|
||||
|
||||
import com.ruoyi.app.domain.AppEvents;
|
||||
import com.ruoyi.app.mapper.AppEventsMapper;
|
||||
import com.ruoyi.app.mapper.AppUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
|
@ -12,6 +14,9 @@ public class ScheduledService {
|
|||
@Autowired
|
||||
private AppUserMapper appUserMapper;
|
||||
|
||||
@Autowired
|
||||
private AppEventsMapper appEventsMapper;
|
||||
|
||||
@Scheduled(cron = "0/5 * * * * *")
|
||||
public void updateUserMember(){
|
||||
appUserMapper.updateAppUserById();
|
||||
|
|
@ -20,4 +25,13 @@ public class ScheduledService {
|
|||
appUserMapper.updateAppUserById(ids);
|
||||
}*/
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 */1 * * * *")
|
||||
public void updateEvents(){
|
||||
AppEvents appEvents = new AppEvents();
|
||||
appEvents.setType(1l);
|
||||
appEventsMapper.updateByTypeAppEvents(appEvents);
|
||||
appEvents.setType(2l);
|
||||
appEventsMapper.updateByTypeAppEvents(appEvents);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateByTypeAppEvents" parameterType="AppEvents">
|
||||
update app_events
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="type == 1">type = 2,</if>
|
||||
<if test="type == 2">type = 3,</if>
|
||||
update_time = now(),
|
||||
</trim>
|
||||
where
|
||||
<if test="type == 1">
|
||||
type = 1
|
||||
and start_time gt;= now()
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
type = 2
|
||||
and end_time gt;= now()
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<delete id="deleteAppEventsById" parameterType="Long">
|
||||
delete from app_events where id = #{id}
|
||||
</delete>
|
||||
|
|
|
|||
Loading…
Reference in New Issue