zqy
2024-06-23 a69aafe60ce001834b981778f12fd74d4af77e23
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
package com.ruoyi.web.controller.zhang;
 
 
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.ZfLog;
import com.ruoyi.service.ZfLogService;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
import java.util.Arrays;
 
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(){
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
 
        Page<ZfLog> zfLogPage = new Page<>(pageNum,pageSize);
        Page<ZfLog> page = zfLogService.page(zfLogPage);
 
        return AjaxResult.success(MapUtils.getResult(page));
    }
 
 
    @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();
    }
 
}