Revert "1123"

This reverts commit 9ec8efec12.
This commit is contained in:
77
2024-05-05 16:20:28 +08:00
parent 9ec8efec12
commit d0684dcaa5
14 changed files with 20 additions and 125 deletions

View File

@@ -1,46 +0,0 @@
package com.bashi.dk.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bashi.common.core.domain.AjaxResult;
import com.bashi.common.core.domain.entity.Customer;
import com.bashi.dk.domain.Borrow;
import com.bashi.dk.service.BorrowService;
import com.bashi.dk.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/dk/home")
public class HomeController {
@Autowired
private CustomerService customerService;
@Autowired
private BorrowService borrowService;
@GetMapping("/index")
public AjaxResult<Map<String,Long>> index() {
Map<String,Long> map = new HashMap<>();
LocalDate now = LocalDate.now();
// 今日注册, 总注册
long todayRegister = customerService.count(Wrappers.lambdaQuery(Customer.class).between(Customer::getCreateTime,
now.atTime(LocalTime.MIN), now.atTime(LocalTime.MAX)));
long totalRegister = customerService.count();
// 今日订单, 总订单
long todayBorrow = borrowService.count(Wrappers.lambdaQuery(Borrow.class).between(Borrow::getCreateTime,
now.atTime(LocalTime.MIN), now.atTime(LocalTime.MAX)));
long totalBorrow = borrowService.count();
map.put("todayRegister",todayRegister);
map.put("totalRegister",totalRegister);
map.put("todayBorrow",todayBorrow);
map.put("totalBorrow",totalBorrow);
return AjaxResult.success(map);
}
}