main
parent
8da66d5720
commit
b773612966
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统模块
|
* 系统模块
|
||||||
|
|
@ -15,6 +16,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
public class RuoYiAppApplication
|
public class RuoYiAppApplication
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,7 @@ public interface AppUserMapper
|
||||||
|
|
||||||
AppUser selectAppUserByPhone(@Param("phoneNumber") String phoneNumber);
|
AppUser selectAppUserByPhone(@Param("phoneNumber") String phoneNumber);
|
||||||
List<AppUserDataVo> selectList(AppUser appUser);
|
List<AppUserDataVo> selectList(AppUser appUser);
|
||||||
|
|
||||||
|
List<Long> listByOrderTime();
|
||||||
|
void updateAppUserById(@Param("ids")List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.ruoyi.app.service;
|
||||||
|
|
||||||
|
import com.ruoyi.app.mapper.AppUserMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ScheduledService {
|
||||||
|
@Autowired
|
||||||
|
private AppUserMapper appUserMapper;
|
||||||
|
|
||||||
|
@Scheduled(cron = "0/5 * * * * *")
|
||||||
|
public void updateUserMember(){
|
||||||
|
List<Long> ids = appUserMapper.listByOrderTime();
|
||||||
|
if (ids != null && ids.size() > 0) {
|
||||||
|
appUserMapper.updateAppUserById(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -162,6 +162,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
group by a.id
|
group by a.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="listByOrderTime" resultType="java.lang.Long">
|
||||||
|
select
|
||||||
|
a.id
|
||||||
|
from app_user a
|
||||||
|
<where>
|
||||||
|
a.is_member = 0
|
||||||
|
and a.order_end_time > now()
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateAppUserById" parameterType="java.lang.Long">
|
||||||
|
update app_user set is_member = 1
|
||||||
|
where id in
|
||||||
|
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<insert id="insertAppUser" parameterType="AppUser" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertAppUser" parameterType="AppUser" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into app_user
|
insert into app_user
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue