郑楚滨
3 months ago
8 changed files with 124 additions and 66 deletions
@ -0,0 +1,53 @@ |
|||||
|
package demo.Controller; |
||||
|
|
||||
|
import demo.Entity.CountCaseInfo; |
||||
|
import demo.Entity.CountRoleUser; |
||||
|
import demo.Entity.Result; |
||||
|
import demo.Service.CaseInfoService; |
||||
|
import demo.Service.UserRoleService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @统计相关 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@RestController |
||||
|
@RequestMapping("/count") |
||||
|
@Validated |
||||
|
public class CountController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CaseInfoService caseInfoService; |
||||
|
|
||||
|
@Autowired |
||||
|
private UserRoleService userRoleService; |
||||
|
|
||||
|
@GetMapping("/userCaseInfo") |
||||
|
public Result<List<CountCaseInfo>> userCaseInfo() { |
||||
|
return Result.success(caseInfoService.countUserCaseInfo()); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/dayCaseInfo") |
||||
|
public Result<List<CountCaseInfo>> dayCaseInfo() { |
||||
|
return Result.success(caseInfoService.countCreateTime()); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/untilDayCaseInfo") |
||||
|
public Result<List<CountCaseInfo>> countUntilDate(@RequestParam(required = false) Date date) { |
||||
|
if(date == null){ |
||||
|
date = new Date(); |
||||
|
} |
||||
|
return Result.success(caseInfoService.countUntilDate(date)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/countRoleUser") |
||||
|
public Result<List<CountRoleUser>> countRoleUser() { |
||||
|
return Result.success(userRoleService.countRoleUser()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package demo.Entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
public class CountCaseInfo { |
||||
|
private String user; |
||||
|
private Date date; |
||||
|
private int count; |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
package demo.Entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class CountRoleUser { |
||||
|
private int roleId; |
||||
|
private int count; |
||||
|
} |
Loading…
Reference in new issue