13693261870
2025-06-24 8565bd83fcd670ec8379084d600eb97d18037d21
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.terra.system.controller.sys;
 
import com.terra.system.annotation.SysLog;
import com.terra.system.controller.all.BaseController;
import com.terra.system.entity.all.ResponseMsg;
import com.terra.system.entity.sys.DownlogEntity;
import com.terra.system.service.sys.DownlogService;
import com.terra.system.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
 
import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.List;
 
/**
 * 下载日志
 * @author WWW
 */
@Api(tags = "运维管理\\下载日志")
@RestController
@RequestMapping("/downlog")
public class DownlogController extends BaseController {
    @Resource
    DownlogService downlogService;
 
    @Resource
    TokenService tokenService;
 
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", example = "员"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "3"),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "Timestamp", paramType = "query", example = "2022-12-09 09:00:00"),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "Timestamp", paramType = "query", example = "2022-12-25 17:00:00"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPageAndCount")
    public ResponseMsg<Object> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
 
            int count = downlogService.selectCount(uname, type, start, end);
            if (count == 0) {
                return success(0, null);
            }
 
            List<DownlogEntity> rs = downlogService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1));
 
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}