liufan9527
2024-11-27 5ab5c03df7b21f5b8b2af1b8e382139274e6f9a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.se.system.service;
 
import com.se.system.mapper.IndexMapper;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
 
@Component
@SuppressWarnings("ALL")
public class IndexService {
    @Resource
    IndexMapper indexMapper;
 
    public static SimpleDateFormat YYYY_MM_DD_HH_MM_SS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
    public int newUserCount(int day) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DAY_OF_MONTH, -day);
        String createTime = YYYY_MM_DD_HH_MM_SS.format(calendar.getTime());
 
        return indexMapper.newUserCount(createTime);
    }
}