package test; import com.yeshi.location.app.Application; import com.yeshi.location.app.dao.user.UserInfoDao; import com.yeshi.location.app.entity.AdminUser; import com.yeshi.location.app.entity.SystemEnum; import com.yeshi.location.app.service.inter.AdminUserService; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.yeshi.utils.StringUtil; import org.yeshi.utils.statistic.BaseStatisticMySQLTimeQuery; import org.yeshi.utils.statistic.BaseStatisticTimeQuery; import org.yeshi.utils.statistic.StatisticTimeSpan; import javax.annotation.Resource; import java.util.Date; /** * @author hxh * @title: ConfigTest * @description: TODO * @date 2021/11/16 14:08 */ @SpringBootTest(classes = Application.class) public class AdminTest { @Resource private AdminUserService adminUserService; @Resource private UserInfoDao userInfoMapper; @Test public void addAdmin() throws Exception { AdminUser adminUser = new AdminUser(); adminUser.setAccount("admin"); adminUser.setCreateTime(new Date()); adminUser.setName("管理员"); adminUser.setPwd(StringUtil.Md5("123456")); adminUserService.add(adminUser); } @Test public void test(){ BaseStatisticTimeQuery timeQuery=new BaseStatisticTimeQuery(); timeQuery.setStartTime(new Date(System.currentTimeMillis()-1000*1000L)); timeQuery.setEndTime(new Date()); timeQuery.setTimeSpan(StatisticTimeSpan.day); userInfoMapper.statisticByCreateTime(SystemEnum.location,BaseStatisticMySQLTimeQuery.create(timeQuery)); userInfoMapper.selectByPrimaryKeyForUpdate(1L); } }