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); } }