feige
2024-12-01 4e170beb5569ee2a8c12d472cd39f21333e94735
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package com.ruoyi.web.controller.zhang;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.domain.ZfClean;
import com.ruoyi.domain.ZfLog;
import com.ruoyi.service.ZfLogService;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
 
import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ojq
 * @since 2023-09-06
 */
@RestController
@RequestMapping("/log")
public class ZfLogController {
 
    @Resource
    private ZfLogService zfLogService;
 
    @GetMapping("/list")
    public AjaxResult list(ZfLog zfLog) throws ParseException {
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
 
 
        String st = ServletUtils.getParameter("module");
        if(st!=null&&!st.equals("")) {
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            LocalDateTime dateTime = LocalDate.parse(st, DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
 
 
 
 
 
 
 
 
        return zfLogService.selectDataList(dateTime, pageNum, pageSize);
        }
        else
        {
            return  AjaxResult.success();
        }
 
//        List<ZfLog> beanRecords = pageResult.getRecords();//得到查询出来的数据
//        Page<ZfLog> zfLogPage = new Page<>(pageNum,pageSize);
//        Page<ZfLog> page = zfLogService.page(zfLogPage);
 
     //   return AjaxResult.success(MapUtils.getResult(pageResult));
    }
 
 
    @GetMapping("{id}")
    public AjaxResult getById(@PathVariable Long id){
        ZfLog byId = zfLogService.getById(id);
        return AjaxResult.success(byId);
 
    }
 
    @PostMapping()
    public AjaxResult save(@RequestBody ZfLog zfLog){
        zfLogService.save(zfLog);
        return AjaxResult.success();
    }
 
    @PutMapping()
    public AjaxResult update(@RequestBody ZfLog zfLog){
        zfLogService.updateById(zfLog);
        return AjaxResult.success();
    }
 
    @DeleteMapping("/{ids}")
    private AjaxResult delete(@PathVariable Long[] ids){
        zfLogService.removeBatchByIds(Arrays.asList(ids));
        return AjaxResult.success();
    }
 
}